Home > Blockchain >  How to load the video at a specific time?
How to load the video at a specific time?

Time:05-21

The following is to load a video. The source of the video is a php script that checks to ensure user is logged in then outputs the video. This is to ensure that only people logged in can download the video. How do I specify a time to start the video position at?

<video id="test" width="640" height="360" controlsList="nodownload" controls>
  <source src="vidRedir.php?v=video" type="video/mp4">
Your browser does not support the video tag.
</video>

CodePudding user response:

Append #t=<time in seconds> to the URL. For example, setting src to vidRedir.php?v=video#t=30 will start the video at 30 seconds.

See this MDN article.

CodePudding user response:

const video = document.querySelector('video');
video.currentTime = <Your time here>

https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentTime

  • Related