开发者

Does the youTube iFrame embed code work on mobile devices? (iPhone, Android)

I made a sample page using the HTML5 iFrame embed code from youTube. When browsing on my iPhone I get a play button but yet the video never plays if I press on it. When I embed the video with the HTML5 video tag everything plays just fine.

Does anyone know if youTube officially supports mobile devices with the embed code? Are 开发者_开发知识库there extra parameters I need? I tried the following code:

<iframe width="420" height="345" src="http://www.youtube.com/embed/OZOX5sad2FE" frameborder="0" allowfullscreen></iframe>


Mobile Safari on the iPhone does support the iFrame. There's an example here: http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html

Have you tried including the class and type? class="youtube-player" type="text/html"


I had this same problem and spent a lot of time on it.

The issue is that when you use the iframe code in your webpage and open that page on iPhone safari. And click on the video, the cross domain call to get the video from youtube and show it in the HTML5 player fails.

The solution is as picciano explained:

"Have you tried including the class and type?"

class="youtube-player" type="text/html"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