MPMusicPlayerController queue information

Is there a way to get the current queue items from an MPMusicPlayerController?

I need to know when the items I've set to the queue finish playing completely but cannot find any way to do this.

I am not using MusicKit but setting the queue via play parameters.

From what I can tell so far, after the queue finishes playing, it pauses and resets to the first item in the queue. So even after playback is done, there is no way to know that it finished on its own.

Hello @rhondadevore,

If you're using MPMusicPlayerController's applicationQueuePlayer, you may be able to get a list of items in the playback queue using perform(queueTransaction:completionHandler:).

I should note that the equivalent functionality with MusicKit is much more straightforward, with ApplicationMusicPlayer's queue's entries.

However, it looks like this is just a means to an end for you, and that you're actually wondering about the same thing as was being discussed in the second half of this thread: How to detect a song end?

Let me quote the relevant part of my last answer:

I checked with my colleagues who work on our playback engine, and they confirmed to me that the current behavior where the player goes back to .paused state when it reaches the end of the playback queue is actually the intended behavior.

That said, we can probably assist you better if you tell us a little bit more about what you're actually trying to do. If we understand your end goal in terms of the user experience you're trying to create, we might be able to offer alternative suggestions on how to get there.

I hope this helps.

Best regards,

@JoeKun

I know this thread is pretty old and most probably nothing is gonna change within the API but can you give us any explanation as to why reading queue from system music player is not possible, only from application music player? I just can’t understand what would be the reason for that, it’s such an essential feature for every music playing app and ever since MPMusicPlayerController exists it seems to me that it is made difficult to work with on purpose. I’m just talking about reading the queue, not editing it in any way although it would be nice.

And I know that application music player gives us those abilities but it is much less stable than system music player and often fails to play anything with numerous prepareToPlay errors thrown.

So we have to choose from offering users more functionality or more stability, I just don’t know why we can’t have both. Those issues like I said are over a decade old at this point so I (and my other colleagues) gave up any hope for a fix.

And yes I filed multiple feedback repoerts regarding these issues, without any reply.

The iOS 15 APIs didn’t fix any underlying issues with playing from Apple Music, they are just a bunch of wrappers on top of classes that have the same bugs since iOS 3.0! We need a framework that is built from ground up not such nonsense

MPMusicPlayerController queue information
 
 
Q