Esempio n. 1
0
        private async void btnMultiFiles_Click(object sender, RoutedEventArgs e)
        {
            var plist = new SYEngine.Playlist(SYEngine.PlaylistTypes.LocalFile);

            plist.Append(Windows.ApplicationModel.Package.Current.InstalledLocation.Path + "\\MultipartStreamMatroska\\0.mp4", 0, 0);
            plist.Append(Windows.ApplicationModel.Package.Current.InstalledLocation.Path + "\\MultipartStreamMatroska\\1.mp4", 0, 0);

            tbPlayStatus.Text = string.Empty;
            SYEngine.Core.ForceSoftwareDecode = (bool)cboxSoftDecode.IsChecked;

            player.Source = await plist.SaveAndGetFileUriAsync();
        }
Esempio n. 2
0
        private async void btnMultiFiles_Click(object sender, RoutedEventArgs e)
        {
            var plist = new SYEngine.Playlist(SYEngine.PlaylistTypes.LocalFile);
            plist.Append(Windows.ApplicationModel.Package.Current.InstalledLocation.Path + "\\MultipartStreamMatroska\\0.mp4", 0, 0);
            plist.Append(Windows.ApplicationModel.Package.Current.InstalledLocation.Path + "\\MultipartStreamMatroska\\1.mp4", 0, 0);

            tbPlayStatus.Text = string.Empty;
            player.IsLooping = (bool)cboxLoop.IsChecked;
            SYEngine.Core.ForceSoftwareDecode = (bool)cboxSoftDecode.IsChecked;

            player.Source = await plist.SaveAndGetFileUriAsync();
        }
Esempio n. 3
0
        private async void btnMultiUrl_Click(object sender, RoutedEventArgs e)
        {
            var test = new Uri(tboxNetworkUri.Text);

            var plist = new SYEngine.Playlist(SYEngine.PlaylistTypes.NetworkHttp);
            var cfgs = default(SYEngine.PlaylistNetworkConfigs);
            cfgs.DownloadRetryOnFail = true;
            cfgs.DetectDurationForParts = true;
            cfgs.HttpUserAgent = string.Empty;
            cfgs.HttpReferer = string.Empty;
            cfgs.HttpCookie = string.Empty;
            cfgs.UniqueId = System.IO.Path.GetFileNameWithoutExtension(tboxNetworkUri.Text);
            cfgs.BufferBlockSizeKB = 64; //one block is 64KB
            cfgs.BufferBlockCount = 160; //160 * 64K = 10M network io buf.
            plist.NetworkConfigs = cfgs;
            plist.Append(tboxNetworkUri.Text, 0, 0);
#if DEBUG
            var debugFile = System.IO.Path.Combine(Windows.Storage.ApplicationData.Current.TemporaryFolder.Path, "DebugFile.mkv");
            plist.SetDebugFile(debugFile);
#endif

            tbPlayStatus.Text = string.Empty;
            player.IsLooping = (bool)cboxLoop.IsChecked;
            SYEngine.Core.ForceSoftwareDecode = (bool)cboxSoftDecode.IsChecked;

            player.Source = await plist.SaveAndGetFileUriAsync();
        }
Esempio n. 4
0
        private async void PlayLocalVideo()
        {
            List <string> localUrl = new List <string>();

            foreach (var videoFile in _localVideoData.VideoFiles)
            {
                var file = await LocalStorageFunc.GetVideoFileUrl(videoFile);

                if (file != null)
                {
                    localUrl.Add(file);
                }
            }

            var play_list = new SYEngine.Playlist(SYEngine.PlaylistTypes.LocalFile);

            foreach (var url in localUrl)
            {
                play_list.Append(url, 0, 0);
            }

            Player.Source = await play_list.SaveAndGetFileUriAsync();

            Player.Play();
            Player.MediaOpened += Player_MediaOpened;
            Player.MediaEnded  += Player_MediaEnded;
        }
Esempio n. 5
0
        private async void FileOpenPicker_ContinuationEvent(object sender, Windows.ApplicationModel.Activation.IContinuationActivatedEventArgs e)
        {
            App.ContinuationEventArgsChanged -= FileOpenPicker_ContinuationEvent;

            var arg = e as Windows.ApplicationModel.Activation.FileOpenPickerContinuationEventArgs;

            if (arg != null)
            {
                var file = arg.Files[0];
                if (file != null)
                {
                    SYEngine.Core.ForceSoftwareDecode = (bool)cboxSoftDecode.IsChecked;
                    if (!kIsPlayRemux)
                    {
                        player.SetSource(await file.OpenReadAsync(), file.ContentType);
                    }
                    else
                    {
                        var plist = new SYEngine.Playlist(SYEngine.PlaylistTypes.LocalFile);
                        plist.Append(file.Path, 0, 0);
                        player.Source = await plist.SaveAndGetFileUriAsync();
                    }
                }
            }
        }
