【问题标题】:iOS youtube iframe embed - won't go fullscreeniOS youtube iframe 嵌入 - 不会全屏显示
【发布时间】:2012-08-29 10:24:19
【问题描述】:

视频显示在 iPad 上。您可以点击以调出控件。全屏按钮显示在右下角,但点击它什么也不做。它应该让播放器进入全屏模式。有什么我可以添加到此代码中以使其工作的吗?

NSString *htmlStr = [NSString stringWithFormat:@"<body style=\"margin:0;padding:0;\" ><iframe class=\"youtube-player\" type=\"text/html\" width=\"420\" height=\"226\" src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\" allowfullscreen></iframe>",video_ID];

UIWebView *videoView = [[UIWebView alloc] initWithFrame:thumb.frame];
            videoView.backgroundColor = [UIColor darkGrayColor];
            videoView.scrollView.scrollEnabled = NO; 
            [videoView loadHTMLString:htmlStr baseURL:nil];
            [videoCcontainer addSubview:videoView];

【问题讨论】:

  • 取出固定的宽高?

标签: ios iframe uiwebview youtube-api


【解决方案1】:

尝试使用嵌入,而不是 iframe:http://mobiledevelopertips.com/video/display-youtube-videos-without-exiting-your-application.html

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

【讨论】:

    猜你喜欢
    • 2015-02-27
    • 2012-02-17
    • 2012-12-21
    • 2021-05-08
    • 2018-08-28
    • 2011-11-28
    • 2013-08-30
    • 1970-01-01
    • 2021-07-23
    相关资源
    最近更新 更多