What is a good way to embed Vimeo videos in HTML5 format?

房东的猫 提交于 2019-12-07 11:48:18

问题


I don't want to embed Vimeo videos in Flash format. How do I embed them in HTML5 format?


回答1:


They actually enable HTML5 through cookies, so I don't think you can link directly to the HTML5 version. Here's the JS code they use to switch between Flash and HTML5:

function toggle_html5_player(obj, on) {
    if (on) {
        setCookie("html_player", 1, 365);
    } else {
        setCookie("html_player", 0, 365);
    }
    reload_page();
}

Edit:

Also on embedding, the official blog post states:

It only works on Vimeo.com right now, embed code will still be Flash

Edit 2:

Actually, that is an old statement which is not true anymore. The new embeds actually use HTML5 automatically on devices that don't support Flash like the iPad or iPod, if the aforementioned cookie is set.




回答2:


On a browser with the Flash Player it loads in HTML5 mode with the following code:

<iframe sandbox="allow-same-origin allow-scripts allow-popups"
  id="foo" width="100%" height="90%"
  allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" 
  src="http://player.vimeo.com/video/28544156?api=1">
</iframe>

The sandbox prevents the HTML iframe tag from accessing any plugins including flash.

To allow the vimeo button to open the vimeo web page for the video you need the 'allow-popups' permission. It's not needed to play the video.




回答3:


This is what Vimeo says about HTML5 video: http://vimeo.com/blog:268



来源:https://stackoverflow.com/questions/6407008/what-is-a-good-way-to-embed-vimeo-videos-in-html5-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!