Skip to content

Instantly share code, notes, and snippets.

@happylynx
Last active September 20, 2017 17:45
Show Gist options
  • Save happylynx/16501806388699728799e15629f2f4f7 to your computer and use it in GitHub Desktop.
Save happylynx/16501806388699728799e15629f2f4f7 to your computer and use it in GitHub Desktop.
Video playback rate bookmarklet
javascript:(()=>{const%20rateString=%s||window.prompt("Set%20video%20playback%20rate","1.0");const%20rate=parseFloat(rateString);if(isNaN(rate)){window.alert(`Selected%20playback%20rate%20"${rate}"%20cannot%20be%20parsed.`);return}[...document.querySelectorAll('video')].forEach(videoElement=>videoElement.playbackRate=rate)})()
/*
* Compatible with "keyword feature (https://superuser.com/questions/540076/how-to-add-keyword-to-bookmark-in-chrome,
* https://www-archive.mozilla.org/docs/end-user/keywords.html). Porvided the keyword is "rate", just type to address
* bar:
*
* rate 1.3
*/
(() => {
const rateString = %s || window.prompt("Set video playback rate", "1.0");
const rate = parseFloat(rateString);
if (isNaN(rate)) {
window.alert(`Selected playback rate "${rate}" cannot be parsed.`);
return
}
[...document.querySelectorAll('video')]
.forEach(videoElement => videoElement.playbackRate = rate)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment