1.首先确保已经安装 Git 如果是windows 推荐安装 msysgit
2.通过如下命令安装Html5Video插件
cordova plugin add https://github.com/9958/Html5Video.git
或者
phonegap plugin add https://github.com/9958/Html5Video.git
3.创建文件夹platforms\androis\res\raw\ 然后复制视频文件movie.mp4到这个目录
4.在html文件head标签中(例如:\www\movie.html)插入如下代码
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="Html5Video.js"></script>
<script>
// Wait for device API libraries to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
window.plugins.html5Video.initialize({
"myvideo" : "movie.mp4"
})
window.plugins.html5Video.play("myvideo");
}
</script>
然后在body标签中插入如下代码:
<body onload="onLoad()">
<video id="myvideo" autobuffer controls="false"></video>
</body>
此方法在红米手机上面测试通过。