title: How to set a Html 5 video starttime and endtime?
body: <p>How to set a Html 5 video starttime and endtime?</p>
  
  <p>I want to start and stop a html5 video at a certain time with the number keys.</p>
  
  <pre><code>$(document).ready(function() {
  
      var $vid = document.getElementById("video1");
      $vid.width = $( window ).width();
  
  $(document).keypress(function(e) {
  var code = e.keyCode;
  
  if(code == 49) {
      $vid.currentTime = 0;
      $vid.play();
      $vid.addEventListener("timeupdate", function() {
         if ($vid.currentTime &gt;= 2) {
              $vid.pause();
          }
      }, false);
   }
  
  if(code == 50) {
      $vid.currentTime = 2;
      $vid.play();
      $vid.addEventListener("timeupdate", function() {
         if ($vid.currentTime &gt;= 4) {
              $vid.pause();
          }
      }, false);
  }
  });
  
  });
  </code></pre>
  
  <p>This is my script so far..
  I can go from code 50 to code 49 but not from 49 to 50!
  How to fix this?</p>