MPMusicPlayerController playing queue with storeId fails for some items

I'm trying to play some songs in my app using the new setQueueWithStoreIDs method for MPMusicPlayerController. It works, most of the time, but sometimes it fails and it is painfully difficult to understand why because there are no errors coming from the API. Right now some of the songs that I queue, do not play at all, while the others play without any problems. I changed the order of the songs, and somehow the ones that failed to play in the old playlist played without any problems.


I'm observing the MPMusicPlayerControllerNowPlayingItemDidChangeNotification notification to see which item is playing, and the one thing I noticed for failed tracks is that their types are being returned as MPStorePlatformMediaItem, whereas the other ones are of type MPConcreteMediaItem. I genuinely have no idea what is going on, but I'm sure that the store types are being set correctly during search and the tracks all have isStreamable set to true. Anyone is experiencing similar problems with the new API?

Replies

I just had this again with a new song id and it seems like killing the native Apple Music app seems to do a trick and solve this problem. (Although I am using an applicationMusicPlayer instead of the systemMusicPlayer)

Are you saying that you can play Apple Music songs with an applicationMusicPlayer? The documentation is unclear on this but it seems like only the systemMusicPlayer can play Apple Music songs so this may be causing you problems?

I was having the same issue recently and found this to be the solution. Closing the native Music App allowed for the songs to play properly through applicationMusicPlayer.