tags:

views:

497

answers:

2

Apple released access to the iPod Library in the iPhone SDK 3.0 and I'm wondering if it's now possible to understand which song is currently playing? Title, Artist, Album suffices. Example: User opens an app and the app can know which song is playing in the background.

Has anyone had any experience with this?

Thanks a bunch!

+3  A: 

This has already been answered here on SO:
iPhone sdk - accessing current song information through an app.

weichsel
+4  A: 
MPMediaItem * song = [[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem];
NSString * title   = [song valueForProperty:MPMediaItemPropertyTitle];
NSString * album   = [song valueForProperty:MPMediaItemPropertyAlbumTitle];
NSString * artist  = [song valueForProperty:MPMediaItemPropertyArtist];
Ben S
thank you ben, you're awesome!
Gregor Hochmuth