YTPlayerView在被解雇时重新开放

时间:2015-03-25 14:14:54

标签: ios uiview youtube embed

我有一个嵌入式YTPlayerView:

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

它工作正常,我点击视图,它呈现一个全屏播放器。但是当我按“完成”时,视图将被解除,然后在一秒左右后重新显示。

2 个答案:

答案 0 :(得分:1)

只需在YTPlayerView-iframe-player.html

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

答案 1 :(得分:0)

我认为YTPlayerView类不需要获得我想要的结果。这非常有效:

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]];