Closed skst closed 2 years ago
The MediaPlayer class has breaking changes from .NET 5 (Windows.Media.Core.MediaPlayer) to .NET 6 (System.Windows.Media).
MediaPlayer
Windows.Media.Core.MediaPlayer
System.Windows.Media
The class no longer implements these (and probably other) properties or methods.
MediaPlayer _player = new(); _player.AudioCategory = MediaPlayerAudioCategory.Alerts; _player.AutoPlay = false; _player.IsLoopingEnabled = false; _player.Source = MediaSource.CreateFromUri(new Uri(PathSound)); _player.IsLoopingEnabled = repeatSound; _player.CommandManager.IsEnabled = false; // disable Windows media controls popup _player.Dispose();
When the class is used to open a WAV or MP3 file and play it, the MediaFailed event is called with the "Windows Media Player version 10 or later is required." error message.
MediaFailed
MediaPlayer _player = new(); _player.Open(new Uri(@"D:\OneDrive\Music\Pop\Rihanna\Loud (Explicit Version) [Explicit]\01-01- S&M.mp3")); _player.Play();
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Windows.Media.Playback.MediaPlayer is the replacement, not System.Windows.Media.MediaPlayer.
Windows.Media.Playback.MediaPlayer
System.Windows.Media.MediaPlayer
The
MediaPlayer
class has breaking changes from .NET 5 (Windows.Media.Core.MediaPlayer
) to .NET 6 (System.Windows.Media
).The class no longer implements these (and probably other) properties or methods.
When the class is used to open a WAV or MP3 file and play it, the
MediaFailed
event is called with the "Windows Media Player version 10 or later is required." error message.Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.