I'm using MPMoviePlayerController
and I need to detect pressing Next/Prev buttons. I tried several things, none of which seem to works.
Here is what I tried:
- remote control events
-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}
-(void) viewWillDisappear:(BOOL)animated
{
[[UIApplication sharedApplication] endReceivingRemoteControlEvents];
[self resignFirstResponder];
[super viewWillDisappear:animated];
}
-(BOOL)canBecomeFirstResponder
{
return YES;
}
-(void)remoteControlReceivedWithEvent:(UIEvent *)receivedEvent
{
// stuff
}
The problem is remoteControlReceivedWithEvent
method is never called. I've read that this will not work in iOS version higher than 6 - I'm working on iOS 7
- notifications
I tried using MPMoviePlayerPlaybackStateDidChangeNotification
and check against MPMoviePlaybackStateSeekingForward
or MPMoviePlaybackStateSeekingBackward
- unfortunatelly, these playback state are set when dragging the playback bar, not when pressing Next/Prev buttons.
Any ideas?