HTML5 video: how to seek to a timestamp without loading whole video from start

Viewed 31

I'm writing an application in which users need to skip to sections of videos. The code below works but is very slow because the video loads from the beginning. Is there a way to skip to a section of a video without loading it from the beginning?

Can this be done purely on the client side with javascript or do I need to implement a custom back end solution as well?

<video id="video1" src="video.mov" type="video/quicktime" controls></video>

<button onclick="setCurTimeVideo(92)" type="button" value="92"> Skip to 1:32 </button>

<script>        
      var vid1 = document.getElementById("video1");

      function setCurTimeVideo(value) {
        vid1 = document.getElementById("video1");
        vid1.currentTime = value;
      };
</script>
0 Answers
Related