我在Objective C中制作了一个iOS应用程序,它必须使用vimeo网址加载视频.我想使用视频播放器,我使用了这个:https://github.com/vimeo/VIMVideoPlayer.我按照阅读我的说明,但我无法阅读vimeo视频,我收到一个错误:
视频播放器状态失败:错误=错误域= AVFoundationErrorDomain代码= -11828"无法打开"UserInfo = 0x7f9c5d17b8c0 {NSUnderlyingError = 0x7f9c5d176910"操作无法完成.(OSStatus error -12847.)",NSLocalizedFailureReason =此媒体格式为不支持.,NSLocalizedDescription =无法打开}
这是我的代码:
-(void)viewDidLoad
{
[super viewDidLoad];
self.videoPlayerView = [[VIMVideoPlayerView alloc] init];
self.videoPlayerView.translatesAutoresizingMaskIntoConstraints = NO;
self.videoPlayerView.delegate = self;
[self.videoPlayerView setVideoFillMode:AVLayerVideoGravityResizeAspect];
[self.videoPlayerView.player enableTimeUpdates];
[self.videoPlayerView.player enableAirplay];
[self.view addSubview:self.videoPlayerView];
NSDictionary *views = NSDictionaryOfVariableBindings(_videoPlayerView);
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[_videoPlayerView]-0-|" options:0 metrics:nil views:views]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[_videoPlayerView]-0-|" options:0 metrics:nil views:views]];
//this is the kind of url I want to load
NSURL *URL = [NSURL URLWithString:@"https://player.vimeo.com/video/51806929"];
[self.videoPlayerView.player setURL:URL];
[self.videoPlayerView.player play];
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.