In a preview of Windows 8 Developer, we can use this code to play audio in the background:
mediaElement.AudioCategory = AudioCategory.Media;
In the Windows8 client view, it seems that we should use AudioCategory.BackgroundCapableMedia instead of AudioCategory.Media
mediaElement.AudioCategory=AudioCategory.BackgroundCapableMedia;
and also declare a background job in appxmanifest
<Extension Category="windows.backgroundTasks" EntryPoint="TestApp.App"> <BackgroundTasks> <Task Type="audio" /> </BackgroundTasks> </Extension>
but this did not work for me, and MediaElement will throw an exception "MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED" in MediaFailed EventHandler How can I do this?
source share