Skip to content

Commit 1ab02a1

Browse files
iampabberWithoutPants
andauthoredJun 22, 2022
Use hotkeys '[' and ']' to scrub video player forwards and backwards by 10% of the scene (stashapp#2678)
* Use hotkeys '[' and ']' to scrub video player forwards and backwards by 10% of the scene * Don't loop back to beginning * Add manual keybind entry Co-authored-by: WithoutPants <[email protected]>
1 parent 6cfb7fe commit 1ab02a1

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

‎ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ function handleHotkeys(player: VideoJsPlayer, event: VideoJS.KeyboardEvent) {
3737
player.currentTime(time);
3838
}
3939

40+
function seekPercentRelative(percent: number) {
41+
const duration = player.duration();
42+
const currentTime = player.currentTime();
43+
const time = currentTime + duration * percent;
44+
if (time > duration) return;
45+
player.currentTime(time);
46+
}
47+
4048
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
4149
return;
4250
}
@@ -96,6 +104,12 @@ function handleHotkeys(player: VideoJsPlayer, event: VideoJS.KeyboardEvent) {
96104
case 57: // 9
97105
seekPercent(0.9);
98106
break;
107+
case 221: // ]
108+
seekPercentRelative(0.1);
109+
break;
110+
case 219: // [
111+
seekPercentRelative(-0.1);
112+
break;
99113
}
100114
}
101115

‎ui/v2.5/src/docs/en/KeyboardShortcuts.md

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
| `p n` | Play next scene in queue |
6565
| `p p` | Play previous scene in queue |
6666
| `p r` | Play random scene in queue |
67+
| `{1-9}` | Seek to 10-90% duration |
68+
| `[` | Scrub backwards 10% duration |
69+
| `]` | Scrub forwards 10% duration |
6770

6871
### Scene Markers tab shortcuts
6972

0 commit comments

Comments
 (0)
Please sign in to comment.