Let’s first create our HRML5 video player:
<video id="myVideo" width="640" height="480" controls> <source src="jn.mp4" type="video/mp4"> </video>
We have set the ID of our video player as “myVideo”.
document.getElementById('myVideo').currentTime = 15; // Set the starting time to 15 seconds
Now it is ready. You can run it on your browser and you can see the video starts from 15 seconds instead of starting from the beginning.
No, that’s not it.
can’t access property “currentTime”, document.getElementById(…) is null
You’re right – I had the same issue until I moved the script to the bottom.