Esempio n. 6
0
        private async Task <Uri> GetSource(List <string> play_list)
        {
            Uri source;

            if (play_list.Count == 1 && !syflag)
            {
                source = new Uri(play_list[0]);
            }
            else
            {
                //载入播放引擎
                SYEngine.Core.Initialize();
                var playlist = new SYEngine.Playlist(param.IsLocalFile ? SYEngine.PlaylistTypes.LocalFile : SYEngine.PlaylistTypes.NetworkHttp);
                //将分段添加到playlist
                foreach (var url in play_list)
                {
                    playlist.Append(url, 0, 0);
                }
                //配置引擎
                SYEngine.PlaylistNetworkConfigs cfgs = default(SYEngine.PlaylistNetworkConfigs);
                cfgs.HttpUserAgent          = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36";
                cfgs.HttpReferer            = string.Empty;
                cfgs.HttpCookie             = string.Empty;
                cfgs.UniqueId               = string.Empty;
                cfgs.DownloadRetryOnFail    = true;
                cfgs.DetectDurationForParts = true;
                playlist.NetworkConfigs     = cfgs;
                source = await playlist.SaveAndGetFileUriAsync();
            }
            return(source);
        }
Esempio n. 7
0
        private async void btnRemuxPlay_Click(object sender, RoutedEventArgs e)
        {
            tbPlayStatus.Text = string.Empty;
            player.IsLooping  = (bool)cboxLoop.IsChecked;
            SYEngine.Core.ForceSoftwareDecode = (bool)cboxSoftDecode.IsChecked;

            var op = new FileOpenPicker();

            op.ViewMode = PickerViewMode.List;
            op.FileTypeFilter.Add(".flv");
            op.FileTypeFilter.Add(".f4v");
            op.FileTypeFilter.Add(".mkv");
            op.FileTypeFilter.Add(".mp4");
            var files = await op.PickMultipleFilesAsync();

            if (files != null && files.Count > 0)
            {
                var plist = new SYEngine.Playlist(SYEngine.PlaylistTypes.LocalFile);
                foreach (var file in files)
                {
                    plist.Append(file.Path, 0, 0);
                }
                player.Source = await plist.SaveAndGetFileUriAsync();
            }
        }
Esempio n. 8
0
        private async void btnMultiUrl_Click(object sender, RoutedEventArgs e)
        {
            var test = new Uri(tboxNetworkUri.Text);

            var plist = new SYEngine.Playlist(SYEngine.PlaylistTypes.NetworkHttp);
            var cfgs  = default(SYEngine.PlaylistNetworkConfigs);

            cfgs.DownloadRetryOnFail    = true;
            cfgs.DetectDurationForParts = true;
            cfgs.HttpUserAgent          = string.Empty;
            cfgs.HttpReferer            = string.Empty;
            cfgs.HttpCookie             = string.Empty;
            cfgs.UniqueId          = System.IO.Path.GetFileNameWithoutExtension(tboxNetworkUri.Text);
            cfgs.BufferBlockSizeKB = 64;  //one block is 64KB
            cfgs.BufferBlockCount  = 160; //160 * 64K = 10M network io buf.
            plist.NetworkConfigs   = cfgs;
            plist.Append(tboxNetworkUri.Text, 0, 0);
#if DEBUG
            var debugFile = System.IO.Path.Combine(Windows.Storage.ApplicationData.Current.TemporaryFolder.Path, "DebugFile.mkv");
            plist.SetDebugFile(debugFile);
#endif

            tbPlayStatus.Text = string.Empty;
            player.IsLooping  = (bool)cboxLoop.IsChecked;
            SYEngine.Core.ForceSoftwareDecode = (bool)cboxSoftDecode.IsChecked;

            player.Source = await plist.SaveAndGetFileUriAsync();
        }
