XCDYouTubeVideoPlayer打开和closures

我已经开始使用XCDYouTubeVideoPlayer 。 它似乎有一些小问题。 当我使用方法(如下图)调用播放器时,会立即将其打开并closures。

我已经导入了以下框架: mediaplayer AVfoundation

并添加了XCDYouTubeVideoPlayerViewController.h和.m

在viewController.m中我已经添加了这个方法:

 - (IBAction) play:(id)sender { [self.view endEditing:YES]; NSString *link = @"m01MYOpbdIk"; XCDYouTubeVideoPlayerViewController *videoPlayerViewController = [[XCDYouTubeVideoPlayerViewController alloc] initWithVideoIdentifier:link]; [self presentMoviePlayerViewControllerAnimated:videoPlayerViewController]; } 

目前它的方式开放和closuresXCDYouTubeVideoPlayer 。 我究竟做错了什么?

我不明白为什么,但对我来说,在iOS8的行

  XCDYouTubeVideoPlayerViewController.m at #79 

正在调用这个方法:

  - (id) initWithContentURL:(NSURL *)contentURL { @throw [NSException exceptionWithName:NSGenericException reason:@"Use the ` initWithVideoIdentifier:` method instead." userInfo:nil]; } 

我只是评论它和作品!

XCDYouTubeVideoPlayer图书馆build立的YouTube的“stream媒体链接”,通过附加提供的签名的url。 看起来“url”现在有了签名,而“sig”键也是空的,从而否定了函数中的if语句

(NSURL *)videoURLWithData:(NSData *)数据错误:(NSError * __autoreleasing *)错误

转到文件

XCDYouTubeVideoPlayerViewController.m#248

你会看到一个for循环

 for (NSString *streamQuery in streamQueries) { NSDictionary *stream = DictionaryWithQueryString(streamQuery, queryEncoding); NSString *type = stream[@"type"]; NSString *urlString = stream[@"url"]; NSString *signature = stream[@"sig"]; if (urlString && signature && [AVURLAsset isPlayableExtendedMIMEType:type]) { NSURL *streamURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@&signature=%@", urlString, signature]]; streamURLs[@([stream[@"itag"] integerValue])] = streamURL; } 

将其更改为(从if语句中删除签名variables并修改URLWithString)

 for (NSString *streamQuery in streamQueries) { NSDictionary *stream = DictionaryWithQueryString(streamQuery, queryEncoding); NSString *type = stream[@"type"]; NSString *urlString = stream[@"url"]; if (urlString && [AVURLAsset isPlayableExtendedMIMEType:type]) { NSURL *streamURL = [NSURL URLWithString:urlString]; streamURLs[@([stream[@"itag"] integerValue])] = streamURL; }