protected virtual async void OnEnding(object sender, AsyncEventArgs e) { using (e.Defer()) { await this.PreemptItems().ConfigureAwait(false); } }
protected virtual async void OnIsStartedChanged(object sender, AsyncEventArgs e) { using (e.Defer()) { await this.Unload().ConfigureAwait(false); } }
protected virtual async void OnEnded(object sender, AsyncEventArgs e) { Logger.Write(this, LogLevel.Debug, "Stream was stopped likely due to reaching the end, playing next item."); using (e.Defer()) { await this.PlaylistManager.Next().ConfigureAwait(false); } }
protected virtual async void OnCurrentStreamChanged(object sender, AsyncEventArgs e) { Logger.Write(this, LogLevel.Debug, "Playback manager output stream changed, updating current playlist item."); if (this.PlaybackManager.CurrentStream == null) { using (e.Defer()) { await this.SetCurrentItem(null).ConfigureAwait(false); } Logger.Write(this, LogLevel.Debug, "Playback manager output stream is empty. Cleared current playlist item."); } else if (this.PlaybackManager.CurrentStream.PlaylistItem != this.CurrentItem) { using (e.Defer()) { await this.SetCurrentItem(this.PlaybackManager.CurrentStream.PlaylistItem).ConfigureAwait(false); } Logger.Write(this, LogLevel.Debug, "Updated current playlist item: {0} => {1}", this.CurrentItem.Id, this.CurrentItem.FileName); } }