iphone UIWebView嵌入youtube视频

iphone UIWebView嵌入youtube视频,iphone,youtube,embed,Iphone,Youtube,Embed,我在应用程序中使用此代码嵌入youtube视频 NSString *embedHTML = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: transparent;\ }\ </style>\ </head><body style=\"margin:0\">\ <embed id=\"

我在应用程序中使用此代码嵌入youtube视频

NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: transparent;\
}\
</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, urlString, frame.size.width, frame.size.height];
NSString*embedHTML=@”\
\
\
身体{\
背景色:透明\
颜色:透明\
}\
\
\
\
";
NSString*html=[NSString stringWithFormat:embedHTML,urlString,frame.size.width,frame.size.height];
youtube视频url来自url字符串,如“http://www.youtube.com/v/QfWGRIlpNBE". 这段代码运行良好

我的问题是,如果视频是flash格式的,那么它就不能在iphone上播放,我在播放按钮上看到了一个晃动


如何检测youtube视频是flash格式还是H.264格式?我只有视频的url。

如果在构建HTML之前需要知道,我认为唯一的方法是使用YouTube API。您可以通过以下方式查询问题中的视频:

H.263中没有该视频ID的结果

有关API文档,请参见

否则,您可以使用

有人能帮我吗?谢谢,非常感谢+1的
方法。YouTube可以处理这些细节,他们应该能够通过iframe查看您的用户代理,并随时提供HTML5。