MPMusicPlayerController ApplicationMusicPlayer stops playing when the screen locks

I'm using MPMusicPlayerController - ApplicationMusicPlayer with the "play audio" background mode enabled under Capabilities. When I load and play an iTunes Music track with the applictionMusicPlayer the audio stops when the screen locks or the app goes into the background. My test app also plays bundled audio simultaneously, and that audio continues playing when the screen locks but not the Apple/iTunes music.


The issue is in all the betas I've tested.


Has anyone else encountered this? Is there a new option that would affect this or is this just an iOS 13 Beta bug?


For any interested Apple devs there is a sample app submitted through Feedback Assistant demonstrating this bug. (FB6946855)

Replies

Same issue with WkWebView in beta 6 when trying to play audio in the background. It seems like a bug with the background audio entitlements.


https://forums.developer.apple.com/message/378734#378734

I see the same problem with iOS 13 beta 8, with iOS 12 it played OK in background.


The strange thing is that the documentation

https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller/1624156-applicationmusicplayer?language=objc

states:

"... When your app moves to the background, the music player stops playing the current media."


So the behavior before iOS 13 was NOT the same as the documentation. But who wants a music player that stops when being backgrounded? That's how iOS 3 worked ten years ago.

Why not keep the old behaviour and change the documentation? This avoids problems for us developers.


It's possible to switch to using the "systemMusicPlayer", it works in the background but it doesn't work exactly the same as the "applicationMusicPlayer" and
introduces other problems at least for my app.


Could we have some comments from some Apple engineer? Isn't that what this beta forum is all about?

Any update on this? I'm having the same issue. Can't do anything with the systemPlayer or applicationQueuePlayer when in the background.