Skip to content

Instantly share code, notes, and snippets.

@MeoMix
Created July 21, 2015 01:36
Show Gist options
  • Save MeoMix/1edd7fe1733cdd186b0a to your computer and use it in GitHub Desktop.
Save MeoMix/1edd7fe1733cdd186b0a to your computer and use it in GitHub Desktop.
_setCurrentTime: function(playerState, currentTimeHighPrecision, timestamp) {
// If the player is playing then currentTimeHighPrecision will be slightly out-of-sync due to the time it takes to request
// the information. So, subtract an offset of the time it took to receive the message.
if (playerState === PlayerState.Playing) {
var offset = performance.now() - timestamp;
currentTimeHighPrecision -= offset * .001;
}
this.el.currentTime = currentTimeHighPrecision;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment