);
      document.addEventListener("mouseup", handleMouseUp);
      document.addEventListener("touchmove", handleMouseMove);
      document.addEventListener("touchend", handleMouseUp);
      handleMouseMove(e);
      //so we don't trigger mousedown on player
      e.stopPropagation();
    }
    progressBar.onmousemove = function(e) {
      var newTime = calculateDistance(e, progressBar) * player.duration;
      // Don't let video end while scrubbing.
      if (newTime === player.duration) { newTime = newTim