一、html5技術(shù)優(yōu)勢(shì)
1 關(guān)于視頻不用插件播放,點(diǎn)擊就能看
2 跨平臺(tái)、好升級(jí)、好維護(hù),開發(fā)成本相對(duì)原生APP低很多
3 對(duì)移動(dòng)的良好支持,支持手勢(shì),本地存儲(chǔ)和視頻續(xù)播等,通過H5就可以把自己的網(wǎng)站移動(dòng)化。
4 更為簡(jiǎn)潔的代碼,更好的交互
5 支持游戲開發(fā)
二、html5播放視頻
pc端還是用flash播放,但移動(dòng)端通過html5方式來做。
而html5的video標(biāo)簽只支持mp4、webm、ogg三種格式.目前所有主流瀏覽器最新版本都支持html5(除了Opera)
H.264已經(jīng)占領(lǐng)視頻市場(chǎng)的80%。如果移動(dòng)應(yīng)用視頻,建議編譯成264格式,有好的高壓縮比、高畫質(zhì)。
H.264則是由兩個(gè)組織聯(lián)合組建的聯(lián)合視頻組(JVT)共同制定的新數(shù)字視頻編碼標(biāo)準(zhǔn),它既是ITU-T的H.264,又是ISO/IEC的MPEG-4高級(jí)視頻編碼(Advanced Video Coding,AVC)的第10 部分。因此,不論是MPEG-4 AVC、MPEG-4 Part 10,還是ISO/IEC 14496-10,都是指H.264。
三、html5代碼DEMO
<!doctype html>
<html>
<meta http-equiv=Content-Type content="text/html;charset=utf-8">
<script src="JavaScript/jquery-1.7.2.min.js"></script>
<script src="JavaScript/jsPlayer.js"></script>
<script src="JavaScript/dtooltip-min.js"></script>
<link href="CSS/play.css?var=1121" rel="stylesheet" type="text/css">
<script type="text/javascript">
function browserRedirect() {
var sUserAgent= navigator.userAgent.toLowerCase();
var bIsIpad= sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp= sUserAgent.match(/midp/i) == "midp";
var bIsUc7= sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc= sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid= sUserAgent.match(/android/i) == "android";
var bIsCE= sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM= sUserAgent.match(/windows mobile/i) == "windows mobile";
if(bIsAndroid){
document.getElementById("a").style.display="block";
document.getElementById("b").style.display="none";
document.getElementById("c").style.display="none";
document.getElementById("d").style.display="none";
}
else if (bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsCE || bIsWM) {
document.getElementById("b").style.display="block";
document.getElementById("d").style.display="none";
document.getElementById("a").style.display="none";
document.getElementById("c").style.display="none";
} else if(bIsIpad) {
document.getElementById("c").style.display="block";
document.getElementById("a").style.display="none";
document.getElementById("b").style.display="none";
document.getElementById("d").style.display="none";
}
else {
document.getElementById("d").style.display="block";
document.getElementById("a").style.display="none";
document.getElementById("b").style.display="none";
document.getElementById("c").style.display="none";
}
}
window.onload=function(){browserRedirect();}
$(document).ready(
function(){
var ps=new jsPlayer("700","500","myVideo");
}
);
</script>
<head>
<title>測(cè)試移動(dòng)終端</title>
</head>
<body>
<div id="a"><p>這是安卓手機(jī)</p></div>
<div id="b"><p>這是蘋果手機(jī)</p></div>
<div id="c"><p>這是ipad</p></div>
<div id="d"><p>這是電腦</p></div>
<div style="width:700px;margin:auto;">
<!--播放器代碼開始-->
<div class="playContent">
<div class="playScreen">
<video id="myVideo">
<source src="Movie/th264.mp4" type="video/mp4">
</video>
</div>
<div class="proLines">
<div id="origin" class="arial">00:00:00</div>
<div class="line">
<div class="isPlayLine">
<div class="currentCircle">
</div>
</div>
</div>
<div id="duration" class="arial"></div>
</div>
<div class="playBars">
<div class="prevBar"><img src="Images/prev.jpg" border="0" id="prev"></div>
<div class="startBar"><img src="Images/stop.jpg" border="0" id="imgStatus"></div>
<div class="nextBar"><img src="Images/next.jpg" border="0" id="next"></div>
<div class="voiceContent">
<div class="voice">
<img src="Images/voice.jpg" id="voiceImg" border="0">
</div>
<div class="voiceline">
<div class="voicekuai"></div>
</div>
</div>
</div>
</div>
<!--播放器代碼結(jié)束-->
</div>
</body>
</html>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。