Search code examples
iosiphoneobjective-cios7mpmovieplayercontroller

MPMoviePlayerController seek forward button stops the video in IOS7?


I am facing an issue with MPMoviePlayerController in iOS 7. When i single tap on the forward seek button the video stops and not allow to do anything like to play again full screen and slider change.

Here is my code. remove the Observer for the MPMoviePlayerPlaybackDidFinishNotification

[[NSNotificationCenter defaultCenter] removeObserver:moviePlayerViewController  name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerViewController.moviePlayer];

and add New Notification MPMoviePlayerPlaybackDidFinishNotification

 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(videoFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];

Here is my custom method to handle the MPMoviePlayerPlaybackDidFinishNotification

-(void)videoFinished:(NSNotification*)aNotification{
    MPMoviePlayerController *moviePlayer = [aNotification object];
    NSLog(@"%f",moviePlayer.currentPlaybackTime);

    int reason = [[[aNotification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue];
    if (reason == MPMovieFinishReasonPlaybackEnded) {
    }else if (reason == MPMovieFinishReasonUserExited) {
         [self performSelector:@selector(dismiss:) withObject:aNotification afterDelay:0.5];
    }else if (reason == MPMovieFinishReasonPlaybackError) {
    }

}

I need to stop this strange behaviour on single click and continue to play.

Anyone know how to do this? Thanks.


Solution

  • I think there are no any notifications or event are available on user interaction with the standard player buttons, and i have to implement own UI for the player controls. by this way we can then determine the actions for a single touch, long touch, etc. Then, we can add whatever functionality like increasing the play rate, or simply seeking to a time.