NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name HTML5 Video Playback Speed Control Keyboard Shortcut International // @namespace HTML5VideoPlaybackSpeedControlKeyboardShortcutInternational // @description Add keyboard shortcuts to decrease (CTRL+,), increase (CTRL+.), and reset (CTRL+;) HTML5 video playback rate. Available playback speeds are between 0.25 to 2.0 inclusive in 0.25 increments. Speed of 1.0 is used when resetting playback speed. Note: the video playback speed menu selection on YouTube will not be affected. // @version 1.0.1 // @author SThorn // @copyright 2018, Newt300 (https://openuserjs.org/users/Newt300) // @updateURL https://openuserjs.org/meta/Newt300/HTML5_Video_Playback_Speed_Control_Keyboard_Shortcut_International.meta.js // @include http://*/* // @include https://*/* // @grant none // @license MIT // ==/UserScript== addEventListener("keydown", function(ev) { var ele = document.querySelector("VIDEO"), rate; if (ele && ev.ctrlKey) { rate = rate = ele.playbackRate; if ((ev.key === ",") || (ev.key === "б") || ev.keyCode === 188) { rate -= 0.25; if (rate < 0.25) rate = 0.25; } else if ((ev.key === ".") || (ev.key === "ю") || ev.keyCode === 190) { rate += 0.25; if (rate > 2) rate = 2; } else if ((ev.key === ";") || (ev.key === "ж") || ev.keyCode === 186 || ev.keyCode === 59) { rate = 1; } rate = Math.trunc(rate * 4) / 4; ele.playbackRate = rate; } });