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; } }
public async Task Seek(TimeSpan position) { if (CurrentPlaybackManager == null) { return; } await CurrentPlaybackManager.Seek(position); MediaNotificationManager?.UpdateNotifications(CurrentMediaFile, Status); }
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 })); } }
public async Task Seek(TimeSpan position) { await CurrentPlaybackManager.Seek(position); }