Пример #1
0
        private async void GetVideoSourceData()
        {
            if (_videoSourceData == null)
            {
                _videoSourceData = new VideoSourceData();
            }

            if (_selecVideo == null || _selecVideo.VideoId == null)
            {
                return;
            }

            GetDanmuData();
            var url = AcFunAPI.GetVideoSrcUrl(_selecVideo.VideoId);
            await _videoSourceData.GetData(url);

            _DicOfvideoSource = _videoSourceData.ListofVideoSourceData;
            if (_DicOfvideoSource == null || _DicOfvideoSource.Count == 0)
            {
                //todo error
                MSGSHOW("视频地址解析失败\r\nSRC:" + _selecVideo.SourceType + "--" + _selecVideo.SourceId + "\r\nACID:" + _selecVideo.VideoId);
            }
            AddDescription(_DicOfvideoSource);
            Player.Play();
        }
Пример #2
0
        private async void GetUrl(VideoDetail content)
        {
            var vsd = new VideoSourceData();
            var url = AcFunAPI.GetVideoSrcUrl(content.VideoId);
            await vsd.GetData(url);

            if (vsd.ListofVideoSourceData == null || vsd.ListofVideoSourceData.Count == 0)
            {
                MSGSHOW("下载失败:\r\n  获取视频地址失败!");
            }

            if (vsd.ListofVideoSourceData.Count > 1)
            {
                bool hasSuper = false;

                foreach (var key in vsd.ListofVideoSourceData.Keys)
                {
                    if (key == "超清")
                    {
                        hasSuper = true;
                    }
                }
                if (hasSuper)
                {
                    DoBackgroundDownload(content, vsd.ListofVideoSourceData["超清"]);
                }
                else
                {
                    DoBackgroundDownload(content, vsd.ListofVideoSourceData["高清"]);
                }

                // MSGSHOW(vsd.ListofVideoSourceData);
            }
            else
            {
                foreach (var dic in vsd.ListofVideoSourceData)
                {
                    DoBackgroundDownload(content,
                                         dic.Value);
                    break;
                }
            }
        }