I'd like to play .mp3 or wav sounds in my uwp app, I need to play it only when app is open and without any media element on the ui. Is there a possibility to make some threads to play separate songs at the same time. Any relevant info is appreciated.
Adapting the above answer slightly using MediaElement
. Presumes you have a media file at the root of your application in MyFolder/MySound.wav
var element = new MediaElement();
var folder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("MyFolder");
var file = await folder.GetFileAsync("MySound.wav");
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
element.SetSource(stream, "");
element.Play();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With