我正在使用此代码在 ios 6 上播放视频(在 Xcode 和设备模拟器中)
- (void) playMovie {
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"flying" ofType:@"m4v"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[moviePlayerController prepareToPlay];
[moviePlayerController.view setFrame: self.view.bounds];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.scalingMode = MPMovieScalingModeAspectFit;
moviePlayerController.movieSourceType = MPMovieSourceTypeFile;
[moviePlayerController play];
}
播放开始,但视频在 5 秒后中止。它只是消失了,我在 Xcode 中看到一个黑色窗口并且没有错误消息。
任何线索?谢谢