Reputation: 4897
Can't figure out why I'm not getting my callback - any advice?
-(void) playMovieWithURL:(NSURL *)url {
[currentVC.view removeFromSuperview];
MPMoviePlayerViewController *movieControl = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
//register for playback finished call
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinished:) name:MPMoviePlayerDidExitFullscreenNotification object:movieControl];
[self presentMoviePlayerViewControllerAnimated:movieControl];
}
-(void) movieFinished:(NSNotification *)aNotification {
NSLog(@"received callback that movie finished");
MPMoviePlayerController *movie = [aNotification object];
[movie.view removeFromSuperview];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerDidExitFullscreenNotification object:movie];
[movie release];
[self.view addSubview:currentVC.view];
}
Upvotes: 0
Views: 2186
Reputation: 4897
MPMoviePlayerController posts notifications MPMoviePlayerViewController does NOT post notifications
So I suppose I'll just switch over to using MPMoviePlayerControllers in this particular case.
Upvotes: 2
Reputation: 71058
I don't know much about the MP API, but you're registering for the notification in a reasonable way. Are you sure that MPMoviePlayerDidExitFullscreenNotification
is the notification you want? That (by name alone) doesn't appear to be equivalent to "movie finished".
Upvotes: 0
Reputation: 2146
Wild guess, but maybe you want MPMoviePlayerPlaybackDidFinishNotification
instead of MPMoviePlayerDidExitFullscreenNotification
?
Upvotes: 2