HTML5 重置视频并再次播放 [英] HTML5 reset video and play again
本文介绍了HTML5 重置视频并再次播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 timesheets.js 并希望在滑块处于活动状态时播放 HTML5 视频.我正在使用此代码:
I'm using timesheets.js and want to play a HTML5 video when the slider is active. I'm using this code:
if (document.getElementById("v_"+element.id))
{
video = document.getElementById('v_'+element.id)
video.currentTime = 0;
video.play();
}
如果我不使用video.currentTime = 0;它大部分时间都有效(除非视频太长).我必须重置视频,以便从头开始播放.现在它会重置视频,但不会播放.有什么想法吗?
If I'm not using "video.currentTime = 0; it works most of the time (except when videos are too long). I have to reset the video so it plays from the beginning. Now it resets the video, but it doesn't play. Any ideas?
推荐答案
这就解决了!我将 video.currentTime = 0;
更改为:
This solved it! I changed the video.currentTime = 0;
to:
video.load();
这篇关于HTML5 重置视频并再次播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文