我使用 MPMoviePlayerController 因为我想播放电影。
一个问题。当我创建 MPMoviePlayerController 时,应用程序会停止一点。
这是我的代码:
NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"m4v"];
NSURL *videoURL = [NSURL fileURLWithPath:path];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
moviePlayer.scalingMode=MPMovieScalingModeFill;
moviePlayer.controlStyle=MPMovieControlStyleNone;
moviePlayer.shouldAutoplay=NO;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieRestartCallback:)
name:MPMoviePlayerPlaybackStateDidChangeNotification
object:nil];
[moviePlayer.view setFrame:CGRectMake(20, 20, 280, 200)];
[self.view addSubview:moviePlayer.view];
`
为什么应用程序停止?这是解决问题的方法吗?