Esempio n. 9
0
        public async void Play2_ClickAsync()
        {
            //https://github.com/amamiya/SYEngine/blob/master/!GUIDE/Segment/Segment.md 播放分段的 FLV\MP4



            //载入播放引擎
            SYEngine.Core.Initialize();
            //所有URL地址列表
            var url_list = new List <String>();//实例化新的 SYEngine.Playlist 对象;

            //url_list.Add("http://data.vod.itc.cn/?rb=1&key=jbZhEJhlqlUN-Wj_HEI8BjaVqKNFvDrn&prod=flash&pt=1&new=/51/116/UdKGIuSjQIO8dynrybyS1E.mp4");


            url_list.Add("http://player.acfun.cn/route_mp4?dt=0&uid=0&timestamp=1540371865&fid=040040020400005BCEED7100010002570000000000-0000-0000-0231-311400000000.mp4&ns=video.acfun.cn&ran=0&vid=5bceeca80cf2c691e00a68fb&customer_id=5859fdaee4b0eaf5dd325b91&sign=ct5bd035990cf22adc685b3ddc");
            //拒绝访问了 问题应该出在请求头


            //构造SYEngine的PlayList。
            var play_list = new SYEngine.Playlist(SYEngine.PlaylistTypes.NetworkHttp);//网络类型

            foreach (var url in url_list)
            {
                //获取每个URL文件的媒体时长和文件大小。
                //如果你的App能通过其他方法提供这些信息,也可以不执行这样的操作。
                // var file = new SYEngine.MediaInformation();
                //await file.OpenAsync(new Uri(url));//失败会有异常,这里忽略。


                play_list.Append(url, 0, 0); // 添加到PlayList
                //也可一〉play_ list. Append(url, D, 0), 然后把cfgs的DetectDur ationF orParts设置为true。
                //播放引擎会自动连接所有 分段地址去获取文件大小和时长。
            }

            //设置网络参数。使用 SYEngine.PlaylistNetworkConfigs 结构体来设置网络参数。这个结构体的相关解释请拉到页面底部的 网络选项说明 来查看
            SYEngine.PlaylistNetworkConfigs cfgs = default(SYEngine.PlaylistNetworkConfigs);
            cfgs.HttpUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36";

            cfgs.HttpReferer = string.Empty;

            cfgs.HttpCookie = string.Empty;



            cfgs.UniqueId               = string.Empty; //如果要使用动态更新URL,这个不能是Empty,这里不使用。
            cfgs.DownloadRetryOnFail    = true;         //启用断线重连,建议打开。
            cfgs.DetectDurationForParts = true;
            play_list.NetworkConfigs    = cfgs;



            //设置到MedisElement。
            MediaPlayer1.Source = await play_list.SaveAndGetFileUriAsync();// 最后,使用 MediaElement 的 Play 方法来播放,或者设置 AutoPlay 属性为true

            MediaPlayer1.Play();
        }
Esempio n. 10
0
        private async void btnMultiUrl_Click(object sender, RoutedEventArgs e)
        {
            var test = new Uri(tboxNetworkUri.Text);

            var plist = new SYEngine.Playlist(SYEngine.PlaylistTypes.NetworkHttp);
            var cfgs  = default(SYEngine.PlaylistNetworkConfigs);

            cfgs.DownloadRetryOnFail    = true;
            cfgs.DetectDurationForParts = true;
            cfgs.HttpUserAgent          = string.Empty;
            cfgs.HttpReferer            = string.Empty;
            cfgs.HttpCookie             = string.Empty;
            cfgs.UniqueId        = System.IO.Path.GetFileNameWithoutExtension(tboxNetworkUri.Text);
            plist.NetworkConfigs = cfgs;
            plist.Append(tboxNetworkUri.Text, 0, 0);

            tbPlayStatus.Text = string.Empty;
            SYEngine.Core.ForceSoftwareDecode = (bool)cboxSoftDecode.IsChecked;

            player.Source = await plist.SaveAndGetFileUriAsync();
        }
Esempio n. 11
0
        private async void PlayVideo(VideosSource vs)
        {
            var play_list = new SYEngine.Playlist(SYEngine.PlaylistTypes.NetworkHttp);

            foreach (var url in vs.AcUrl)
            {
                play_list.Append(url.url, url.size, (float)url.Time);
            }

            SYEngine.PlaylistNetworkConfigs cfgs = default(SYEngine.PlaylistNetworkConfigs);
            cfgs.HttpUserAgent       = "windows 10";
            cfgs.HttpUserAgent       = string.Empty;
            cfgs.HttpReferer         = string.Empty;
            cfgs.HttpCookie          = string.Empty;
            cfgs.UniqueId            = string.Empty;
            cfgs.DownloadRetryOnFail = true;
            play_list.NetworkConfigs = cfgs;
            Player.Source            = await play_list.SaveAndGetFileUriAsync();

            Player.Play();

            Player.MediaOpened += Player_MediaOpened;
            Player.MediaEnded  += Player_MediaEnded;
        }
