问题
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>
回答1:
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"
回答2:
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"
来源:https://stackoverflow.com/questions/7277045/does-the-youtube-iframe-embed-code-work-on-mobile-devices-iphone-android