本文介绍了如何使用MPMoviePlayerViewController在本地播放电影?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的Resources文件夹中有一个名为lebron.mp4的mp4文件:
I have an mp4 file called lebron.mp4 in my Resources folder:
-(IBAction)videoButtonClicked:(id)sender{
NSString *url = [[NSBundle mainBundle]
pathForResource:@"lebron"
ofType:@"mp4"];
MPMoviePlayerViewController* moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]];
moviePlayerViewController.view.backgroundColor = [UIColor blackColor];
[self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];
[moviePlayerViewController release];
}
显示电影播放器,但电影不播放.为什么?
Displays the movie player, but the movie doesn't play. Why?
推荐答案
您是否尝试过这样显示它:
did you try to display it like this :
[moviePlayerViewController play];
[window addSubview: MPMoviePlayerViewController.view];
?
这篇关于如何使用MPMoviePlayerViewController在本地播放电影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!