【发布时间】:2018-04-14 17:00:12
【问题描述】:
我正在尝试在 UITableViewCell 中播放 YouTube 视频,但它在 iOS 11 中不起作用。下面是代码。
CGRect videoFrame = CGRectMake(0, 0, cell.videoPlayerView.bounds.size.width, 211);
YTPlayerView *player = [[YTPlayerView alloc]initWithFrame:videoFrame];
NSString *videoId = [[BARUtility shared] getYoutubeVideoId:content.featuredVideoUrl];
NSDictionary *playerVars = @{@"controls" : @"0",
@"playsinline" : @"0",
@"rel" : @"0"};
if (videoId.length > 0) {
[player loadWithVideoId:videoId playerVars:playerVars];
[cell.videoPlayerView addSubview:player];
}
【问题讨论】:
标签: ios objective-c youtube sdk