强制 HTML5 youtube 视频 [英] Force HTML5 youtube video

查看:31
本文介绍了强制 HTML5 youtube 视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于 Youtube API 博客 他们正在试验新的 HTML5 视频播放器.

Regarding the Youtube API Blog they are experimenting with their new HTML5 Video Player.

显然要在 html5 中播放视频,您必须使用 iframe 嵌入代码:

Apparently to play a video in html5, you have to use the iframe embedding code :

<iframe class="youtube-player" type="text/html" width="640" height="385"
  src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
</iframe>

但是如果客户端没有加入HTML5 Trial,玩家会自动退回到即使客户端的浏览器支持 HTML5 视频,Flash 播放器也是如此.

But if the client has not joined the HTML5 Trial, the player will automatically fall back into the flash player even if the client's browser is HTML5 video capable.

如果浏览器支持,如何强制播放 HTML5 视频,即使用户尚未参与 HTML5 试用?

How to force the HTML5 video playback if the browser supports it, even if the users are not yet involved in the HTML5 Trial?

否则如何禁用 Flash 回退?

Otherwise how to disable the flash fallback?

可以通过 链接到 Youtube 视频,但我需要这种嵌入视频的功能.

It's possible to force HTML player through links to Youtube Video, but I need this kind of feature for embedded videos.

推荐答案

我找到了解决方案:

您必须在 iframe 的 src 属性中添加 html5=1 :

You have to add the html5=1 in the src attribute of the iframe :

<iframe src="http://www.youtube.com/embed/dP15zlyra3c?html5=1"></iframe>

如果可用,视频将显示为 HTML5,或回退到 Flash 播放器.

The video will be displayed as HTML5 if available, or fallback into flash player.

这篇关于强制 HTML5 youtube 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