我想制作一个演示应用程序,仅用以下示例代码播放从网络加载的视频:
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *url = [NSURL URLWithString:@"http://ftp.cp.108tian.com/video/unity_animation.mov"];
AVPlayer *avp = [[AVPlayer alloc]initWithURL:url];
AVPlayerViewController *avpc = [[AVPlayerViewController alloc]init];
avpc.player = avp;
[self presentViewController:avpc animated:YES completion:nil];
}
是的,我添加了AST
以允许HTTP传输:
但是我仍然收到此错误:
发生了什么事?以及如何解决这个问题?
答案 0 :(得分:0)
Present
除有效网址外,还应位于viewDidAppear
/ viewWillAppear
中
[self presentViewController:avpc animated:YES completion:nil];