Skip to content

Instantly share code, notes, and snippets.

@Fauntleroy
Created October 26, 2014 22:32
Show Gist options
  • Save Fauntleroy/014e94b74fd7d4d5d70c to your computer and use it in GitHub Desktop.
Save Fauntleroy/014e94b74fd7d4d5d70c to your computer and use it in GitHub Desktop.
Poopy asyncSeek method, because <video> doesn't have one by default.
var asyncSeek = function( video, time, callback ){
var doneSeeking = function(){
video.removeEventListener( 'seeked', doneSeeking );
if( callback ) callback();
};
video.addEventListener( 'seeked', doneSeeking );
video.currentTime = time;
};
module.exports = asyncSeek;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment