Get queue and current item from ApplicationMusicPlayer?

I'd like to be able to monitor what is queued and what is currently playing in MusicKit's ApplicationMusicPlayer.

Use cases:

  • Show a "playing" indicator on the current track in a list.
  • Show a "now playing" bar with song title, album, and artist.

Is this possible?


Hi @Alex at Astrocode,

Thanks for your feedback about MusicKit's ApplicationMusicPlayer.

What you're looking for is not currently possible with the existing seeds, but we are working on this very thing right now.

Stay tuned.

Best regards,

Hello @Alex at Astrocode,

We have made a number of changes to MusicKit's playback API in iOS 15 beta 4.

You can now access ApplicationMusicPlayer.shared.queue to monitor the queue. This object is observable, so you can even use it with @ObservedObject in your SwiftUI views.

You can also get information about what is currently playing with ApplicationMusicPlayer.shared.queue.currentEntry.

I hope this helps.

Best regards,