title: How do I pause an HTML video and resume automatically over a loop?
body: <p>I have a 4 second long video embedded in my HTML page using video tag. I need to pause the video for 2 secs first at 2.99s, 3.44s and then at 4.00s. For that to happen the video needs to resume from previous instance.</p>
  
  <p>But after long hours of effort I haven't been able to find a solution. Thus far I have just been able to get the video paused for >=2.99s but it does not resume even after I had used setInterval function.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>var vTag = document.getElementById('video');
  
  setInterval(function() { pVideo();}, 2000);
  
  function pVideo() {
        vTag.ontimeupdate = function(e) {
        cTime = vTag.currentTime;
        (cTime &gt;= 2.9 || cTime &gt;= 3.44 || cTime &gt;= 4.00) ? vTag.pause(): vTag.play();
   };
  };
  </code></pre>
  
  <p>PS: The video is being used as a background video for header section.</p>