← Commit history

adom-video: YouTube key behavior restored: < > (also comma/period with Shift) change speed while playing and never pause; , . step a frame only while paused

John Lauer ·7f6b709a3b ·1d ago ·parent d7f26c9
1 file changed +6−6
widgets/video-widget.js+6−6
@@ -87,7 +87,7 @@   const SHORTCUTS = [     ['Play / pause', 'Space or K'], ['Back 10 s / forward 10 s', 'J / L'], ['Back 5 s / forward 5 s', '← / →'],     ['Volume up / down', '↑ / ↓'], ['Mute', 'M'], ['Jump to 0% to 90%', '0 to 9'], ['Start / end', 'Home / End'],-    ['Previous / next frame (pauses)', ', / .'], ['Slower / faster (0.25x to 4x)', '< / >'], ['2x while held', 'Hold the mouse on the video'],+    ['Previous / next frame (while paused)', ', / .'], ['Slower / faster (0.25x to 4x)', '< / >'], ['2x while held', 'Hold the mouse on the video'],     ['Previous / next chapter', 'Ctrl + ← / →'], ['Previous / next video on the page', 'Shift + P / Shift + N'],     ['Captions on / off', 'C'], ['Caption size', '+ / −'], ['Caption text opacity', 'O'], ['Caption background opacity', 'W'],     ['Fullscreen', 'F or double-click'], ['Open large in a new tab', 'T'], ['Picture-in-picture', 'I'], ['Close menu / exit', 'Esc'],@@ -544,7 +544,7 @@     // one frame at the video's measured frame rate (default 30 fps), landing mid-frame so rounding never repeats one     frame(n) {       const v = this.v, f = this._fdt || 1 / 30;-      if (!v.paused) v.pause();+      if (!v.paused) return;       const k = Math.floor(v.currentTime / f + 0.02) + n;       v.currentTime = clamp((k + 0.5) * f, 0, v.duration || 0);       this._started(); this._show();@@ -943,10 +943,10 @@         else if (k === 'ArrowRight') this.seekBy(5, true);         else if (k === 'ArrowUp') this.volBy(0.05);         else if (k === 'ArrowDown') this.volBy(-0.05);-        else if (k === ',') this.frame(-1);-        else if (k === '.') this.frame(1);-        else if (k === '<') this.speedStep(-1);-        else if (k === '>') this.speedStep(1);+        else if (k === '<' || (k === ',' && e.shiftKey)) this.speedStep(-1);+        else if (k === '>' || (k === '.' && e.shiftKey)) this.speedStep(1);+        else if (k === ',' && v.paused) this.frame(-1);+        else if (k === '.' && v.paused) this.frame(1);         else if (k === 'Home') this.seekTo(0);         else if (k === 'End') this.seekTo(v.duration || 0);         else if (/^[0-9]$/.test(k)) this.seekTo((v.duration || 0) * Number(k) / 10);