I want to set the time position of a video in HTML5. The time should be set like this:
function settime(){
var video = document.getElementById(\"video1\"
I finally figured out an answer! Chrome requires you to set the currentTime as a String, and not as a number.
function settime() {
var video = document.getElementById("video1");
console.log(video.currentTime); // output 0
video.currentTime = 10.0;
console.log(video.currentTime); // output 0 for some chrome users or 10 for firefox and others
video.currentTime = "10.0";
console.log(video.currentTime); // output 10
}
settime();
Click play to start the audio at 10 s.