android - 嵌入在 html5 中的 mp4 的跨平台语法

标签 android html internet-explorer video ffmpeg

下面的代码在 firefox 中生成正确嵌入的视频,但无法在 internet explorer 中正确显示或在 android .我将所有浏览器设置为自动更新,因此它们始终运行最新版本。

In `internet explorer`, the code below leaves a large blank space where the  
video should be.  The user has to hover over the large blank space before the  
controls become visible.  

In `android`, the code below produces an unusable/unclickable area, and the  
user has to greatly zoom the focus to get the small start button to become  
big enough to click to start the video.  

However, in `firefox`, the code below shows the first frame of the video,  
which you can click to start the video.  

如何更改下面的代码以使所有这三个浏览器在页面加载时显示第一帧,并在用户单击第一帧时启动视频?

这里是 a link to the video file on a file sharing site .

这里是 ffmeg视频处理代码:
ffmpeg -y -i SourceFile.mp4 -s 1280x720 -c:v libx264 -b 3M -strict -2 -movflags faststart DestFile.mp4

感谢 offbeatmammal让我走到这一步。
这里是 html5在网页浏览器中嵌入视频的代码:
<video width="640" height="480" controls>
    <source src="somefile.mp4" type="video/mp4">
    Your browser does not support the video tag.
</video>

最佳答案

Android 浏览器需要一些特殊处理才能支持 MPEG-4/H.264 视频格式:

http://www.broken-links.com/2010/07/08/making-html5-video-work-on-android-phones/

您还可以将视频元素的 preload 属性设置为“auto”,以便在页面加载后通过 javascript 预加载视频:

document.getElementsByTagName("video").preload = "auto";

关于android - 嵌入在 html5 中的 mp4 的跨平台语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27881971/

相关文章:

java - ZXing Barcode Scanner 如何兼容 Android 2.2 及以上版本

javascript - 使用 jquery 将 css 类添加到行的特定列

Javascript 从弹出输入单选类中获取值

javascript - IE8 绝对/相对定位元素不显示

java - Tomcat 管理器应用程序 : Deploy fail when using IE, Chrome 工作

css - 如何在 Internet Explorer 9/10 和 FF 中提高调整后的图像质量

java - 从 v4 升级项目后找不到类 'android.support.v7.app.NotificationCompat$Builder'

android 2.3.3 固定页脚问题

android - Android 2.2 有多可靠

javascript - 基于 Canvas 大小的 HTML5 Canvas 字体大小