HTML5&LT;视频&GT;在Android元 [英] HTML5 <video> element on Android
问题描述
据
<一个href="http://developer.android.com/sdk/android-2.0-highlights.html">http://developer.android.com/sdk/android-2.0-highlights.html
Android 2.0的应该支持HTML5视频元素。我一直没能得到这个使用摩托罗拉Droid上班,都没有能够成功地查看任何HTML5视频示例页面在那里的视频。由于当前为QuickTime或闪光灯不支持,这是唯一的其他东西我能想到的在网页中嵌入mp4视频。有没有人有任何运气吗?
Android 2.0 should support the HTML5 video element. I haven't been able to get this to work using a Motorola Droid, and haven't been able to successfully view a video on any of the HTML5 video example pages out there. Since there currently isn't support for QuickTime or Flash, this is the only other thing I can think of for embedding mp4 video in a web page. Has anyone had any luck with this?
推荐答案
我刚刚做这个一些试验,并从我可以告诉你需要三样东西:
I've just done some experimentation with this, and from what I can tell you need three things:
- 您必须不是的键入的属性,调用视频时使用。
- 您必须手动调用video.play()
- 视频必须是EN coded到一些比较严格的参数;使用手刹上的iPhone设置的网络优化按钮托运通常不会获得成功。
- You must not use the type attribute when calling the video.
- You must manually call video.play()
- The video must be encoded to some quite strict parameters; using the iPhone setting on Handbrake with the 'Web Optimized' button checked usually does the trick.
有一个在此页面上的演示: http://broken-links.com/tests/video/一>
Have a look at the demo on this page: http://broken-links.com/tests/video/
这工作,AFAIK,在所有的视频桌面浏览器,iPhone和Android。
This works, AFAIK, in all video-enabled desktop browsers, iPhone and Android.
下面的标记:
<video id="video" autobuffer height="240" width="360">
<source src="BigBuck.m4v">
<source src="BigBuck.webm" type="video/webm">
<source src="BigBuck.theora.ogv" type="video/ogg">
</video>
和我有这样的JS:
var video = document.getElementById('video');
video.addEventListener('click',function(){
video.play();
},false);
我测试了在三星Galaxy S,它工作正常。
I tested this on a Samsung Galaxy S and it works fine.
这篇关于HTML5&LT;视频&GT;在Android元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!