【问题标题】:Youtube video player inside app(which plays inside webview itself)应用程序内的 Youtube 视频播放器(在 webview 本身内播放)
【发布时间】:2013-07-20 10:07:26
【问题描述】:

我正在尝试在应用程序内制作Youtube video player(它在webview 本身内播放视频)。是否有任何基于this.or任何示例程序的教程?

提前致谢。

【问题讨论】:

    标签: ios youtube-api


    【解决方案1】:

    您可以像这样在 web 视图中嵌入 youtube 视频:

    - (void)embedYouTubeInWebView:(NSString*)url theWebView:(UIWebView *)aWebView {     
    
    NSString *embedHTML = @"\
    <html><head>\
    <style type=\"text/css\">\
    body {\
    
    background-color: transparent;\
    color: white;\
    }\
    </style>\
    </head><body style=\"margin:0\">\
    <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
    width=\"%0.0f\" height=\"%0.0f\"></embed>\
    </body></html>";
    
    NSString* html = [NSString stringWithFormat:embedHTML, url, aWebView.frame.size.width, aWebView.frame.size.height]; 
    
    [aWebView loadHTMLString:html baseURL:nil];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-14
      • 2012-06-07
      • 2011-01-18
      • 2013-11-19
      • 2014-05-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多