VIDEO当前视频的总长度和视频进度

 1 <video
 2     id="video-active"
 3     class="video-active"
 4     width="640"
 5     height="390"
 6     controls="controls">
 7     <source src="myvideo.mp4" type="video/mp4">
 8 </video>
 9 <div id="current">0:00</div>
10 <div id="duration">0:00</div>
11 
12 js代码
13 $(document).ready(function(){
14   $("#video-active").on(
15     "timeupdate", 
16     function(event){
17       onTrackedVideoFrame(this.currentTime, this.duration);
18     });
19 }
20 
21 function onTrackedVideoFrame(currentTime, duration){
22     $("#current").text(currentTime);
23     $("#duration").text(duration);
24 }

 


posted @ 2017-11-29 18:22  朴pu客  阅读(1298)  评论(0编辑  收藏  举报