YTPlayerView 在被解雇时重新打开

YTPlayerView re-opening when dismissed

我有一个嵌入式 YTPlayerView:

YTPlayerView *player = [[YTPlayerView alloc] initWithFrame:newCell.coverImageButton.frame];
[player loadWithVideoId:[self extractYoutubeIdFromLink:posting.postDictionary[@"uri"]]];
player.delegate = self;
[newCell addSubview:player];

它工作正常,我点击视图,它显示了一个全屏播放器。但是当我按下 'done' 时,视图被取消,然后在大约一秒钟后重新呈现。

我认为 YTPlayerView class 不是获得我想要的结果所必需的。这已经足够完美了:

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://www.youtube.com/embed/%@",tubeId]];
UIWebView *w = [[UIWebView alloc] initWithFrame:webFrame];
[self.view addSubview:w];
[w loadRequest:[NSURLRequest requestWithURL:url]];

在YTPlayerView-iframe-player.html

中注释这行代码window.setInterval(forcePlay, 5000)即可