mirror of
https://github.com/movie-web/movie-web.git
synced 2025-01-01 10:35:59 +00:00
Add check for non existent index.
This commit is contained in:
parent
27b28a6d96
commit
5e52ea8e8f
|
@ -94,7 +94,8 @@ export function KeyboardEvents() {
|
|||
// Video playback speed
|
||||
if (k === ">" || k === "<") {
|
||||
const options = [0.25, 0.5, 1, 1.5, 2];
|
||||
const idx = options.indexOf(dataRef.current.mediaPlaying?.playbackRate);
|
||||
let idx = options.indexOf(dataRef.current.mediaPlaying?.playbackRate);
|
||||
if (idx === -1) idx = options.indexOf(1);
|
||||
const nextIdx = idx + (k === ">" ? 1 : -1);
|
||||
const next = options[nextIdx];
|
||||
if (next) dataRef.current.display?.setPlaybackRate(next);
|
||||
|
|
Loading…
Reference in a new issue