以 HTML5 格式嵌入 Vimeo 视频的好方法是什么?

发布于 2024-11-16 02:53:15 字数 49 浏览 5 评论 0原文

我不想嵌入 Flash 格式的 Vimeo 视频。如何将它们嵌入 HTML5 格式?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

何处潇湘 2024-11-23 02:53:15

在带有 Flash Player 的浏览器上,它使用以下代码以 HTML5 模式加载:

<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>

沙箱阻止 HTML iframe 标记访问包括 flash 在内的任何插件。

要允许 vimeo 按钮打开视频的 vimeo 网页,您需要“允许弹出窗口”权限。不需要播放视频。

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.

口干舌燥 2024-11-23 02:53:15

他们实际上通过cookie启用了HTML5,所以我认为你不能直接链接到HTML5版本。这是他们用来在 Flash 和 HTML5 之间切换的 JS 代码:

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

编辑:

同样关于嵌入,官方博客文章指出:

目前仅适用于 Vimeo.com,嵌入代码仍为 Flash

Edit 2:

实际上,这是一个旧的说法,不再正确了。如果设置了上述 cookie,新嵌入实际上会在不支持 Flash(例如 iPad 或 iPod)的设备上自动使用 HTML5。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文