Search code examples
c#webviewwin-universal-appwindows-10-universalbackground-task

How to keep Webview running as a BackgroundTask C# UWP Windows 10


I am creating a WebView in my C# code and Navigate it to a URL that is streaming music, when I click myPlayButton, without displaying the WebView in my UI. And it's playing the streamed music very well. But when the app get suspended (minimized), the webview stops running.

I am trying to use this BackgroungAudioTask Sample: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BackgroundAudio

Any idea if I can make the WebView work as the Audio works in a Background Task?


Solution

  • A MediaElement's Source can be assigned to any URI. I don't need any WebView, just a MediaElement that of course can be called on a Background Task.