i am playing a audio stream url using MPMoviePlayerController, it works fine, is their any way to get the details of current playing track ..i mean song title, artist name etc.
thanks in advance
i am playing a audio stream url using MPMoviePlayerController, it works fine, is their any way to get the details of current playing track ..i mean song title, artist name etc.
thanks in advance
Addt this ur .h file
@property (nonatomic, retain) MPMusicPlayerController *musicPlayer;
@property (nonatomic, retain) IBOutlet UILabel *songLabel;
@property (nonatomic, retain) IBOutlet UILabel *artistLabel;
@property (nonatomic, retain) IBOutlet UILabel *albumLabel;
- (void)handleNowPlayingItemChanged:(id)notification
{
// Ask the music player for the current song.
MPMediaItem *currentItem = self.musicPlayer.nowPlayingItem;
// Display the artist, album, and song name for the now-playing media item.
// These are all UILabels.
self.songLabel.text = [currentItem valueForProperty:MPMediaItemPropertyTitle];
self.artistLabel.text = [currentItem valueForProperty:MPMediaItemPropertyArtist];
self.albumLabel.text = [currentItem valueForProperty:MPMediaItemPropertyAlbumTitle];
// Display album artwork. self.artworkImageView is a UIImageView.
CGSize artworkImageViewSize = self.artworkImageView.bounds.size;
MPMediaItemArtwork *artwork = [currentItem valueForProperty:MPMediaItemPropertyArtwork];
if (artwork != nil)
{
self.artworkImageView.image = [artwork imageWithSize:artworkImageViewSize];
}
else
{
self.artworkImageView.image = nil;
}
}
MPMoviePlayerController
does not support getting ID3-based metadata out of the played stream. You will have to useMPMusicPlayerController
(local content) or possiblyAVPlayer
(streamed content) to get that accomplished. Though I must admit that I am not entirely sure ifAVPlayer
/AVPlayerItem
will actually get the job done - I have never tried it myself.