【问题标题】:can I check youtube videos on simulator using this code?我可以使用此代码在模拟器上查看 youtube 视频吗?
【发布时间】:2011-09-06 02:37:15
【问题描述】:

我正在使用此代码查看 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 视频或代码中有任何其他问题吗?

【问题讨论】:

    标签: iphone objective-c ios uiwebview youtube


    【解决方案1】:

    您无法在模拟器中观看 Youtube 视频。如果显示白色 webview,我认为您的代码有效。

    尝试在您的 iPhone/iPod touch 上安装。

    【讨论】:

      猜你喜欢
      • 2011-12-28
      • 2015-05-08
      • 1970-01-01
      • 2022-10-06
      • 1970-01-01
      • 2018-08-10
      • 1970-01-01
      • 2016-11-25
      • 1970-01-01
      相关资源
      最近更新 更多