Skip to content

Instantly share code, notes, and snippets.

@bessangel
Created July 23, 2021 16:33
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 bessangel/156198b3817ce28883c235b1c109f024 to your computer and use it in GitHub Desktop.
Save bessangel/156198b3817ce28883c235b1c109f024 to your computer and use it in GitHub Desktop.
html5 video rateX (by Tampermonkey )
// ==UserScript==
// @name video rateX
// @namespace http://tampermonkey.net/
// @version 0.1
// @description vdeio rateX
// @author You
// @match https://*/*
// @match http://*/*
// @match https://*.youtube.com/watch?v=*
// @match https://*.instagram.com/*
// @match https://*.facebook.com/*
// @grant none
// ==/UserScript==
/*
Press Alt+5 to increase playbackRate and Alt+4 to decrease
*/
(function() {
'use strict';
setTimeout(()=>{
document.addEventListener('keydown', (e)=>{
if( e.altKey & (e.key == '5' || e.key == '4') ){
document.querySelectorAll('video').forEach( o=>{
o.playbackRate=o.playbackRate +(e.key == '5' ?0.5: -0.5);
console.log('Up speed:'+o);
document.body.insertAdjacentHTML('beforeend','<h1 id="_newRate" style="position:absolute; top:100px;left:200px; background-color:green;color:white;padding:1em;">x ' + o.playbackRate + '</h1>');
setTimeout( ()=>{ document.getElementById('_newRate').remove() }, 3000 );
} );
}
});
}, 2000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment