private async Task PlayNextVideoAsync() {
if (nextVideo == null)
return;
// Enable/Disable SVP if necessary.
MpcConfigBusiness.AutoConfigure(nextVideo);
// If next video is still downloading, advance QueuePos. If QueuePos = 0 when download finishes, it will auto-play.
DownloadItem VideoDownload = GetNextVideoDownloading();
if (VideoDownload != null) {
if (VideoDownload.QueuePos > 0)
VideoDownload.QueuePos--;
return;
}
// Auto-pitch to 432hz
bool EnableAutoPitch = AutoPitchBusiness.AppyAutoPitch(nextVideo);
await player.PlayVideoAsync(nextVideo, EnableAutoPitch).ConfigureAwait(false);
playedVideos.Add(nextVideo.MediaId);
nextVideo = null;
if (PlayMode == PlayerMode.SpecialRequest)
PlayMode = PlayerMode.Normal;
if (playMode != PlayerMode.Manual)
await SelectNextVideoAsync(1, false).ConfigureAwait(false);
if (PlayMode == PlayerMode.Fire)
PlayMode = PlayerMode.SpecialRequest;
Application.Current.Dispatcher.Invoke(() => PlaylistChanged?.Invoke(this, new EventArgs()));
}