1.网页代码,就一个video 控件:
<!DOCTYPE html>
<html>
<head>
<title>HTML5视频播放器: http://218.206.204.71/app/public/media/BHSJ.mp4</title>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript" src="jquery.min.js"></script>
<style>
body {
margin: 0;
padding: 0;
background: #222;
-webkit-overflow: hidden;
overflow: hidden;
}
#sdupPlayer {
width: 100%;
}
</style>
</head>
<body>
<video id="sdupPlayer" controls>
<source src="http://218.206.204.71/app/public/media/BHSJ.mp4" type="video/mp4"/>
</video>
<script>
var autoResize = function() {
var clientHeight = document.documentElement.clientHeight;
$("#sdupPlayer").css("height", clientHeight + "px");
};
$(document).ready(function() { autoResize(); });
$(window).resize(function() { autoResize(); });
var playVideo = function() {
var player = $("#sdupPlayer")[0];
if (player) {
player.play();
}
};
</script>
</body>
</html>
2. android 客户端代码:
注意点:
a).http://developer.android.com/reference/android/webkit/WebView.html 中
HTML5 Video support
WebChromeClient
. For full screen support, implementations of
onShowCustomView(View, WebChromeClient.CustomViewCallback)
and
onHideCustomView()
are required,
getVideoLoadingProgressView()
is optional.
<video controls="controls" autoplay="autoplay"
>