7

I am trying to a HTML5 make a video start from a given current time. I am using a javascript function who does the follows:

function goToMinute(params) {
    var video = document.getElementById("video_tags");
    video.currentTime = 100;
    video.play();
}

This function is called on click since I have a list of positions and when I click on of them I pass the position time through parameter and then I want to start video from there.

I already checked and the params is giving me the number that I want, like 10.10 for instance (in seconds).

Since it was not working I tried to put a value there like I showed in the piece of code before:

    video.currentTime = 100;

Debugging I found out that my video.currentTime attribution is setting video.currentTime = 0 and video starts from the beginning. Why is this happening?

Code that calls the function:

           <th><a onclick="goToMinute(<%= manual.time %>)"><%= manual.time %></a></th>

Also I have added a picture with the debug on chrome:

I can also add that already tried in Firefox, Chrome and Edge.

heisenberg
  • 1,172
  • 6
  • 14
  • 31

0 Answers0