title: video player with keyboard controls
body: <p>I am trying to build a video player with keyboard controls.
  Can some body help me with the rewind feature
  I want the video to rewind when I press left
  This is the code so far. The play and pause button works</p>
  
  <p>I got an error telling Cannot read property 'currentTime' of null</p>
  
  <pre><code>var intervalForward;
  var intervalRewind;
  
  function handleKeyCode(kc) {
  switch(kc) {
  
      case VK_LEFT:
          keyFunction("LEFT");
          return true;
          break;
  
      case VK_PLAY:
          keyFunction("PLAY");
          return true;
          break;
      case VK_PAUSE:
          keyFunction("PAUSE");
          return true;
          break;
  
  
      case VK_REWIND:
          keyFunction("REWIND");
          return true;
          break;
      default:
          return false;
  }
  }
  
  function keyFunction(e) {
  switch(e) {
      case "OK":
  
  
          document.getElementById("myvideo").play();
  
          break;
      case "BACK":
  
          document.getElementById("myvideo").pause();
  
          break;
      case "LEFT":
  
      document.getElementById(myvideo).currentTime == 0;
  
               break;
  
      }
  }
  
  function init() {
  
  var script2 = document.createElement('script');
  script2.setAttribute('src', 'keycodes.js');
  document.body.appendChild(script2);
  
  document.addEventListener("keydown", function(e) {
      if (handleKeyCode(e.keyCode))
          e.preventDefault();
  }, false);
  
  }
  </code></pre>