Stichy Stichy - 6 months ago 78
Javascript Question

HTML5 reset video and play again

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();
}


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?

Answer

This solved it! I changed the video.currentTime = 0; to:

video.load();