Greasy Fork is available in English.
Enables you to change the speed of video and audio with hotkeys (even if the media is inside an iframe)
Enables you to change the speed of video and audio with hotkeys (even if the media is inside an iframe)
This userscript enables you to change the speed of video and audio with the PrintScreen, ScrollLock, Pause and Insert keys. It does this both for media in the page (HTML5 video or audio) or embeded media inside an IFRAME element. It was tested in both GreaseMonkey and TamperMonkey, although in GreaseMonkey some embeds won't change the speed, because of a bug in GreaseMonkey 4's IFRAME handling. So it works best on Tampermonkey or Violentmonkey.
You can freely change the keys or the speeds as you like. These are the ones that work best for me.
Known issue: In Firefox, a few sites (such as Twitter) block the script-managers from applying the userscript to the page. To workaround that you have to disable the security.csp.enable
setting in about:config (not recommended for security reasons). An alternative workaround is using the bookmarklet below on these sites, it is the same code as the userscript, but shorter and adapted to be used as a bookmarklet which is run whenever you click on it.
javascript:(function(){function changeSpeed(e,n="absolute"){const a=document.querySelectorAll("video, audio");for(i=0;i<a.length;i++)a[i].playbackRate="absolute"==n?e:a[i].playbackRate+e;for(i=0;i<window.frames.length;i++)window.frames[i].postMessage("changeSpeed("+e+",'"+n+"')","*")}document.onkeyup=function(e){e.shiftKey&&"Pause"==e.key?changeSpeed(.25,"relative"):e.shiftKey&&"PrintScreen"==e.key?changeSpeed(-.25,"relative"):"Pause"==e.key?changeSpeed(.5,"relative"):"PrintScreen"==e.key?changeSpeed(-.5,"relative"):e.shiftKey&&"ScrollLock"==e.key?changeSpeed(1):e.shiftKey&&"Insert"==e.key?changeSpeed(3):!e.ctrlKey||"Cancel"!=e.key&&"ScrollLock"!=e.key?"ScrollLock"==e.key?changeSpeed(2):e.ctrlKey&&"Insert"==e.key?changeSpeed(16):"Insert"==e.key&&changeSpeed(8):changeSpeed(4)},window.self!=window.top&&window.addEventListener("message",function(e){try{eval(e.data)}catch(e){}});})();