We want to play a WAV file somewhere in my headless UWP background application on Windows 10 IoT Core. For this i have followed the Microsoft docs and used the following method:
var mediaPlayer = new MediaPlayer();
mediaPlayer.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/startup.wav"));
mediaPlayer.Play();
I have copied the WAV file (startup.wav) to the Assets folder in Visual Studio, set it to always copy to output and compiled the UWP application. No matter how i try i don't get any sound output. I tried 2 Raspberry PI's (both version 3) and connected my pc speakers to the output jack of the Raspberry.
I also granted the application the correct permissions in the package.appxmanifest:
<uap3:Capability Name="backgroundMediaPlayback"/>
If i go to the device portal i see on the right side the default Raspberry pi 2 audio with slidebar active. Which i guess is a sign drivers are correct.
What can i do to play a simple wav file in my headless background UWP application? Maybe i am doing something wrong, hope somebody can help me.
Thanks for all your help. When i tried a third raspberry it works, no idea why but maybe i have bad luck and two head-jack ports are broken :).
Thanks for all your assistance!