public override void Execute(object sender, HandledEventArgs e) { var playQueue = buffers[0]; if (playQueue.Count > 0) { playbackManager.AddCurrentTrackToPreviousTracks(); ClearCurrentlyPlayingTrack(); playQueue.RemoveAt(0); if (playQueue.Count > 0) { var nextTrack = playQueue[0] as TrackBufferItem; if (nextTrack == null) { return; } PlayNewTrackBufferItem(nextTrack); if (playQueue.Any()) { playQueue.CurrentItemIndex = 0; } } } }
private void HandleEndOfCurrentTrack() { playbackManager.AddCurrentTrackToPreviousTracks(); playbackManager.PlayingTrack = null; _playQueueBuffer.RemoveAt(0); PlayNextQueuedTrack(); }
private void PlayNewTrackBufferItem(TrackBufferItem item) { var response = Session.LoadPlayer(item.Model.TrackPtr); if (response.IsError && !UserSettings.Instance.SkipUnplayableTracks) { _output.OutputMessage(StringStore.UnableToPlayTrack + response.Message, false); return; } if (response.IsError && UserSettings.Instance.SkipUnplayableTracks) { playbackManager.AddCurrentTrackToPreviousTracks(); playbackManager.PlayingTrack = null; buffers[0].RemoveAt(0); PlayNextQueuedTrack(); return; // don't carry on with this, as it got handled in a recursive call } Session.Play(); playbackManager.PlayingTrack = item.Model; playbackManager.fullyDownloaded = false; playbackManager.Play(); }