Esempio n. 1
0
        public async Task UpdateLiveStatus()
        {
            LiveInfo = await NicoLiveProvider.GetLiveInfoAsync(LiveId);

            LiveStatus = LiveInfo?.VideoInfo.Video.CurrentStatus ?? StatusType.Invalid;

            if (LiveInfo == null)
            {
                throw new Exception("Invalid LiveId. (can not get Detail infomation from niconico)");
            }

            await RefreshTimeshiftProgram();

            if (LiveStatus != StatusType.OnAir || LiveStatus != StatusType.ComingSoon)
            {
                await ExitLiveViewing();
            }

            if (LiveInfo?.IsOK ?? false)
            {
                // Official だと info.Communityはnullになる
                var info = LiveInfo.VideoInfo;
                _CommunityId = info.Community?.GlobalId;

                LiveTitle     = info.Video.Title;
                BroadcasterId = info.Video.UserId.ToString();
                //BroadcasterName = info.Video.;
                BroadcasterCommunityType     = info.Video.ProviderType;
                BroadcasterCommunityImageUri = info.Community != null ? new Uri(info.Community.Thumbnail) : null;
                BroadcasterCommunityId       = info.Community?.GlobalId;
            }
        }
Esempio n. 2
0
        private async Task <InAppNotificationPayload> SubmitLiveContentSuggestion(LiveId liveId)
        {
            var liveDesc = await NicoLiveProvider.GetLiveInfoAsync(liveId);

            if (liveDesc == null)
            {
                return(null);
            }

            var liveTitle = liveDesc.Data.Title;

            var payload = new InAppNotificationPayload()
            {
                Content             = "InAppNotification_ContentDetectedFromClipboard".Translate(liveTitle),
                ShowDuration        = DefaultNotificationShowDuration,
                IsShowDismissButton = true,
                Commands            =
                {
                    new InAppNotificationCommand()
                    {
                        Label   = "WatchLiveStreaming".Translate(),
                        Command = new RelayCommand(() =>
                        {
                            _messenger.Send(new PlayerPlayLiveRequestMessage(new() { LiveId = liveId }));

                            NotificationService.DismissInAppNotification();
                        })
                    },
Esempio n. 3
0
        private async Task <InAppNotificationPayload> SubmitLiveContentSuggestion(string liveId)
        {
            var liveDesc = await NicoLiveProvider.GetLiveInfoAsync(liveId);

            if (liveDesc == null)
            {
                return(null);
            }

            var liveTitle = liveDesc.VideoInfo.Video.Title;

            var payload = new InAppNotificationPayload()
            {
                Content             = $"{liveTitle} をお探しですか?",
                ShowDuration        = DefaultNotificationShowDuration,
                SymbolIcon          = Symbol.Video,
                IsShowDismissButton = true,
                Commands            =
                {
                    new InAppNotificationCommand()
                    {
                        Label   = "視聴する",
                        Command = new DelegateCommand(() =>
                        {
                            Playlist.PlayLiveVideo(liveId, liveTitle);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                    new InAppNotificationCommand()
                    {
                        Label   = "放送情報を確認",
                        Command = new DelegateCommand(() =>
                        {
                            PageManager.OpenPageWithId(HohoemaPageType.LiveInfomation, liveId);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                }
            };

            if (liveDesc.VideoInfo.Community != null)
            {
                payload.Commands.Add(new InAppNotificationCommand()
                {
                    Label   = "コミュニティを開く",
                    Command = new DelegateCommand(() =>
                    {
                        PageManager.OpenPageWithId(HohoemaPageType.Community, liveDesc.VideoInfo.Community.GlobalId);

                        NotificationService.DismissInAppNotification();
                    })
                });
            }

            return(payload);
        }
Esempio n. 4
0
        private async Task <InAppNotificationPayload> SubmitLiveContentSuggestion(string liveId)
        {
            var liveDesc = await NicoLiveProvider.GetLiveInfoAsync(liveId);

            if (liveDesc == null)
            {
                return(null);
            }

            var liveTitle = liveDesc.VideoInfo.Video.Title;

            var payload = new InAppNotificationPayload()
            {
                Content             = "InAppNotification_ContentDetectedFromClipboard".Translate(liveTitle),
                ShowDuration        = DefaultNotificationShowDuration,
                SymbolIcon          = Symbol.Video,
                IsShowDismissButton = true,
                Commands            =
                {
                    new InAppNotificationCommand()
                    {
                        Label   = "WatchLiveStreaming".Translate(),
                        Command = new DelegateCommand(() =>
                        {
                            _eventAggregator.GetEvent <Services.Player.PlayerPlayLiveRequest>()
                            .Publish(new Services.Player.PlayerPlayLiveRequestEventArgs()
                            {
                                LiveId = liveId
                            });

                            NotificationService.DismissInAppNotification();
                        })
                    },
                    new InAppNotificationCommand()
                    {
                        Label   = HohoemaPageType.LiveInfomation.Translate(),
                        Command = new DelegateCommand(() =>
                        {
                            PageManager.OpenPageWithId(HohoemaPageType.LiveInfomation, liveId);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                }
            };

            if (liveDesc.VideoInfo.Community != null)
            {
                payload.Commands.Add(new InAppNotificationCommand()
                {
                    Label   = HohoemaPageType.Community.Translate(),
                    Command = new DelegateCommand(() =>
                    {
                        PageManager.OpenPageWithId(HohoemaPageType.Community, liveDesc.VideoInfo.Community.GlobalId);

                        NotificationService.DismissInAppNotification();
                    })
                });
            }

            return(payload);
        }