无法弄清楚为什么我没有得到回电 - 有什么建议吗?
-(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];
}
答案 0 :(得分:2)
狂野猜测,但也许你想要MPMoviePlayerPlaybackDidFinishNotification
而不是MPMoviePlayerDidExitFullscreenNotification
?
答案 1 :(得分:2)
MPMoviePlayerController发布通知 MPMoviePlayerViewController不发布通知
所以我想在这种特殊情况下我会切换到使用MPMoviePlayerControllers。
答案 2 :(得分:0)
我对MP API了解不多,但您正在以合理的方式注册通知。您确定MPMoviePlayerDidExitFullscreenNotification
是您想要的通知吗?那(仅凭名称)似乎不等同于“电影完成”。