mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-08-18 09:27:02 +00:00
Merge pull request #1196 from Stremio/fix/space-bar-events-play-pause-handing
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
commit
5560813b37
1 changed files with 12 additions and 13 deletions
|
|
@ -636,17 +636,6 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
navigator.mediaSession.setActionHandler('nexttrack', nexVideoCallback);
|
||||
}, [player.nextVideo, onPlayRequested, onPauseRequested, onNextVideoRequested]);
|
||||
|
||||
onShortcut('playPause', () => {
|
||||
if (video.state.paused !== null) {
|
||||
if (video.state.paused) {
|
||||
onPlayRequested();
|
||||
setSeeking(false);
|
||||
} else if (!pressTimer.current) {
|
||||
onPauseRequested();
|
||||
}
|
||||
}
|
||||
}, [video.state.paused, pressTimer.current, onPlayRequested, onPauseRequested], !menusOpen);
|
||||
|
||||
onShortcut('seekForward', (combo) => {
|
||||
if (video.state.time !== null) {
|
||||
const seekDuration = combo === 1 ? settings.seekShortTimeDuration : settings.seekTimeDuration;
|
||||
|
|
@ -791,7 +780,17 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
if (e.code === 'Space') {
|
||||
clearTimeout(pressTimer.current);
|
||||
pressTimer.current = null;
|
||||
onPlaybackSpeedChanged(playbackSpeed.current);
|
||||
if (longPress.current) {
|
||||
onPlaybackSpeedChanged(playbackSpeed.current);
|
||||
} else if (!menusOpen && video.state.paused !== null) {
|
||||
if (video.state.paused) {
|
||||
onPlayRequested();
|
||||
setSeeking(false);
|
||||
} else {
|
||||
onPauseRequested();
|
||||
}
|
||||
}
|
||||
longPress.current = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -844,7 +843,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
window.removeEventListener('mousedown', onMouseDownHold);
|
||||
window.removeEventListener('mouseup', onMouseUp);
|
||||
};
|
||||
}, [routeFocused, menusOpen, video.state.volume]);
|
||||
}, [routeFocused, menusOpen, video.state.volume, video.state.paused]);
|
||||
|
||||
React.useEffect(() => {
|
||||
video.events.on('error', onError);
|
||||
|
|
|
|||
Loading…
Reference in a new issue