You can observe @"MPAVControllerPlaybackStateChangedNotification"(use nilfor an object). This notification is not documented, so I don’t know if the App Store will approve your application.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playbackStateDidChange:)
name:@"MPAVControllerPlaybackStateChangedNotification"
object:nil];
The notification has a key MPAVControllerNewStateParameterin its own userInfo. The value will be 0 before playback, 1 when paused, 2 during playback, and 3 (instantly) when dragging the playback slider.
- (void)playbackStateDidChange:(NSNotification *)note
{
NSLog(@"note.name=%@ state=%d", note.name, [[note.userInfo objectForKey:@"MPAVControllerNewStateParameter"] intValue]);
}
source
share