From 866db891ef642d3f3a84b230dc8dec403e94490e Mon Sep 17 00:00:00 2001 From: Botzy Date: Thu, 26 Mar 2026 17:13:11 +0200 Subject: [PATCH] fix: mouse hold and release to not reset playback speed to 1x --- src/routes/Player/Player.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/routes/Player/Player.js b/src/routes/Player/Player.js index 565414707..93095b701 100644 --- a/src/routes/Player/Player.js +++ b/src/routes/Player/Player.js @@ -225,11 +225,13 @@ const Player = ({ urlParams, queryParams }) => { }, [video.state.duration, video.state.manifest]); const onPlaybackSpeedChanged = React.useCallback((rate, skipUpdate) => { - if (!skipUpdate) { - playbackSpeed.current = rate; - } video.setPlaybackSpeed(rate); - }, []); + + if (skipUpdate) return; + + playbackSpeed.current = rate; + + }, [video.setPlaybackSpeed]); const onSubtitlesTrackSelected = React.useCallback((id) => { video.setSubtitlesTrack(id); @@ -790,7 +792,7 @@ const Player = ({ urlParams, queryParams }) => { pressTimer.current = setTimeout(() => { longPress.current = true; - onPlaybackSpeedChanged(2); + onPlaybackSpeedChanged(2, true); }, HOLD_DELAY); }; @@ -800,7 +802,7 @@ const Player = ({ urlParams, queryParams }) => { clearTimeout(pressTimer.current); if (longPress.current) { - onPlaybackSpeedChanged(1); + onPlaybackSpeedChanged(playbackSpeed.current); } };