HTML5重置视频并再次播放 [英] HTML5 reset video and play again

查看:148
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