Skip to content

Instantly share code, notes, and snippets.

@caiw
Created July 11, 2017 18:05
Show Gist options
  • Select an option

  • Save caiw/c27183117e3bc2b721c9fba22e14b7d7 to your computer and use it in GitHub Desktop.

Select an option

Save caiw/c27183117e3bc2b721c9fba22e14b7d7 to your computer and use it in GitHub Desktop.

Revisions

  1. caiw created this gist Jul 11, 2017.
    17 changes: 17 additions & 0 deletions faster_audio_scrubber.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // http://cai.zone/2013/07/a-quick-javascript-hack-to-fake-adjustin-html5-audio-elements-timeupdate-event-frequency/

    var audio_clock;

    $(audiohtml).bind("timeupdate", onAudioUpdate);
    $(audiohtml).bind("play", function(){
    audio_clock = setInterval(function(){
    onAudioUpdate();
    }, 100);
    });
    $(audiohtml).bind("pause", function(){
    clearInterval(audio_clock);
    });

    function onAudioUpdate() {
    // Move the elements here
    }