Hi. i have a small movieplayer in a rectangle (20,20,300,200) in an ipadview. there is a UIpagedcontrol. while a movie plays i change the UIPage, but movieFinishedCallback notification cant be called. i think movieFinishedCallback notification is called when the movie completly finished. i want to stop movie and prepare the next movie when the UIPage changed. which notification should i register?
i play video with this code:
//loading video codes
NSURL *url = [NSURL URLWithString:self.currentVideoPath];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification object:player];
player.view.frame = CGRectMake(20, 20, 320, 200);
self.moviePlayer=player;
[self.view addSubview:self.moviePlayer.view];
[moviePlayer play];
-(void) movieFinishedCallback:(NSNotification*) aNotification {
//MPMoviePlayerController *player = [aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:self.moviePlayer];
self.moviePlayer.initialPlaybackTime=-1.0;
[self.moviePlayer stop];
[self.moviePlayer release];
self.moviePlayer = nil;
}
in .h file;
MPMoviePlayerController *moviePlayer;
//...
@property (nonatomic, retain) MPMoviePlayerController *moviePlayer;