Created
November 25, 2022 17:33
-
-
Save dbaynard/b7f38f5b2cc841fc25c4627b03e14f96 to your computer and use it in GitHub Desktop.
Toggle double video playback rate
This file contains hidden or 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
// ==UserScript== | |
// @name Toggle double playback rate | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Sets video playback rate to (3 - current rate) | |
// @author You | |
// @match *://*/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// @run-at context-menu | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Your code here... | |
[...document.querySelectorAll('video')].forEach(v => { | |
const originalRate = v.playbackRate; | |
v.playbackRate = Math.max(1,3 - originalRate); | |
console.log(`Playback rate ${originalRate} => ${v.playbackRate} for ${v.currentSrc}`); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment