Search code examples
xcodempmovieplayercontroller

Done button action of MPMoviePlayerViewController


I am using custom MPMoviePlayerViewController. Like below,

#import <MediaPlayer/MediaPlayer.h>

@interface customVideoViewController : MPMoviePlayerViewController
{
}

@end

I am calling this customVideoViewController class from other class to RUN my video serially in landscape mode, video is running fine but I am not able to catch the action onClick of DONE button of MPMoviePlayerViewController.

Can any one guide me.

this is how I am calling to this view.

customVideoPlayerObj = [[customVideoViewController alloc]initWithContentURL:self.url];
[self presentViewController:customVideoPlayerObj animated:YES completion:nil];
[customVideoPlayerObj.moviePlayer play];

I need to catch the action for DONE button click of this, how to do this...?

here is the observer for the same

[[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(doneButtonClick:)
                                                     name:MPMoviePlayerWillExitFullscreenNotification
                                                   object:customVideoPlayerObj];

but control is not coming in doneButtonClick


Solution

  • You can use MPMoviePlayerPlaybackDidFinishNotification .