好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

html5 video如何实现实时监测当前播放时间(代码)

这篇 文章 给大家介绍的内容是关于ht ML 5 video如何实现实时监测当前播放时间(代码), 有一定的参考价值 , 有需要的朋友可以参考一下 ,希望对你有所帮助。

html:

<video id="video" controls auto play ="autoplay" muted>
	<source src="" ty PE ="video/mp4" />
	Your  br owser does not support the video tag.
</video>

js:

//监听播放时间
 VAR  video = document.getElementById(& # 39;video');
//使用事件监听方式捕捉事件
video.addEventListener("timeupdate",function(){
    var timeDisplay;
	//用秒数来显示当前播放 进度 
	timeDisplay = Math.floor(video. current Time);
	console. LOG (Math.floor(video.currentTime))
    //当视频播放到 4s的时候做处理
	if(timeDisplay  ==  4){
	        //处理代码
	}
},false);

相关文章推荐:

html5中audio(音频)的分析

html5中video(视频)元素的分析

以上就是html5 video如何实现实时监测当前播放时间(代码)的详细内容,更多请关注其它相关文章!

总结

以上是 为你收集整理的 html5 video如何实现实时监测当前播放时间(代码) 全部内容,希望文章能够帮你解决 html5 video如何实现实时监测当前播放时间(代码) 所遇到的问题。

如果觉得 网站内容还不错, 推荐好友。

查看更多关于html5 video如何实现实时监测当前播放时间(代码)的详细内容...

  阅读:33次