如何使用 MPMoviePlayerViewController 在本地播放电影?
我的资源文件夹中有一个名为 lebron.mp4 的 mp4 文件:
-(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];
}
显示电影播放器,但电影不播放。为什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试像这样显示它:
?
did you try to display it like this :
?