Skip to content

Instantly share code, notes, and snippets.

@pamelafox
Created October 26, 2012 23:45
Show Gist options
  • Save pamelafox/3962254 to your computer and use it in GitHub Desktop.
Save pamelafox/3962254 to your computer and use it in GitHub Desktop.
Changing Playback of HTML5 Video
this.isSetSpeedEnabled = function() {
if(typeof(this.mediaElement) === 'object'
&& this.mediaElement !== null
&& typeof(this.mediaElement.playbackRate) === 'number'
&& this.mediaElement.playbackRate > 0){
return true;
}
else{
return false;
}
}
this.setSpeed = function(speed) {
if(this.isSetSpeedEnabled()) {
this.mediaElement.playbackRate = speed;
}
}
this.getSpeed = function(speed) {
if(this.isSetSpeedEnabled()) {
return this.mediaElement.playbackRate;
} else {
return 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment