fix: mouse hold and release to not reset playback speed to 1x

This commit is contained in:
Botzy 2026-03-26 17:13:11 +02:00
parent 48ba0b8fba
commit 866db891ef

View file

@ -225,11 +225,13 @@ const Player = ({ urlParams, queryParams }) => {
}, [video.state.duration, video.state.manifest]); }, [video.state.duration, video.state.manifest]);
const onPlaybackSpeedChanged = React.useCallback((rate, skipUpdate) => { const onPlaybackSpeedChanged = React.useCallback((rate, skipUpdate) => {
if (!skipUpdate) {
playbackSpeed.current = rate;
}
video.setPlaybackSpeed(rate); video.setPlaybackSpeed(rate);
}, []);
if (skipUpdate) return;
playbackSpeed.current = rate;
}, [video.setPlaybackSpeed]);
const onSubtitlesTrackSelected = React.useCallback((id) => { const onSubtitlesTrackSelected = React.useCallback((id) => {
video.setSubtitlesTrack(id); video.setSubtitlesTrack(id);
@ -790,7 +792,7 @@ const Player = ({ urlParams, queryParams }) => {
pressTimer.current = setTimeout(() => { pressTimer.current = setTimeout(() => {
longPress.current = true; longPress.current = true;
onPlaybackSpeedChanged(2); onPlaybackSpeedChanged(2, true);
}, HOLD_DELAY); }, HOLD_DELAY);
}; };
@ -800,7 +802,7 @@ const Player = ({ urlParams, queryParams }) => {
clearTimeout(pressTimer.current); clearTimeout(pressTimer.current);
if (longPress.current) { if (longPress.current) {
onPlaybackSpeedChanged(1); onPlaybackSpeedChanged(playbackSpeed.current);
} }
}; };