Support for `MediaPlayerElement`/`MediaPlayer`
Author: sonnemafCreated Feb 12, 2020Updated Sep 18, 2026
Labelsplatform/wasm 🌐platform/android 🤖platform/ios 🍎project/media 📺no-repro
What would you like to be added:
Windows.UI.Xaml.Controls.MediaPlayerElement and/or Windows.Media.Playback.MediaPlayer
Why is this needed:
I'm currently converting an UWP game (Minesweeper 10) to Uno. This game should play sounds. I would love to play them using an MediaPlayerElement or MediaPlayer.
I use the following SoundHelper to play my sounds. It works currently in UWP only.
Related issues
Support issues
- Captions support unoplatform/uno#4636
- DRM support unoplatform/uno#4637
- Playback speed other controls unoplatform/uno#4638
- Real-time playback unoplatform/uno#4445
- [WASM] Add support for MediaPlayerElement https://github.com/unoplatform/uno/issues/11967
- Skia support https://github.com/unoplatform/uno/issues/12240
Other issues
All targets
- https://github.com/unoplatform/uno/issues/12510
- https://github.com/unoplatform/uno/issues/12331
- https://github.com/unoplatform/uno/issues/12332
- https://github.com/unoplatform/uno/issues/12336
- https://github.com/unoplatform/uno/issues/12337
- https://github.com/unoplatform/uno/issues/12333
- https://github.com/unoplatform/uno/issues/12335
- https://github.com/unoplatform/uno/issues/12338
- https://github.com/unoplatform/uno/issues/12341
- https://github.com/unoplatform/uno/issues/12344
- https://github.com/unoplatform/uno/issues/12352
- https://github.com/unoplatform/uno/issues/12574
- https://github.com/unoplatform/uno/issues/12649
- https://github.com/unoplatform/uno/issues/12650
- https://github.com/unoplatform/uno/issues/12651
- https://github.com/unoplatform/uno/issues/12696
iOS/Android
- https://github.com/unoplatform/uno/issues/12396
- https://github.com/unoplatform/uno/issues/12346
- https://github.com/unoplatform/uno/issues/12659
Android
- https://github.com/unoplatform/nventive-private/issues/451
- https://github.com/unoplatform/uno/issues/3112
- https://github.com/unoplatform/uno/issues/12661
iOS
- https://github.com/unoplatform/uno/issues/12343
- https://github.com/unoplatform/uno/issues/12347
- https://github.com/unoplatform/Uno.Gallery/issues/875
Mac Catalyst
Wasm/Skia
Wasm/iOS
Wasm
- https://github.com/unoplatform/uno/issues/12535
- https://github.com/unoplatform/uno/issues/12350
- https://github.com/unoplatform/uno/issues/12330
- https://github.com/unoplatform/uno/issues/12653
- https://github.com/unoplatform/uno/issues/12665
- https://github.com/unoplatform/uno/issues/17771
Skia
Example
using System;
using Windows.Media.Core;
using Windows.UI.Xaml.Controls;
namespace Minesweeper.Helpers {
static class SoundHelper {
public static MediaPlayerElement Player { get; set; } = new MediaPlayerElement();
public static bool IsMuted { get; set; }
public static void Play(Sound sound, double volume = 1D) {
if (!IsMuted) {
switch (sound) {
case Sound.Gameover:
Player.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/Sounds/Yeah.wav"));
break;
case Sound.Explode:
Player.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/Sounds/Explode.mp3"));
break;
default:
break;
}
Player.MediaPlayer.Volume = volume;
Player.MediaPlayer.Play();
}
}
}
public enum Sound {
Gameover,
Explode,
}
}For which Platform:
- iOS
- Android
- WebAssembly
- WebAssembly renderers for Xamarin.Forms
- macOS
- Windows
- Build tasks
- Solution Templates
Anything else we need to know?
Source: unoplatform/uno