Exemplo n.º 1
0
        void ResumePlayer <T>()
        {
            IPlayerContext context = GetPlayerContext <T>();

            if (context != null)
            {
                context.Play();
            }
        }
        public void Play()
        {
            IPlayerContext playerContext = CurrentPlayerContext;

            if (playerContext == null)
            {
                return;
            }
            playerContext.Play();
        }
Exemplo n.º 3
0
        protected static void CompletePlayOrEnqueue(IPlayerContext pc, bool play)
        {
            IPlayerContextManager pcm      = ServiceRegistration.Get <IPlayerContextManager>();
            MediaModelSettings    settings = ServiceRegistration.Get <ISettingsManager>().Load <MediaModelSettings>();

            pc.CloseWhenFinished = settings.ClosePlayerWhenFinished; // Has to be done before starting the media item, else the slot will not close in case of an error / when the media item cannot be played
            if (play)
            {
                pc.Play();
                if (pc.AVType == AVType.Video)
                {
                    pcm.ShowFullscreenContent(true);
                }
            }
        }
Exemplo n.º 4
0
        protected static Task CompletePlayOrEnqueue(IPlayerContext pc, bool play, IResumeState resumeState = null)
        {
            IPlayerContextManager pcm      = ServiceRegistration.Get <IPlayerContextManager>();
            MediaModelSettings    settings = ServiceRegistration.Get <ISettingsManager>().Load <MediaModelSettings>();

            pc.CloseWhenFinished = settings.ClosePlayerWhenFinished; // Has to be done before starting the media item, else the slot will not close in case of an error / when the media item cannot be played
            if (play)
            {
                if (resumeState != null)
                {
                    pc.SetContextVariable(PlayerContext.KEY_RESUME_STATE, resumeState);
                }
                pc.Play();
                if (pc.AVType == AVType.Video || pc.AVType == AVType.Audio)
                {
                    pcm.ShowFullscreenContent(true);
                }
            }
            return(Task.CompletedTask);
        }
        public void StartPartyMode()
        {
            ServiceRegistration.Get <ILogger>().Info("PartyMusicPlayerModel: Starting party mode");
            SaveSettings();
            if (!LoadPlaylist())
            {
                return;
            }

            LoadPlayRepeatMode();

            IPlayerContextManager pcm = ServiceRegistration.Get <IPlayerContextManager>();
            IPlayerContext        audioPlayerContext = pcm.OpenAudioPlayerContext(Consts.MODULE_ID_PARTY_MUSIC_PLAYER, Consts.RES_PLAYER_CONTEXT_NAME, false,
                                                                                  Consts.WF_STATE_ID_PARTY_MUSIC_PLAYER, Consts.WF_STATE_ID_PARTY_MUSIC_PLAYER);
            IPlaylist playlist = audioPlayerContext.Playlist;

            playlist.StartBatchUpdate();
            try
            {
                playlist.Clear();
                foreach (MediaItem mediaItem in _mediaItems)
                {
                    playlist.Add(mediaItem);
                }
                playlist.PlayMode   = PlayMode;
                playlist.RepeatMode = RepeatMode;
                _playerContext      = audioPlayerContext;
            }
            finally
            {
                playlist.EndBatchUpdate();
            }

            audioPlayerContext.Play();

            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePushAsync(Consts.WF_STATE_ID_PARTY_MUSIC_PLAYER);
        }
Exemplo n.º 6
0
 protected static void CompletePlayOrEnqueue(IPlayerContext pc, bool play, IResumeState resumeState = null)
 {
   IPlayerContextManager pcm = ServiceRegistration.Get<IPlayerContextManager>();
   MediaModelSettings settings = ServiceRegistration.Get<ISettingsManager>().Load<MediaModelSettings>();
   pc.CloseWhenFinished = settings.ClosePlayerWhenFinished; // Has to be done before starting the media item, else the slot will not close in case of an error / when the media item cannot be played
   if (play)
   {
     if (resumeState != null)
       pc.SetContextVariable(PlayerContext.KEY_RESUME_STATE, resumeState);
     pc.Play();
     if (pc.AVType == AVType.Video)
       pcm.ShowFullscreenContent(true);
   }
 }