Get current track playing on control center iOS
Asked Answered
C

1

7

I'm looking to get the current track playing on iOS whatever the app which is playing the track. I mean, for example, if I use SoundCloud or Spotify on my phone, the player on control center is the same, so I think it's possible to get the current track name.

However I don't know how to do this, maybe someone could help me ?

Chromosome answered 7/5, 2014 at 10:45 Comment(0)
C
6

Frustratingly you can only get the details of the songs playing on the Music (iPod) app:

// Print the title of the currently playing song.
NSLog(@"%@", [[[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem] valueForProperty:MPMediaItemPropertyTitle]);

To get the details of songs from other apps you should be able to call:

[[MPNowPlayingInfoCenter defaultCenter] nowPlayingInfo]

but it always returns nil.

Cleavage answered 7/5, 2014 at 11:11 Comment(2)
Is this still true?Bornu
NFI, I wrote this 3 years ago, you'll have to test it for yourself :pCleavage

© 2022 - 2024 — McMap. All rights reserved.