我试图在iOS 8中使用AVPlayerViewController,但视频无法加载。 我只是获得下面的屏幕。
整个代码库位于https://github.com/sairamsankaran/AVPlayerDemo
AVPlayerViewController *playerViewController = [[AVPlayerViewController alloc] init]; playerViewController.player = [AVPlayer playerWithURL:[[NSBundle mainBundle] URLForResource:@"Besan" withExtension:@"mp4"]]; [playerViewController.player play];I am trying to use the AVPlayerViewController in iOS 8. But the video does not load. I simply get the screen below.
The entire codebase is here https://github.com/sairamsankaran/AVPlayerDemo
最满意答案
我下载你的项目并看看。 这个解决方案非常简单,你忘了将视频文件包含在你的目标中,这意味着当你设置的URL指向一个不存在的文件时,这意味着NSURL为零。
在Xcode的实用程序侧栏中,选择导航器中的mp4文件,选择文件检查器,然后在“目标成员”中确保检查您的应用目标。
完成此操作后,您的电影将在发布时播放。
I download your project and had a look. The solution is pretty simple, you forgot to include the video file in your target, which means when you're setting up the URL you're pointing to a file that doesn't exist, which means the NSURL is nil.
In the Utilities side bar in Xcode, with your mp4 file chosen in the navigator, choose the File Inspector and in "Target Membership" be sure to check your app target.
Once you have done this your movie will play on launch.
更多推荐
发布评论