locked
[WP8.1] Background Audio not work in windows phone locked screen.

    Question

  • I develope the Windows Phone Store App.

    I add the background task to play aduio in my app.

    The background task need to use HttpClient to get live stream and decode to real music stream to play.

    If the phone be locked screen and the song be ended, I expected the background task should play next song.

    But I can't. The background task be like idle. When I open the phone and enter the start screen, the background task auto be wake up and play next song.

    How can I solve the problem?

    Thank you.


    Wednesday, May 6, 2015 4:09 PM

All replies

  • Hello,

    This behavior is by design. The audio background task manager will throttle the task when it is using excessive use of the network or putting a drain on other system resources. The only way to work around this issue to create a custom MediaStreamSouce that delivers a continuous data stream to the underlying media components. There is no way to directly disable this throttling mechanism.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Thursday, May 7, 2015 1:19 AM
    Moderator
  • I use the MediaStreamSource for my Windows Store app and the way is work.

    I use the MediaStreamSource with BackgroundMediaPlayer.SetMediaSource run on the windows phone, it always happened out of memory exception.

    therefore I change to use the SetUriSource to play the song, and I must prepared the song file from live stream.

    I discover the problem: when the phone is locked, the httpclient send request and got Not Found.

    I add retry 10 times, and it still got not found, but I sure the url is right.

    • Edited by Pou LinMVP Friday, May 8, 2015 8:50 AM
    Friday, May 8, 2015 7:17 AM
  • Hello Pou,

    Again the behavior you are seeing is by design. You cannot work around the problem when using SetUriSource. You must write a custom MediaStreamSource to work around the problem.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Tuesday, May 12, 2015 1:31 AM
    Moderator