feat: shift + arrows to seek track

This commit is contained in:
talksik
2026-04-13 09:31:25 -07:00
parent 3659863647
commit 1579de8c6d
@@ -36,6 +36,7 @@ function getReactions(particle: Particle): Record<string, string[]> | undefined
const EXIT_DELAY_MS = 5000; const EXIT_DELAY_MS = 5000;
const EXIT_TICK_MS = 100; const EXIT_TICK_MS = 100;
const SEEK_DELTA_SEC = 5;
type PlaybackStatus = "idle" | "playing" | "ended"; type PlaybackStatus = "idle" | "playing" | "ended";
@@ -99,6 +100,7 @@ const STREAM_VIEW_KEYBINDINGS: KeybindingGroup[] = [
bindings: [ bindings: [
{ keys: ["Hold", "Space"], description: "Pause" }, { keys: ["Hold", "Space"], description: "Pause" },
{ keys: ["Hold", "Shift"], description: "1.5× speed" }, { keys: ["Hold", "Shift"], description: "1.5× speed" },
{ keys: ["Shift", "←", "→"], description: "Seek ±5s" },
], ],
}, },
{ {
@@ -269,11 +271,17 @@ function StreamViewInner({ path, streamParticle }: StreamViewProps) {
switch (e.key) { switch (e.key) {
case "ArrowRight": case "ArrowRight":
e.preventDefault();
if (!e.shiftKey || !mediaRef.current?.seek(SEEK_DELTA_SEC)) next();
break;
case "ArrowDown": case "ArrowDown":
e.preventDefault(); e.preventDefault();
next(); next();
break; break;
case "ArrowLeft": case "ArrowLeft":
e.preventDefault();
if (!e.shiftKey || !mediaRef.current?.seek(-SEEK_DELTA_SEC)) prev();
break;
case "ArrowUp": case "ArrowUp":
e.preventDefault(); e.preventDefault();
prev(); prev();