我正在将此代码与 MediaPlayer 框架一起使用来播放视频:
-(void)GrommeVideoExcerpt1
{
NSURL *url1 = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"GrommeVideoExcerpt1" ofType:@"mp4"]];
grommePlayer1 = [[MPMoviePlayerController alloc]
initWithContentURL:url1];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:grommePlayer1];
grommePlayer1.controlStyle = MPMovieControlStyleDefault;
grommePlayer1.shouldAutoplay = YES;
[self.view addSubview:grommePlayer1.view];
[grommePlayer1 setFullscreen:YES animated:YES];
}
但是当我播放一个视频,然后导航到另一个视频并尝试播放时,应用程序崩溃了。它给了我这个错误: