i have a MPMusicPlayerController and i want it to send a notification when the now playing item changes.
i declare the notification in my view did load:
and i have a "handle_NowPlayingItemChanged" method where i change the image view to accommodate the album cover for the new song:
but when the song changes in my player, the Handle Method is not called and the image view does not change, it just plays the next song.
what is wrong?
i declare the notification in my view did load:
Code:
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver: self
selector: @selector (handle_NowPlayingItemChanged:)
name: MPMusicPlayerControllerNowPlayingItemDidChangeNotification
object: player];
[player beginGeneratingPlaybackNotifications];
and i have a "handle_NowPlayingItemChanged" method where i change the image view to accommodate the album cover for the new song:
Code:
- (void) handle_NowPlayingItemChanged: (id) notification {
NSLog(@"Handle Method Called");
MPMediaItem *currentItem = [player nowPlayingItem];
MPMediaItemArtwork *artwork = [currentItem valueForProperty: MPMediaItemPropertyArtwork];
if(artwork){
imageView.image = [artwork imageWithSize:imageView.frame.size];
}
}
but when the song changes in my player, the Handle Method is not called and the image view does not change, it just plays the next song.
what is wrong?