mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-21 14:47:41 +01:00
Refactor video playback speed options
This commit is contained in:
parent
9f7432450b
commit
c3494c2f84
1 changed files with 3 additions and 5 deletions
|
@ -93,12 +93,10 @@ export function KeyboardEvents() {
|
|||
|
||||
// Video playback speed
|
||||
if (k === ">" || k === "<") {
|
||||
const playbackRates = [0.25, 0.5, 1, 1.5, 2];
|
||||
const idx = playbackRates.indexOf(
|
||||
dataRef.current.mediaPlaying?.playbackRate,
|
||||
);
|
||||
const options = [0.25, 0.5, 1, 1.5, 2];
|
||||
const idx = options.indexOf(dataRef.current.mediaPlaying?.playbackRate);
|
||||
const nextIdx = idx + (k === ">" ? 1 : -1);
|
||||
const next = playbackRates[nextIdx];
|
||||
const next = options[nextIdx];
|
||||
if (next) dataRef.current.display?.setPlaybackRate(next);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue