tags:

views:

13

answers:

1

I have used MPMoviePlayerController 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

A: 

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];

}
Larsaronen