Syncing Content With HTML5 Video or Audio

This is one of the coolest Smashing Magazine articles I have seen in awhile: Syncing Content With HTML5 Video.

Using the generic HTLM5 video and audio elements and a bit of JavaScript, the timeupdate event in particular, you can synchronize script events to the media playback. The timeupdate event returns the media’s timecode, which you can then use to fire off DOM changes.

<script>
(function(){
    var v = document.getElementsByTagName('video')[0]
    var t = document.getElementById('time');
    v.addEventListener('timeupdate',function(event){
      t.innerHTML = v.currentTime;
    },false);
  })();
</script>

There are so many applications where this could be useful. You could supply show notes synchronized to a podcast, for instance, or additional information to supplement a video tutorial.

Syncing Content With HTML5 Video [Smashing Magazine]