/// <summary> /// Plays a single video while allowing to close the player, such as from the Edit Video window. /// </summary> /// <param name="fileName">The name of the file to play.</param> public async Task PlaySingleVideoAsync(string fileName) { Media video = GetMediaObject(fileName); if (!player.IsAvailable || video == null) { return; } if (nextVideo != null) { CancelNextDownload(nextVideo); NextVideoOptions.Clear(); nextVideo = video; } // Enable/Disable SVP if necessary. MpcConfigBusiness.AutoConfigure(video); // Auto-pitch to 432hz bool EnableAutoPitch = AutoPitchBusiness.AppyAutoPitch(video); await player.PlayVideoAsync(video, EnableAutoPitch).ConfigureAwait(false); Application.Current.Dispatcher.Invoke(() => PlaylistChanged?.Invoke(this, new EventArgs())); }
private async Task SetNextVideoAsync(PlayerMode mode, Media video) { if (nextVideo != null) { CancelNextDownload(nextVideo); } if (NextVideoOptions.Any()) { NextVideoOptions[0] = video; } nextVideo = video; this.PlayMode = mode; await PrepareNextVideoAsync(1, 0).ConfigureAwait(false); Application.Current.Dispatcher.Invoke(() => PlaylistChanged?.Invoke(this, new EventArgs())); }