html:
<video id="video" controls autoplay="autoplay" muted> <source src="" type="video/mp4" /> Your browser does not support the video tag. </video>
js:
//监听播放时间
var video = document.getElementById('video');
//使用事件监听方式捕捉事件
video.addEventListener("timeupdate",function(){
var timeDisplay;
//用秒数来显示当前播放进度
timeDisplay = Math.floor(video.currentTime);
console.log(Math.floor(video.currentTime))
//当视频播放到 4s的时候做处理
if(timeDisplay == 4){
//处理代码
}
},false);相关文章推荐:
html5中audio(音频)的分析
html5中video(视频)元素的分析
Copyright © 2019- jfmb.cn 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务