how to get done button event in MPMOviewplayercontroller in iphone?
I have used MPMoviePlayerContro开发者_StackOverflowller for playing video file.I want to get done button event but i dont know how to get can you help me for this questions
You can use MPMoviePlayerPlaybackDidFinishNotification.. Dont think there is a notification that only triggers when the done button is pressed and not when the movie finishes by itself thou...
Add this when creating the MPmovieplayerController:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish: ) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer] ;
And then this method:
-(void)moviePlayBackDidFinish: (NSNotification*)notification{
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer] ;
[moviePlayer stop];
[moviePlayer release];
}
精彩评论