在ios上与youtube ios player helper第三方库集成时出错
我正在尝试使用库播放YouTube视频,但在运行时遇到错误: 在YTPlayerView.m 编辑: 致:在ios上与youtube ios player helper第三方库集成时出错,ios,youtube,youtube-iframe-api,Ios,Youtube,Youtube Iframe Api,我正在尝试使用库播放YouTube视频,但在运行时遇到错误: 在YTPlayerView.m 编辑: 致: 希望能帮助你 您需要将资产/YTPlayerView-iframe-player.html复制到主捆绑包以解决此问题 或只需放入捆绑包中,并替换应用程序开始查找的位置 /*NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player" ofType:@"html"
希望能帮助你 您需要将资产/YTPlayerView-iframe-player.html复制到主捆绑包以解决此问题 或只需放入捆绑包中,并替换应用程序开始查找的位置
/*NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
ofType:@"html"
inDirectory:@"Assets"];*/
NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player" ofType:@"html"];
您没有提供有问题的插件版本。 如果这是1.5,这里讨论了一个bug: 它在master中已被修复,因此,假设您正在使用Cocoapods,您可以执行以下操作:
pod 'youtube-ios-player-helper', :git=>'https://github.com/youtube/youtube-ios-player-helper', :commit=>'head'
拖放 YTPlayerView-iframe-player.html YTPlayerView.h YTPlayerView.m 项目中的文件 添加桥接头并使用此项:
#import "YTPlayerView.h"
NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
ofType:@"html"];
转到YTPlayerView.m文件:
#import "YTPlayerView.h"
NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
ofType:@"html"];
查找:
NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
ofType:@"html"
inDirectory:@"Assets"];
更改为:
#import "YTPlayerView.h"
NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
ofType:@"html"];
在视图控制器中:
#import "YTPlayerView.h"
NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
ofType:@"html"];
使用:
获取视频ID并加载:
self.playerView.load(withVideoId: videoID)
self.playerView.playVideo()
}
谢谢,这节省了我很多时间。我已经替换了代码。但是它显示了一些没有播放视频的文本