微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我可以使用此代码在模拟器上检查youtube视频吗?

如何解决我可以使用此代码在模拟器上检查youtube视频吗?

| 我正在使用此代码来观看youtube视频
- (YouTubeView *)initWithStringAsURL:(Nsstring *)urlString frame:(CGRect)frame;
 {
if (self = [super init]) 
{
    // Create webview with requested frame size
    self = [[UIWebView alloc] initWithFrame:frame];

    // HTML to embed YouTube video
    Nsstring *youTubeVideoHTML = @\"<html><head>\\
    <body style=\\\"margin:0\\\">\\
    <embed id=\\\"yt\\\" src=\\\"%@\\\" type=\\\"application/x-shockwave-flash\\\" \\
    width=\\\"%0.0f\\\" height=\\\"%0.0f\\\"></embed>\\
    </body></html>\";

    // Populate HTML with the URL and requested frame size
    Nsstring *html = [Nsstring stringWithFormat:youTubeVideoHTML,urlString,frame.size.width,frame.size.height];

    // Load the html into the webview
    [self loadHTMLString:html baseURL:nil];
}
return self;  
} 现在,我无法在模拟器上看到相关视频。但是,白色的Webview即将出现。 所以有什么类似的事情我在模拟器上看不到youtube视频,或者代码中还有其他问题吗?     

解决方法

        您无法在模拟器中看到Youtube视频。如果显示白色的webview,我认为您的代码有效。 尝试在iPhone / iPod touch上安装。     

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。