ホームページ > 記事 > ウェブフロントエンド > html+vlc で複数の動画を再生_html/css_WEB-ITnose
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>视频剪辑</title> </head> <body> <div style="width:100%"> <div style="width:30%;float:left"> <object type='application/x-vlc-plugin' id='vlc_1' events='True' width="360" height="270" codebase="axvlc.cab"> <param name='mrl' value='http://118.85.193.213/mobi/vod/vod_pub/st02/2015/07/28/Q1M_2020878286.3gp' /> <param name='volume' value='50' /> <param name='autoplay' value='true' /> <param name='loop' value='false' /> <param name='fullscreen' value='false' /> </object> 测试计时<span id="span_1"></span>秒 </div> <div style="width:30%;float:left"> <object type='application/x-vlc-plugin' id='vlc_2' events='True' width="360" height="270" codebase="axvlc.cab"> <param name='mrl' value='http://118.85.193.213/mobi/vod/vod_pub/st02/2015/07/28/Q600_2020877459.3gp' /> <param name='volume' value='50' /> <param name='autoplay' value='true' /> <param name='loop' value='false' /> <param name='fullscreen' value='false' /> </object> 测试计时<span id="span_2"></span>秒 </div> <div style="width:30%;float:left"> <object type='application/x-vlc-plugin' id='vlc_3' events='True' width="360" height="270" codebase="axvlc.cab"> <param name='mrl' value='http://118.85.193.213/mobi/vod/vod_pub/st02/2015/07/28/Q350_2020877450.3gp' /> <param name='volume' value='50' /> <param name='autoplay' value='true' /> <param name='loop' value='false' /> <param name='fullscreen' value='false' /> </object> 测试计时<span id="span_3"></span>秒 </div> <div style="width:30%;float:left"> <object type='application/x-vlc-plugin' id='vlc_4' events='True' width="360" height="270" codebase="axvlc.cab"> <param name='mrl' value='http://118.85.193.213/mobi/vod/vod_pub/st02/2015/07/28/M200_2020877455.3gp '/> <param name='volume' value='50' /> <param name='autoplay' value='true' /> <param name='loop' value='false' /> <param name='fullscreen' value='false' /> </object> 测试计时<span id="span_4"></span>秒 </div> <div style="width:30%;float:left"> <object type='application/x-vlc-plugin' id='vlc_5' events='True' width="360" height="270" codebase="axvlc.cab"> <param name='mrl' value='http://118.85.193.213/mobi/vod/vod_pub/st02/2015/07/28/Q200_2020877449.3gp' /> <param name='volume' value='50' /> <param name='autoplay' value='true' /> <param name='loop' value='false' /> <param name='fullscreen' value='false' /> </object> 测试计时<span id="span_5"></span>秒 </div> <div style="width:30%;float:left"> <object type='application/x-vlc-plugin' id='vlc_6' events='True' width="360" height="270" codebase="axvlc.cab"> <param name='mrl' value='http://118.85.193.213/mobi/vod/vod_pub/st02/2015/07/28/M100_2020877452.3gp' /> <param name='volume' value='50' /> <param name='autoplay' value='true' /> <param name='loop' value='false' /> <param name='fullscreen' value='false' /> </object> 测试计时<span id="span_6"></span>秒 </div> </div></body></html>
<script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> var vlcArray=new Array() $(function() { for(var i=1;i<7;i++){ var vlc_id="vlc_"+i; var obj = new vlcObject(); obj.vlc=document.getElementById(vlc_id); vlcArray.push(obj); } begin(); }) function begin(){ for(var i=1;i<7;i++){ var index=i-1; obj=vlcArray[index]; //state =3 表示正在播放 if(obj.vlc.input.state==3){ if (obj.isPlay==1){ //观看时长赋值 obj.seeTime=(new Date().getTime() - obj.beginTime)/1000+obj.stopTime; } else{ obj.isPlay=1; obj.beginTime=new Date().getTime(); obj.stopTime=obj.seeTime; } } //state =4 表示暂停播放;state =5 表示停止播放 state =2 表示缓冲 if (obj.vlc.input.state==4 || obj.vlc.input.state==5 || obj.vlc.input.state==2){ obj.isPlay=0; } setSeeTime(obj,i); } setTimeout("begin()",1000); } function setSeeTime(obj,id){ var span_id="#span_"+id; $(span_id).html(parseInt(obj.seeTime)); } //自定义vlc对象 function vlcObject() { var temp = new Object; temp.vlc = new Object; //观看时长 temp.seeTime=0; //开始播放时间 temp.beginTime=0 temp.isPlay=0; //暂停前观看的时长 temp.stopTime=0; return temp; } </script>
著作権声明: この記事はブロガーによるオリジナル記事、無断転載は禁止ですブロガーの許可。