Esempio n. 12
0
        private async void btnRemuxPlay_Click(object sender, RoutedEventArgs e)
        {
            tbPlayStatus.Text = string.Empty;
            player.IsLooping = (bool)cboxLoop.IsChecked;
            SYEngine.Core.ForceSoftwareDecode = (bool)cboxSoftDecode.IsChecked;

            var op = new FileOpenPicker();
            op.ViewMode = PickerViewMode.List;
            op.FileTypeFilter.Add(".flv");
            op.FileTypeFilter.Add(".f4v");
            op.FileTypeFilter.Add(".mkv");
            op.FileTypeFilter.Add(".mp4");
            var file = await op.PickSingleFileAsync();
            if (file != null)
            {
                var plist = new SYEngine.Playlist(SYEngine.PlaylistTypes.LocalFile);
                plist.Append(file.Path, 0, 0);
                player.Source = await plist.SaveAndGetFileUriAsync();
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 读取番剧播放地址
        /// </summary>
        /// <param name="model"></param>
        /// <param name="quality"></param>
        /// <returns></returns>
        public static async Task <ReturnPlayModel> GetBangumiUrl(PlayerModel model, int qn)
        {
            try
            {
                if (qn < 10)
                {
                    switch (qn)
                    {
                    case 1:
                        qn = 32;
                        break;

                    case 2:
                        qn = 64;
                        break;

                    case 3:
                        qn = 80;
                        break;

                    case 4:
                        qn = 116;
                        break;

                    default:
                        qn = 64;
                        break;
                    }
                }


                List <string> urls = new List <string>();
                string        url  = string.Format("https://interface.bilibili.com/v2/playurl?cid={0}&player=1&quality={1}&qn={1}&ts={2}", model.Mid, qn, ApiHelper.GetTimeSpan);
                url += "&sign=" + ApiHelper.GetSign_PlayUrl(url);

                string re = await WebClientClass.GetResults(new Uri(url));

                var playList = new SYEngine.Playlist(SYEngine.PlaylistTypes.NetworkHttp);

                SYEngine.PlaylistNetworkConfigs config = new SYEngine.PlaylistNetworkConfigs();
                config.DownloadRetryOnFail = true;
                config.HttpCookie          = string.Empty;
                config.UniqueId            = string.Empty;
                config.HttpUserAgent       = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36";

                if (re.Contains("<code>"))
                {
                    //string url2 = string.Format("https://bangumi.bilibili.com/player/web_api/playurl/?access_key={3}&cid={0}&module=bangumi&player=1&otype=json&type=flv&quality={1}&ts={2}", model.Mid, quality, GetTimeSpan_2,access_key);
                    //url2 += "&sign=" + ApiHelper.GetSign_VIP(url2);
                    //
                    string url2 = string.Format(
                        "https://bangumi.bilibili.com/player/web_api/v2/playurl?cid={1}&appkey={0}&otype=json&type=&quality={2}&module=bangumi&season_type=1&qn={2}&ts={3}", ApiHelper._appKey_VIDEO, model.Mid, qn, ApiHelper.GetTimeSpan_2);
                    url2 += "&sign=" + ApiHelper.GetSign_VIDEO(url2);
                    re    = await WebClientClass.GetResultsUTF8Encode(new Uri(url2));

                    FlvPlyaerUrlModel m = JsonConvert.DeserializeObject <FlvPlyaerUrlModel>(re);
                    if (m.code == 0 && !re.Contains("8986943") && (m.status == 13 && m.vip_status != 0))
                    {
                        //if (m.durl.Count==1)
                        //{
                        //    return new ReturnPlayModel()
                        //    {
                        //        usePlayMode = UsePlayMode.System,
                        //        url = m.durl[0].url,
                        //        urls = urls
                        //    };
                        //}

                        foreach (var item in m.durl)
                        {
                            urls.Add(item.url);
                            playList.Append(item.url, item.size, item.length / 1000);
                        }
                    }
                    else
                    {
                        string rnd = ApiHelper.GetTimeSpan.ToString();
                        if (SettingHelper.Get_UseVIP())
                        {
                            rnd = "true" + rnd;
                        }
                        var re3 = await WebClientClass.GetResults(new Uri(string.Format("https://moe.nsapps.cn/api/v1/BiliAnimeUrl?animeid={0}&cid={1}&epid={2}&rnd={3}", model.banId, model.Mid, model.banInfo.episode_id, rnd)));

                        JObject obj = JObject.Parse(re3);
                        if (Convert.ToInt32(obj["code"].ToString()) == 0)
                        {
                            if (obj["mode"].ToString() == "mp4")
                            {
                                urls.Add(obj["data"][0]["url"].ToString());
                                return(new ReturnPlayModel()
                                {
                                    usePlayMode = UsePlayMode.System,
                                    url = obj["data"][0]["url"].ToString(),
                                    urls = urls,
                                    from = "server"
                                });
                            }
                            else
                            {
                                var returnPlayModel = new ReturnPlayModel()
                                {
                                    usePlayMode = UsePlayMode.SYEngine,
                                    from        = "server"
                                };
                                foreach (var item in obj["data"])
                                {
                                    playList.Append(item["url"].ToString(), item["size"].ToInt32(), item["length"].ToInt32() / 1000);
                                    urls.Add(item["url"].ToString());
                                }
                                returnPlayModel.playlist = playList;
                                returnPlayModel.urls     = urls;
                                return(returnPlayModel);
                            }
                        }

                        if (SettingHelper.Get_UseOtherSite())
                        {
                            var playurl = await _5DMHelper.GetUrl(model.banId, Convert.ToInt32(model.No));

                            if (playurl == "")
                            {
                                return(null);
                            }
                            else
                            {
                                urls.Add(playurl);
                                return(new ReturnPlayModel()
                                {
                                    usePlayMode = UsePlayMode.System,
                                    url = playurl,
                                    urls = urls,
                                    from = "other_site"
                                });
                            }
                        }
                        else
                        {
                            return(null);
                        }
                    }
                }
                else
                {
                    var mc = Regex.Matches(re, @"<length>(.*?)</length>.*?<size>(.*?)</size>.*?<url><!\[CDATA\[(.*?)\]\]></url>", RegexOptions.Singleline);

                    foreach (Match item in mc)
                    {
                        playList.Append(item.Groups[3].Value, Convert.ToInt32(item.Groups[2].Value), Convert.ToInt64(item.Groups[1].Value) / 1000);
                    }
                }
                config.HttpReferer = "https://www.bilibili.com/bangumi/play/ep" + model.episode_id;
                //config.HttpReferer = "";
                //config.HttpCookie = "sid=aj08qul1; pgv_pvi=2726422528; fts=1498031012; rpdid=ikxqxlpildoplqwkwlqw; buvid3=0916A88B-F02E-46E2-95B1-BEF35678E1EE37229infoc; LIVE_BUVID=9b2dbd17fe02c6e0b9a5f7cbfe182be2; LIVE_BUVID__ckMd5=54bf74d417f1dfe6; OUTFOX_SEARCH_USER_ID_NCOO=301070296.3442316; uTZ=-480; biliMzIsnew=1; biliMzTs=0; UM_distinctid=16072fe8c3138-01d5f1e1fd27a6-5d4e211f-1fa400-16072fe8c32d6; _ga=GA1.2.701916902.1513903771; im_notify_type_7251681=0; BANGUMI_SS_21728_REC=164986; finger=81df3ec0; 21680=183802; 22843=173309; BANGUMI_SS_22843_REC=173309; BANGUMI_SS_21680_REC=183802; balh_server=https://biliplus.ipcjs.win; purl_token=bilibili_1518001366; balh_season_21680=1; pgv_si=s8821510144; DedeUserID=7251681; DedeUserID__ckMd5=e2742b2aff29c1cf; SESSDATA=83ace795%2C1520595578%2Ca2c615ce; bili_jct=a0f037944a8423a37efb566011d0a84b; _dfcaptcha=42d9ae3eecffafaf47b08effeef54128";
                playList.NetworkConfigs = config;
                //FlvPlyaerUrlModel m = JsonConvert.DeserializeObject<FlvPlyaerUrlModel>(re);
                // var playList = new SYEngine.Playlist(SYEngine.PlaylistTypes.NetworkHttp);



                //foreach (var item in m.durl)
                //{
                //    playList.Append(item.url, item.size, item.length / 1000);
                //}


                // mediaPlay.Source = await playList.SaveAndGetFileUriAsync();
                return(new ReturnPlayModel()
                {
                    playlist = playList,
                    usePlayMode = UsePlayMode.SYEngine,
                    urls = urls,
                    from = "bilibili"
                });
            }
            catch (Exception)
            {
                return(null);
            }
        }
Esempio n. 14
0
        /// <summary>
        /// 读取视频播放地址
        /// </summary>
        /// <param name="model"></param>
        /// <param name="quality"></param>
        /// <returns></returns>
        public static async Task <ReturnPlayModel> GetVideoUrl(string aid, string cid, int qn)
        {
            try
            {
                if (qn < 10)
                {
                    switch (qn)
                    {
                    case 1:
                        qn = 32;
                        break;

                    case 2:
                        qn = 64;
                        break;

                    case 3:
                        qn = 80;
                        break;

                    case 4:
                        qn = 116;
                        break;

                    default:
                        qn = 64;
                        break;
                    }
                }
                List <string> urls = new List <string>();

                //https://interface.bilibili.com/v2/playurl?cid=31452468&appkey=84956560bc028eb7&otype=json&type=&quality=112&qn=112&sign=38b1355368ee65d055c12b57bdb26e3a

                string url = string.Format("https://interface.bilibili.com/v2/playurl?cid={1}&appkey={0}&otype=json&type=&quality={2}&qn={2}&ts={3}", ApiHelper._appKey_VIDEO, cid, qn, ApiHelper.GetTimeSpan_2);
                url += "&sign=" + ApiHelper.GetSign_VIDEO(url);


                string re = await WebClientClass.GetResults(new Uri(url));

                //var mc = Regex.Matches(re, @"<length>(.*?)</length>.*?<size>(.*?)</size>.*?<url><!\[CDATA\[(.*?)\]\]></url>", RegexOptions.Singleline);
                FlvPlyaerUrlModel m = JsonConvert.DeserializeObject <FlvPlyaerUrlModel>(re);
                // FlvPlyaerUrlModel m = JsonConvert.DeserializeObject<FlvPlyaerUrlModel>(re);
                var playList = new SYEngine.Playlist(SYEngine.PlaylistTypes.NetworkHttp);
                if (m.code == 0)
                {
                    foreach (var item in m.durl)
                    {
                        urls.Add(item.url);
                        playList.Append(item.url, item.size, item.length / 1000);
                    }
                }
                else
                {
                    var re3 = await WebClientClass.GetResults(new Uri(string.Format("https://moe.nsapps.cn/api/v1/BiliVideoUrl?cid={0}&qn={1}&rnd={2}", cid, qn, ApiHelper.GetTimeSpan)));

                    JObject obj = JObject.Parse(re3);
                    if (Convert.ToInt32(obj["code"].ToString()) == 0)
                    {
                        if (obj["mode"].ToString() == "mp4")
                        {
                            return(new ReturnPlayModel()
                            {
                                urls = new List <string>()
                                {
                                    obj["data"][0]["url"].ToString()
                                },
                                usePlayMode = UsePlayMode.System,
                                url = obj["data"][0]["url"].ToString(),
                                from = "server"
                            });
                        }
                        else
                        {
                            var returnPlayModel = new ReturnPlayModel()
                            {
                                usePlayMode = UsePlayMode.SYEngine,
                                from        = "server"
                            };
                            foreach (var item in obj["data"])
                            {
                                urls.Add(item["url"].ToString());
                                playList.Append(item["url"].ToString(), item["size"].ToInt32(), item["length"].ToInt32() / 1000);
                            }
                            returnPlayModel.playlist = playList;
                            returnPlayModel.urls     = urls;
                            return(returnPlayModel);
                        }
                    }
                }



                SYEngine.PlaylistNetworkConfigs config = new SYEngine.PlaylistNetworkConfigs();
                config.DownloadRetryOnFail = true;
                config.HttpCookie          = string.Empty;

                config.UniqueId      = string.Empty;
                config.HttpReferer   = "https://www.bilibili.com/video/av" + aid + "/";
                config.HttpUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36";

                playList.NetworkConfigs = config;

                // mediaPlay.Source = await playList.SaveAndGetFileUriAsync();
                return(new ReturnPlayModel()
                {
                    usePlayMode = UsePlayMode.SYEngine,
                    playlist = playList,
                    urls = urls,
                    from = "bilibili"
                });
            }
            catch (Exception)
            {
                return(null);
            }
        }