public HohoemaNotificationService(
            PageManager pageManager,
            QueuePlaylist queuePlaylist,
            HohoemaPlaylistPlayer hohoemaPlaylistPlayer,
            NiconicoSession niconicoSession,
            NotificationService notificationService,
            NicoVideoProvider nicoVideoProvider,
            MylistProvider mylistProvider,
            NicoLiveProvider nicoLiveProvider,
            CommunityProvider communityProvider,
            UserProvider userProvider,
            IMessenger messenger
            )
        {
            PageManager         = pageManager;
            _queuePlaylist      = queuePlaylist;
            _niconicoSession    = niconicoSession;
            NotificationService = notificationService;
            NicoVideoProvider   = nicoVideoProvider;
            MylistProvider      = mylistProvider;
            NicoLiveProvider    = nicoLiveProvider;
            CommunityProvider   = communityProvider;
            UserProvider        = userProvider;

            _messenger = messenger;
        }
Beispiel #2
0
        public VideoEndedRecommendation(
            MediaPlayer mediaPlayer,
            IMessenger messenger,
            IScheduler scheduler,
            QueuePlaylist queuePlaylist,
            RelatedVideoContentsAggregator relatedVideoContentsAggregator,
            PrimaryViewPlayerManager primaryViewPlayerManager,
            PlayerSettings playerSettings,
            AppearanceSettings appearanceSettings,
            HohoemaPlaylistPlayer hohoemaPlaylistPlayer,
            VideoPlayedHistoryRepository videoPlayedHistoryRepository
            )
        {
            _mediaPlayer   = mediaPlayer;
            _messenger     = messenger;
            _scheduler     = scheduler;
            _queuePlaylist = queuePlaylist;
            _relatedVideoContentsAggregator = relatedVideoContentsAggregator;
            _primaryViewPlayerManager       = primaryViewPlayerManager;
            _playerSettings               = playerSettings;
            _appearanceSettings           = appearanceSettings;
            _hohoemaPlaylistPlayer        = hohoemaPlaylistPlayer;
            _videoPlayedHistoryRepository = videoPlayedHistoryRepository;
            IsEnded     = new ReactiveProperty <bool>(_scheduler);
            HasRecomend = new ReactiveProperty <bool>(_scheduler);

            _messenger.RegisterAll(this);
        }
Beispiel #3
0
 public VideoTogglePlayPauseCommand(
     HohoemaPlaylistPlayer playlistPlayer,
     MediaPlayer mediaPlayer,
     RestoreNavigationManager restoreNavigationManager)
 {
     _playlistPlayer           = playlistPlayer;
     _mediaPlayer              = mediaPlayer;
     _restoreNavigationManager = restoreNavigationManager;
 }
Beispiel #4
0
        public AppWindowSecondaryViewPlayerManager(
            AppearanceSettings appearanceSettings,
            HohoemaPlaylistPlayer playlistPlayer,
            Presentation.Services.CurrentActiveWindowUIContextService currentActiveWindowUIContextService
            )
        {
            _appearanceSettings = appearanceSettings;
            _playlistPlayer     = playlistPlayer;
            _currentActiveWindowUIContextService = currentActiveWindowUIContextService;
            _PlayerPageNavgationTransitionInfo   = new DrillInNavigationTransitionInfo();
            _BlankPageNavgationTransitionInfo    = new SuppressNavigationTransitionInfo();

            _dispatcherQueue = DispatcherQueue.GetForCurrentThread();

            ApplicationView.GetForCurrentView().Consolidated += AppWindowSecondaryViewPlayerManager_Consolidated;;
        }
