title: HTML5/Javascript Video Event Behaviour In Chrome 33.0.1750.154
body: <p>I have a <code>video</code> element which I am dynamically controlling with <code>javascript</code>. It has been working great. Today I noticed something strange.</p>
  
  <p>I have attached the following event listeners.</p>
  
  <pre><code>function registerListeners(listen) {
      listen.addEventListener('canplaythrough', canStartPlayback);
      listen.addEventListener('ended', onFinish);
      listen.addEventListener('loadeddata', onLoadComplete);
      listen.addEventListener('playing', onPlay);
      listen.addEventListener('error', mediaError);
  }
  </code></pre>
  
  <p>And the code for <code>canStartPlayback</code> <code>onFinish</code> and <code>onPlay</code> is as follows.</p>
  
  <pre><code>function canStartPlayback() {
      if (!playing) {
          playing = true;
          $('.module-content-video-loader').stopSpin();
          $('.module-content-video-loader').hide();
          media.play();
      }
  }
  
  function onFinish() {
      if (playing) {
          playing = false;
          media.pause();
          media.currentTime = 0.0;
      }
  }
  
  function onPlay() {
      playing = true;
      if (!pending) {
          $('#skip').show();
      }
  }
  </code></pre>
  
  <p>Now, I am currently finding that after <code>onFinish</code> has completed, I am immediately seeing <code>canStartPlayback</code> being fired again.</p>
  
  <p>This is a description of the <code>canplaythrough</code> from Mozilla </p>
  
  <p><code>canplaythrough</code>    Sent when the ready state changes to CAN_PLAY_THROUGH, indicating that the entire media can be played without interruption, assuming the download rate remains at least at the current level. <strong>Note: Manually setting the <code>currentTime</code> will eventually fire a <code>canplaythrough</code> event in firefox. Other browsers might not fire this event.</strong></p>
  
  <p>I was under the impression, and have been seeing that <code>canplaythrough</code> is only fired once. Has chrome changed this recently and has anyone else found this to be occurring?</p>