SetPreviousAsCurrent() public method

public SetPreviousAsCurrent ( ) : void
return void
 public async Task PlayPrevious()
 {
     try
     {
         if (!MediaQueue.HasPrevious() || (Position > TimeSpan.FromSeconds(3)))
         {
             await CurrentPlaybackManager.Seek(TimeSpan.Zero);
         }
         else
         {
             // await CurrentPlaybackManager.Pause();
             MediaQueue.SetPreviousAsCurrent();
             var beforePlayTask = _onBeforePlay?.Invoke(_currentMediaFile);
             if (beforePlayTask != null)
             {
                 await beforePlayTask;
             }
             await
             Task.WhenAll(
                 CurrentPlaybackManager.Play(_currentMediaFile),
                 GetMediaInformation(new[] { _currentMediaFile }));
         }
     }
     catch (Exception ex)
     {
         OnMediaFileFailed(CurrentPlaybackManager, new MediaFileFailedEventArgs(ex, _currentMediaFile));
         throw;
     }
 }
Esempio n. 2
0
        public async Task PlayPrevious()
        {
            await RaiseMediaFileFailedEventOnException(async() =>
            {
                MediaQueue.SetPreviousAsCurrent();

                await PlayCurrent();
            });
        }
        public async Task PlayPrevious()
        {
            // Start current track from beginning if it's the first track or the track has played more than 3sec and you hit "playPrevious".
            if (!MediaQueue.HasPrevious() || (Position > TimeSpan.FromSeconds(3)))
            {
                await CurrentPlaybackManager.Seek(TimeSpan.Zero);
            }
            else
            {
                //TODO: Maybe pause here instead of stop
                await CurrentPlaybackManager.Stop();

                MediaQueue.SetPreviousAsCurrent();
                await Task.WhenAll(
                    CurrentPlaybackManager.Play(_currentMediaFile),
                    GetMediaInformation(new[] { _currentMediaFile }));
            }
        }