Created
October 26, 2012 23:45
-
-
Save pamelafox/3962254 to your computer and use it in GitHub Desktop.
Changing Playback of HTML5 Video
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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