HTML5<视频>在Android元 [英] HTML5 <video> element on Android

查看:89
本文介绍了HTML5<视频>在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:

  1. 您必须不是的键入的属性,调用视频时使用。
  2. 您必须手动调用video.play()
  3. 视频必须是EN coded到一些比较严格的参数;使用手刹上的iPhone设置的网络优化按钮托运通常不会获得成功。
  1. You must not use the type attribute when calling the video.
  2. You must manually call video.play()
  3. 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屋!

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