I am working on my Project (a soundcloud client) and the app can play tracks just fine, but not when the app is minimized. I use the MediaElement-Object for playing the mp3 from the url. How can i force the music to continue playing the music, when the app is in the background. Or whats the easiest way/best explained tutorial to implement this. I searched alot for a good answer, but the ones, i found, was too good for me :D What means, that i didn't understand it.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
To play audio in the background you will have to do a Declaration in
Package.appxmanifest
for a Background Tasks, enable audio and add an entry point likeTestUWP.MainPage
page.Also for the user to easily be able to manage the audio you can use SystemMediaTransportControls
Here is a basic setup with Play and Pause.
xaml
C#
Output
If you like to enable more controls you can do using the available properties for ex.
systemControls.IsNextEnabled = true;
and you have to add the
case
in the button switch.You need to use a BackgroundAudio task for this to work on windows mobile. This article will walk you through the github sample provide by Microsoft. https://blogs.windows.com/buildingapps/2016/01/13/the-basics-of-background-audio/