You can use this code to stop the view manager from automatically rejecting and capturing an event when the user clicks the Finish button so that you can close the view manager yourself.
Step 1.- specify MPMoviePlayerViewController
videoPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[[NSURL alloc ]initWithString:[aURL];
Step 2. - Remove the default MPMoviePlayerPlaybackDidFinishNotification observer and add your own
[[NSNotificationCenter defaultCenter] removeObserver:videoPlayer name:MPMoviePlayerPlaybackDidFinishNotification object:videoPlayer.moviePlayer]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:videoPlayer.moviePlayer];
Step 3. - Current view control
[self presentMoviePlayerViewControllerAnimated:videoPlayer]
Step 4. - Add videoFinish: method
-(void)videoFinished:(NSNotification*)aNotification{ int value = [[aNotification.userInfo valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue]; if (value == MPMovieFinishReasonUserExited) { [self dismissMoviePlayerViewControllerAnimated]; } }
bickster
source share