Skip to content

Instantly share code, notes, and snippets.

@Lewiscowles1986
Last active December 6, 2017 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lewiscowles1986/341778bac770fb953fe16512f8858e88 to your computer and use it in GitHub Desktop.
Save Lewiscowles1986/341778bac770fb953fe16512f8858e88 to your computer and use it in GitHub Desktop.
Simple way to set html5 playback rate. Should probably be minified as a bookmarklet
(function(){
function setAllMediaPlaybackSpeed(speed) {
[].slice.call(document.querySelectorAll('audio,video')).map( function(e, idx) {
e.playbackRate = speed;
});
}
var userRequestedRate = parseFloat(prompt("What playback rate would you like?"),10);
if(!isNaN(userRequestedRate)) {
setAllMediaPlaybackSpeed(userRequestedRate);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment