js获取video的播放时长

 
 1 setTimeout(function () {
 2               var vid = document.getElementById("videoIntro");
 3               var currentTime=vid.currentTime.toFixed(1);
 4               if(currentTime==1.2){
 5                   //触发
 6                   return false;
 7               }
 8               console.log(currentTime);
 9               getvideoprogress();
10           }, 1000);
11   function getvideoprogress() {
12     setTimeout(function () {
13               var vid = document.getElementById("videoIntro");
14               var currentTime=vid.currentTime.toFixed(1);
15               if(currentTime==1.2){
16                   //触发
17                   return false;
18               }
19               console.log(currentTime);
20               getvideoprogress();
21           }, 1000);
22   }

猜你喜欢

转载自www.cnblogs.com/chenlove/p/9284818.html