How to detect a song playing by iPod
-
30-09-2019 - |
Question
Is it possible programmatically find out a song details of iPod library if my app allows playing background iPod music? some like:
start "My app" if (iPod music playing) { song.details == playing.music.details" }
I don't even have no idea how to determinate if is any song is playing by iPod. Any idea?
Solution
It kinda easy:
MPMusicPlayerController *musicPlayer = [MPMusicPlayerController iPodMusicPlayer]]; NSLog(@"Playing %@", [[musicPlayer nowPlayingItem] valueForProperty:MPMediaItemPropertyArtist]);
OTHER TIPS
See the Media Player Framework Reference:
"This framework...gives your application access to the iPod library."
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow