MPMusicPlayerController does not post notifications in background

Originator:hello
Number:rdar://24222805 Date Originated:1/17/2016
Status:Open Resolved:
Product:iOS Product Version:9.3
Classification:Enhancement Reproducible:Always
 
Summary:

Documentation states that an application music controller isn’t meant to play music in the background. I would like to argue how strange that rule is in today’s multitasking iOS, but I will file a different report for that. The state of the matter is, an application music player will play music in the background perfectly fine until its queue ends, as long as the app has been marked to require background audio. After that, any application logic to restart playback by refilling the controller’s queue that would be triggered by a notification will fail to be called until the application re-enters the foreground.

I believe this should be supported usage of the MediaPlayer framework, as this API is the only access developers have to play music from the Apple Music library thanks to the new setQueueWithStoreIDs(_:) API in 9.3. If background audio is not supported by this, a whole class of potential apps will fail to exist that would make an Apple Music subscriber’s experience even better.

Steps to Reproduce:

1. Get instance of MPMusicPlayerController using applicationMusicPlayer class method in a background audio enabled application.
2. Register for notifications with beginGeneratingPlaybackNotifications(), set the playback queue with any of the setQueueWith… methods. 
3.Begin playback and press the home button or switch to another app.

Expected results:

Notifications should fire at appropriate times based on the the state of the music player, to allow the application to update the queue even when the application is in the background.

Actual results:

No notifications are posted until the application returns to the foreground.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!