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

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

问题描述

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



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

 < iframe class =youtube-playertype =text / htmlwidth =640height =385
src = http://www.youtube.com/embed/VIDEO_IDframeborder =0>
< / iframe>

但如果客户尚未加入

rel =noreferrer> HTML5 Trial
p>如果浏览器支持HTML5视频播放,即使用户尚未参与HTML5试用,如何强制执行HTML5视频播放? 另外,如何禁用Flash后备?



编辑:



可以通过 Youtube Video的链接,但我需要这种嵌入式视频功能。 / p>

解决方案

我找到了解决方案:



在iframe的src属性中 html5 = 1

 < ; iframe src =http://www.youtube.com/embed/dP15 ?zlyra3c HTML5 = 1\" >< / iframe中> 

视频将显示为HTML5(如果可用),或者备用到Flash播放器。


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

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>

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.

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

Otherwise how to disable the flash fallback ?

EDIT:

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

解决方案

I've found the solution :

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>

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

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

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