Revision: 21727
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 19, 2009 08:19 by funkypanda
Initial Code
// instantiate a music player MPMusicPlayerController *iPodMediaPlayer; iPodMediaPlayer = [MPMusicPlayerController iPodMusicPlayer]; // Check if it is now playing if([iPodMediaPlayer nowPlayingItem]){ NSLog(@"iPod is playing"); // Get the now playing item MPMediaItem *nowPlayingMediaItem = [iPodMediaPlayer nowPlayingItem]; // Get info of the item NSString *itemTitle = [nowPlayingMediaItem valueForProperty: MPMediaItemPropertyTitle]; NSString *itemArtist = [nowPlayingMediaItem valueForProperty: MPMediaItemPropertyArtist]; NSLog([[NSString alloc] initWithFormat:@"playing: %@ by %@", itemTitle, itemArtist]); } else { NSLog(@"iPod is not plaing"); }
Initial URL
http://developer.apple.com/iphone/library/documentation/Audio/Conceptual/iPodLibraryAccess_Guide/UsingMediaPlayback/UsingMediaPlayback.html#//apple_ref/doc/uid/TP40008765-CH100-SW1
Initial Description
Initial Title
Retrieve info of the now playing media item in iPod
Initial Tags
Initial Language
iPhone