使youtube.com/embed网址在iOS上运行 [英] Making youtube.com/embed URLs work on iOS
问题描述
对于YouTube上的特定视频,您可以在任何iOS设备上访问http://youtube.com/watch?v=(code)以观看视频。
For a given video on YouTube, you can visit http://youtube.com/watch?v=[code] on any iOS device to see the video.
但是,如果您使用http://youtube.com/embed/(code)网址 - 例如,在网页上的iframe或 Colorbox 模式 - 它不会在iOS上播放。
However, if you use the http://youtube.com/embed/[code] URL — for instance, in an iframe on a page or in a Colorbox modal — it will not play on iOS.
例如,如果你使用这样的代码:
For instance, if you use code like this:
<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
您只看到错误:
您的浏览器目前无法识别任何可用的视频格式。 点击此处访问有关HTML5视频的常见问题解答。
要添加侮辱伤害,这个链接在iOS上无法点击,所以我不知道会发生什么页面。在YouTube上有一个 HTML5页面,但它没有说明任何特别有用或令人惊讶的内容。
To add insult to injury, the link is not clickable on iOS, so I don't know what page that goes to. There is an HTML5 page on YouTube, but it says nothing particularly useful or surprising.
是否有可以用于iframe嵌入的语法在iOS上按预期工作?
Is there a syntax that can be for iframe embedding that works as expected on iOS?
推荐答案
试试这个,它只是有效:
Try this, it just works:
<object>
<param name="movie" value="http://www.youtube.com/v/[VIDEO_ID]"></param>
<embed src="http://www.youtube.com/v/[VIDEO_ID]" type="application/x-shockwave-flash"></embed>
</object>
编辑:
它有效,因为Apple取代了html标签使用可以播放YouTube视频的嵌入式原生电影播放器。
Edit: It works because Apple replaces the html tag with an embedded native movie player that can play the youtube video.
这篇关于使youtube.com/embed网址在iOS上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!