Beispiel #5
0
        public PrimaryViewPlayerManager(
            ILoggerFactory loggerFactory,
            IScheduler scheduler,
            RestoreNavigationManager restoreNavigationManager,
            HohoemaPlaylistPlayer hohoemaPlaylistPlayer
            )
        {
            _view      = ApplicationView.GetForCurrentView();
            _logger    = loggerFactory.CreateLogger <PrimaryViewPlayerManager>();
            _scheduler = scheduler;
            //_navigationServiceLazy = navigationServiceLazy;
            _restoreNavigationManager = restoreNavigationManager;
            PlaylistPlayer            = hohoemaPlaylistPlayer;
            _navigationService        = null;

            this.ObserveProperty(x => x.DisplayMode, isPushCurrentValueAtFirst: false)
            .Subscribe(x =>
            {
                SetDisplayMode(_prevDisplayMode, x);
                _prevDisplayMode = x;
                IsFullScreen     = x == PrimaryPlayerDisplayMode.FullScreen;
                IsCompactOverlay = x == PrimaryPlayerDisplayMode.CompactOverlay;
            });
        }
 public ChangeVideoQualityCommand(HohoemaPlaylistPlayer playlistPlayer)
 {
     _playlistPlayer = playlistPlayer;
 }
        public VideoPlayerPageViewModel(
            ILoggerFactory loggerFactory,
            IScheduler scheduler,
            IPlayerView playerView,
            NiconicoSession niconicoSession,
            SubscriptionManager subscriptionManager,
            NicoVideoProvider nicoVideoProvider,
            ChannelProvider channelProvider,
            MylistProvider mylistProvider,
            AppearanceSettings appearanceSettings,
            PlayerSettings playerSettings,
            VideoCacheSettings_Legacy cacheSettings,
            ApplicationLayoutManager applicationLayoutManager,
            LocalMylistManager localMylistManager,
            LoginUserOwnedMylistManager userMylistManager,
            PageManager pageManager,
            QueuePlaylist queuePlaylist,
            HohoemaPlaylistPlayer hohoemaPlaylistPlayer,
            MediaPlayer mediaPlayer,
            VideoTogglePlayPauseCommand videoTogglePlayPauseCommand,
            NotificationService notificationService,
            DialogService dialogService,
            AddSubscriptionCommand addSubscriptionCommand,
            LocalPlaylistCreateCommand createLocalMylistCommand,
            MylistAddItemCommand addMylistCommand,
            LocalPlaylistAddItemCommand localPlaylistAddItemCommand,
            MylistCreateCommand createMylistCommand,
            VideoStreamingOriginOrchestrator videoStreamingOriginOrchestrator,
            VideoCommentPlayer commentPlayer,
            CommentCommandEditerViewModel commentCommandEditerViewModel,
            KeepActiveDisplayWhenPlaying keepActiveDisplayWhenPlaying,
            ObservableMediaPlayer observableMediaPlayer,
            VideoEndedRecommendation videoEndedRecommendation,
            PrimaryViewPlayerManager primaryViewPlayerManager,
            TogglePlayerDisplayViewCommand togglePlayerDisplayViewCommand,
            ShowPrimaryViewCommand showPrimaryViewCommand,
            MediaPlayerSoundVolumeManager soundVolumeManager,
            OpenLinkCommand openLinkCommand,
            CopyToClipboardCommand copyToClipboardCommand,
            ChangeVideoQualityCommand changeVideoQualityCommand,
            CopyToClipboardWithShareTextCommand copyToClipboardWithShareTextCommand,
            OpenShareUICommand openShareUICommand,
            PlaylistSidePaneContentViewModel playlistSidePaneContentViewModel,
            SettingsSidePaneContentViewModel settingsSidePaneContentViewModel,
            VideoCommentSidePaneContentViewModel videoCommentSidePaneContent,
            RelatedVideosSidePaneContentViewModel relatedVideosSidePaneContentViewModel
            )
        {
            _logger = loggerFactory.CreateLogger <VideoPlayerPageViewModel>();
            CurrentPlayerDisplayView = appearanceSettings
                                       .ObserveProperty(x => x.PlayerDisplayView)
                                       .ToReadOnlyReactivePropertySlim()
                                       .AddTo(_CompositeDisposable);

            _scheduler                             = scheduler;
            PlayerView                             = playerView;
            NiconicoSession                        = niconicoSession;
            SubscriptionManager                    = subscriptionManager;
            NicoVideoProvider                      = nicoVideoProvider;
            ChannelProvider                        = channelProvider;
            MylistProvider                         = mylistProvider;
            PlayerSettings                         = playerSettings;
            CacheSettings                          = cacheSettings;
            ApplicationLayoutManager               = applicationLayoutManager;
            LocalMylistManager                     = localMylistManager;
            UserMylistManager                      = userMylistManager;
            PageManager                            = pageManager;
            _queuePlaylist                         = queuePlaylist;
            _hohoemaPlaylistPlayer                 = hohoemaPlaylistPlayer;
            _NotificationService                   = notificationService;
            _HohoemaDialogService                  = dialogService;
            AddSubscriptionCommand                 = addSubscriptionCommand;
            CreateLocalMylistCommand               = createLocalMylistCommand;
            AddMylistCommand                       = addMylistCommand;
            LocalPlaylistAddItemCommand            = localPlaylistAddItemCommand;
            CreateMylistCommand                    = createMylistCommand;
            _videoStreamingOriginOrchestrator      = videoStreamingOriginOrchestrator;
            CommentPlayer                          = commentPlayer;
            CommentCommandEditerViewModel          = commentCommandEditerViewModel;
            PrimaryViewPlayerManager               = primaryViewPlayerManager;
            TogglePlayerDisplayViewCommand         = togglePlayerDisplayViewCommand;
            ShowPrimaryViewCommand                 = showPrimaryViewCommand;
            SoundVolumeManager                     = soundVolumeManager;
            OpenLinkCommand                        = openLinkCommand;
            CopyToClipboardCommand                 = copyToClipboardCommand;
            ChangeVideoQualityCommand              = changeVideoQualityCommand;
            CopyToClipboardWithShareTextCommand    = copyToClipboardWithShareTextCommand;
            OpenShareUICommand                     = openShareUICommand;
            _playlistSidePaneContentViewModel      = playlistSidePaneContentViewModel;
            _settingsSidePaneContentViewModel      = settingsSidePaneContentViewModel;
            _videoCommentSidePaneContentViewModel  = videoCommentSidePaneContent;
            _relatedVideosSidePaneContentViewModel = relatedVideosSidePaneContentViewModel;
            ObservableMediaPlayer                  = observableMediaPlayer
                                                     .AddTo(_CompositeDisposable);
            VideoEndedRecommendation = videoEndedRecommendation
                                       .AddTo(_CompositeDisposable);
            _keepActiveDisplayWhenPlaying = keepActiveDisplayWhenPlaying
                                            .AddTo(_CompositeDisposable);
            MediaPlayer = mediaPlayer;
            VideoTogglePlayPauseCommand = videoTogglePlayPauseCommand;
            SeekCommand            = new MediaPlayerSeekCommand(MediaPlayer);
            SetPlaybackRateCommand = new MediaPlayerSetPlaybackRateCommand(MediaPlayer);
            ToggleMuteCommand      = new MediaPlayerToggleMuteCommand(MediaPlayer);
            VolumeUpCommand        = new MediaPlayerVolumeUpCommand(SoundVolumeManager);
            VolumeDownCommand      = new MediaPlayerVolumeDownCommand(SoundVolumeManager);

            PlayNextCommand = _hohoemaPlaylistPlayer.GetCanGoNextOrPreviewObservable()
                              .SelectMany(async x => await _hohoemaPlaylistPlayer.CanGoNextAsync())
                              .ToAsyncReactiveCommand()
                              .AddTo(_CompositeDisposable);

            PlayNextCommand.Subscribe(async() => await _hohoemaPlaylistPlayer.GoNextAsync(NavigationCancellationToken))
            .AddTo(_CompositeDisposable);

            PlayPreviousCommand = _hohoemaPlaylistPlayer.GetCanGoNextOrPreviewObservable()
                                  .SelectMany(async x => await _hohoemaPlaylistPlayer.CanGoPreviewAsync())
                                  .ToAsyncReactiveCommand()
                                  .AddTo(_CompositeDisposable);

            PlayPreviousCommand.Subscribe(async() => await _hohoemaPlaylistPlayer.GoPreviewAsync(NavigationCancellationToken))
            .AddTo(_CompositeDisposable);

            IsLoopingEnabled = PlayerSettings.ToReactivePropertyAsSynchronized(x => x.IsCurrentVideoLoopingEnabled, raiseEventScheduler: scheduler)
                               .AddTo(_CompositeDisposable);
            IsLoopingEnabled.Subscribe(x => mediaPlayer.IsLoopingEnabled = x)
            .AddTo(_CompositeDisposable);

            IsPlaylistShuffleRequeted = PlayerSettings.ToReactivePropertyAsSynchronized(x => x.IsShuffleEnable, _scheduler)
                                        .AddTo(_CompositeDisposable);

            IsAvailablePlaylistRepeatOrShuffle = _hohoemaPlaylistPlayer.ObserveProperty(x => x.IsShuffleAndRepeatAvailable)
                                                 .ToReadOnlyReactiveProperty();
        }
        public PlaylistSidePaneContentViewModel(
            MediaPlayer mediaPlayer,
            HohoemaPlaylistPlayer hohoemaPlaylistPlayer,
            PlayerSettings playerSettings,
            PageManager pageManager,
            NicoVideoProvider nicoVideoProvider,
            IScheduler scheduler,
            IMessenger messenger
            )
        {
            MediaPlayer            = mediaPlayer;
            _hohoemaPlaylistPlayer = hohoemaPlaylistPlayer;
            _playerSettings        = playerSettings;
            PageManager            = pageManager;
            _nicoVideoProvider     = nicoVideoProvider;
            _scheduler             = scheduler;
            _messenger             = messenger;
            CurrentPlaylist        = _hohoemaPlaylistPlayer.ObserveProperty(x => x.CurrentPlaylist)
                                     .ToReadOnlyReactiveProperty(eventScheduler: _scheduler)
                                     .AddTo(_CompositeDisposable);
            CurrentPlaylistItem = _hohoemaPlaylistPlayer.ObserveProperty(x => x.CurrentPlaylistItem)
                                  .ToReadOnlyReactiveProperty(eventScheduler: _scheduler)
                                  .AddTo(_CompositeDisposable);
            IsShuffleEnabled = _playerSettings.ToReactivePropertyAsSynchronized(x => x.IsShuffleEnable, _scheduler)
                               .AddTo(_CompositeDisposable);

            IsShuffleAvailable = _hohoemaPlaylistPlayer.ObserveProperty(x => x.IsShuffleAndRepeatAvailable)
                                 .ToReadOnlyReactiveProperty(eventScheduler: _scheduler)
                                 .AddTo(_CompositeDisposable);

            IsListRepeatModeEnable = _playerSettings.ToReactivePropertyAsSynchronized(x => x.IsPlaylistLoopingEnabled)
                                     .AddTo(_CompositeDisposable);

            PlaylistCanGoBack = _hohoemaPlaylistPlayer.GetCanGoNextOrPreviewObservable()
                                .SelectMany(async _ => await _hohoemaPlaylistPlayer.CanGoPreviewAsync())
                                .ToReactiveProperty(_scheduler)
                                .AddTo(_CompositeDisposable);
            PlaylistCanGoNext = _hohoemaPlaylistPlayer.GetCanGoNextOrPreviewObservable()
                                .SelectMany(async _ => await _hohoemaPlaylistPlayer.CanGoNextAsync())
                                .ToReactiveProperty(_scheduler)
                                .AddTo(_CompositeDisposable);

            _hohoemaPlaylistPlayer.GetBufferedItems()
            .Subscribe(items =>
            {
                _scheduler.Schedule(async() =>
                {
                    if (CurrentItems is IDisposable disposeItems)
                    {
                        disposeItems.Dispose();
                    }

                    if (items == null)
                    {
                        CurrentItems = null;
                    }
                    else if (items is BufferedPlaylistItemsSource bufferedPlaylistItemsSource)
                    {
                        //                            var items = new HohoemaListingPageViewModelBase<IVideoContent>.HohoemaIncrementalLoadingCollection(bufferedPlaylistItemsSource);
                        var items = new IncrementalLoadingCollection <BufferedPlaylistItemsSource, IVideoContent>(bufferedPlaylistItemsSource, bufferedPlaylistItemsSource.OneTimeLoadingItemsCount);
                        //await items.LoadMoreItemsAsync((uint)BufferedPlaylistItemsSource.OneTimeLoadingItemsCount);
                        CurrentItems = items;
                    }
                    else if (items is BufferedShufflePlaylistItemsSource bufferedShufflePlaylistItemsSource)
                    {
                        CurrentItems = bufferedShufflePlaylistItemsSource.CreateItemsReadOnlyReactiveCollection(_scheduler);
                    }
                });
            })
            .AddTo(_CompositeDisposable);
        }