Need help showing track name and artist [swift]

Hi,


I've been trying to find a way to access the track name and artist information from any background audio just like the iOS control center player (swipe up view).


I have a part of my app that needs to display the track name and artist of any current music playing in the background.


At the moment I've been testing the MPMusicPlayerController but I can only get it to provide the now playing item of the Music app and not other third-party apps like Spotify or Apple's podcast app.


Any idea how I can replicate the control centers ability to fetch now playing items from any app music using the play audio background mode?


I'm trying to get this working in swift.


Thanks!

What you're talking about sounds like gaining full access to the MPNowPlayingInfoCenter. For applications to be able to set this info requires some strict guidelines which are all together referred to as being recognized as the "Now Playing" application. These apps can set now playing information for the default center which the system then uses where required. If it so happens that the iPodMusicPlayer is now playing, you can ask for the nowPlayingItem but this isn't going to get you information from other apps which support "Now Playing" functionality but use other APIs for audio playback.


File an enhancement request if you haven't already and it always helps to include some reasoning why the feature you want is important to you.

Hey, TroyR - did you ever manage to track this down? I have an app that works just fine and dandy with grabbing the info from Apple Music, but I want to also pull artist and song info if the Control Center player is playing (e.g.) Bandcamp, Spotify, etc. tracks. I can find in MPRemoteCommandCenter and MPNowPlayingInfoCenter how to send info to the player, but not get it!


Many thanks,


Vince

Need help showing track name and artist [swift]
 
 
Q