Inheritance: Livet.NotificationObject
示例#1
0
        public async void JumpTo(string videoUrl) {


            VideoUrl =  videoUrl;

            WatchApi = new NicoNicoWatchApi(videoUrl + "?watch_harmful=1", this);

            IsActive = true;

            Status = "動画情報取得中";
            //動画情報取得
            VideoData.ApiData = await WatchApi.GetWatchApiDataAsync();

            if(VideoData.ApiData == null) {

                LoadFailed = true;
                return;
            }

            Handler.Update();

            CommentInstance = new NicoNicoComment(VideoData.ApiData, this);



            if(VideoData.ApiData.GetFlv.IsPremium && !VideoData.ApiData.GetFlv.VideoUrl.StartsWith("rtmp")) {

                StoryBoardStatus = "取得中";

                var sb = new NicoNicoStoryBoard(VideoData.ApiData.GetFlv.VideoUrl);
                VideoData.StoryBoardData = await sb.GetStoryBoardAsync();

                if(VideoData.StoryBoardData == null) {

                    StoryBoardStatus = "データ無し";
                } else {

                    StoryBoardStatus = "取得完了";
                }
            } else {

                StoryBoardStatus = "データ無し";
            }
        }
示例#2
0
        private void Initialize(string videoUrl)
        {
            IsActive = true;
            Task.Run(() => {

                Mylist = new VideoMylistViewModel(this);
                VideoData = new VideoData();

                Status = "動画情報取得中";
                //動画情報取得
                VideoData.ApiData = NicoNicoWatchApi.GetWatchApiData(videoUrl);

                //ロードに失敗したら
                if(VideoData.ApiData == null) {

                    LoadFailed = true;
                    IsActive = false;
                    Status = "動画の読み込みに失敗しました。";
                    return;
                }

                //有料動画なら
                if(VideoData.ApiData.IsPaidVideo) {

                    App.ViewModelRoot.Messenger.Raise(new TransitionMessage(typeof(PaidVideoDialog), this, TransitionMode.Modal));
                    return;
                }

                DispatcherHelper.UIDispatcher.BeginInvoke(new Action(() => {

                    while(VideoFlash == null) {

                        Thread.Sleep(1);
                    }

                    if(VideoData.ApiData.Cmsid.Contains("nm")) {

                        VideoData.VideoType = NicoNicoVideoType.SWF;
                        WebBrowser.Source = new Uri(GetNMPlayerPath());

                    } else if(VideoData.ApiData.GetFlv.VideoUrl.StartsWith("rtmp")) {

                        VideoData.VideoType = NicoNicoVideoType.RTMP;
                        WebBrowser.Source = new Uri(GetRTMPPlayerPath());
                    } else {

                        if(VideoData.ApiData.MovieType == "flv") {

                            VideoData.VideoType = NicoNicoVideoType.FLV;
                        } else {

                            VideoData.VideoType = NicoNicoVideoType.MP4;

                        }
                        WebBrowser.Source = new Uri(GetPlayerPath());
                    }

                }));
                IsActive = false;

                Time = new VideoTime();

                //動画時間
                Time.VideoTimeString = NicoNicoUtil.ConvertTime(VideoData.ApiData.Length);

                if(VideoData.ApiData.GetFlv.IsPremium && !VideoData.ApiData.GetFlv.VideoUrl.StartsWith("rtmp")) {

                    Task.Run(() => {

                        Status = "ストーリーボード取得中";

                        NicoNicoStoryBoard sb = new NicoNicoStoryBoard(VideoData.ApiData.GetFlv.VideoUrl);
                        VideoData.StoryBoardData = sb.GetStoryBoardData();
                        Status = "ストーリーボード取得完了";
                    });
                }

                NicoNicoComment comment = new NicoNicoComment(VideoData.ApiData.GetFlv, this);

                List<NicoNicoCommentEntry> list = comment.GetComment();

                if(list != null) {

                    foreach(NicoNicoCommentEntry entry in list) {

                        VideoData.CommentData.Add(new CommentEntryViewModel(entry));
                    }

                    dynamic json = new DynamicJson();
                    json.array = list;

                    DispatcherHelper.UIDispatcher.BeginInvoke(new Action(() => InjectComment(json.ToString())));
                }

                if(!Properties.Settings.Default.CommentVisibility) {

                    DispatcherHelper.UIDispatcher.BeginInvoke(new Action(() => InvokeScript("JsToggleComment")));
                } else {

                    CommentVisibility = true;
                }
                //App.ViewModelRoot.StatusBar.Status = "動画取得完了";
            });
        }
示例#3
0
        public async void Initialize(System.Windows.Forms.WebBrowser browser) {

            var videoUrl = VideoUrl + "?watch_harmful=1";

            WatchApi = new NicoNicoWatchApi(videoUrl, this);

            IsActive = true;

            Status = "動画情報取得中";
            //動画情報取得
            VideoData.ApiData = await WatchApi.GetWatchApiDataAsync();
            if(VideoData.ApiData == null) {

                LoadFailed = true;
                return;
            }

            Handler.Initialize(browser, VideoData);

            CommentInstance = new NicoNicoComment(VideoData.ApiData, this);



            if(VideoData.ApiData.GetFlv.IsPremium && !VideoData.ApiData.GetFlv.VideoUrl.StartsWith("rtmp")) {

                StoryBoardStatus = "取得中";

                var sb = new NicoNicoStoryBoard(VideoData.ApiData.GetFlv.VideoUrl);
                VideoData.StoryBoardData = await sb.GetStoryBoardAsync();

                if(VideoData.StoryBoardData == null) {

                    StoryBoardStatus = "データ無し";
                } else {

                    StoryBoardStatus = "取得完了";
                }
            } else {

                StoryBoardStatus = "データ無し";
            }

        }