Question

In my testing, it seems that playing MPMediaItem through MPMusicPlayerController does not update the Play Count (using iPod or application instance)

Can anyone confirm this? I haven't seen anything in the documentation either.

Was it helpful?

Solution

In my tests, the play count gets updated for both iPodMusicPlayer and applicationMusicPlayer.

First I skipped through to the end of the song. Then I jumped back to the previous track and tested the play count using valueForProperty after getting a MPMusicPlayerControllerNowPlayingItemDidChangeNotification:

- (void)handleNowPlayingItemChange:(NSNotification *)itemNotification {
     MPMediaItem *currentMediaItem = [[self musicPlayer] nowPlayingItem];
     NSNumber *currentPlayCount = [currentMediaItem valueForProperty:MPMediaItemPropertyPlayCount];
     NSLog(@"Current play count: %@", currentPlayCount);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top