【问题标题】:iOS APP - youtube video iOS7iOS APP - youtube 视频 iOS7
【发布时间】:2014-01-17 06:54:12
【问题描述】:
在全屏模式下播放 youtube 视频时应用程序崩溃。
它在UIWebView 中嵌入在viewController 中,以模态方式呈现在window 的rootViewController 上。
如何解决这个问题?
谢谢。
【问题讨论】:
标签:
ios
objective-c
youtube
【解决方案1】:
由于缺乏声誉,我无法发表评论。您能否向我们展示一些代码,您是如何做到这一点的。
我正在这样做,它对我来说与 MoviePlayer 配合得很好:
NSString *youTubeURL = @"https://www.youtube.com/v/VCTen3-B8GU";
NSMutableString *html = [[NSMutableString alloc] initWithCapacity:1];
[html appendString:@"<html><head>"];
[html appendString:@"<style type=\"text/css\">"];
[html appendString:@"body {"];
[html appendString:@"background-color: transparent;"];
[html appendString:@"color: white;"];
[html appendString:@"}"];
[html appendString:@"</style>"];
[html appendString:@"</head><body style=\"margin:0\">"];
[html appendFormat:@"<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\"", youTubeURL];
[html appendFormat:@"width=\"%0.0d\" height=\"%0.0d\"></embed>", 320, 200];
[html appendString:@"</body></html>"];
[self.view loadHTMLString:html baseURL:nil];