Get info about background music from another app

364 views Asked by At

I'm wondering if there is a way to get track info for an audiobook playing in the background via Audible or song playing via Spotify while I'm inside my app.

Right now I know that I can detect if there is background music playing:

AVAudioSession.sharedInstance().isOtherAudioPlaying

I also know that I can get a lot of info about the music played through the official Music app:

MPMusicPlayerApplicationController.systemMusicPlayer.nowPlayingItem!.title
MPMusicPlayerApplicationController.systemMusicPlayer.currentPlaybackTime
1

There are 1 answers

0
Chris McElroy On

Unfortunately, I don’t think you’re able to access any info about other applications’ playback other than whether or not it’s happening (AVAudioSession.sharedInstance().isOtherAudioPlaying). To get more info, I believe you have too interface with each application’s data individually using their own SDK. Here’s a link to Spotify’s.