问题
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?
回答1:
It kinda easy:
MPMusicPlayerController *musicPlayer = [MPMusicPlayerController iPodMusicPlayer]]; NSLog(@"Playing %@", [[musicPlayer nowPlayingItem] valueForProperty:MPMediaItemPropertyArtist]);
回答2:
See the Media Player Framework Reference:
"This framework...gives your application access to the iPod library."
来源:https://stackoverflow.com/questions/4138247/how-to-detect-a-song-playing-by-ipod