[英]ios problems with video playback
我正在使用此代碼在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中沒有錯誤消息。
有什么線索嗎? 謝謝
5秒鍾后將釋放MPMoviePlayerController變量。 我在實現級別引入了變量聲明,並在playMovie方法中引入了定義。 現在可以了!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.