diff --git a/.gitignore b/.gitignore index 71947782e..a26e747c3 100755 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /yarn.lock /npm-debug.log .DS_Store -.prettierignore \ No newline at end of file +.prettierignore +/.idea/ diff --git a/src/routes/Player/Player.js b/src/routes/Player/Player.js index cdde60474..76aeaf2f4 100644 --- a/src/routes/Player/Player.js +++ b/src/routes/Player/Player.js @@ -78,6 +78,8 @@ const Player = ({ urlParams, queryParams }) => { }, [immersed, casting, video.state.paused, menusOpen, nextVideoPopupOpen]); const nextVideoPopupDismissed = React.useRef(false); + const nextVideoInitialData = React.useRef(player.nextVideo); + nextVideoInitialData.current = player.nextVideo; const defaultSubtitlesSelected = React.useRef(false); const defaultAudioTrackSelected = React.useRef(false); const [error, setError] = React.useState(null); @@ -96,6 +98,7 @@ const Player = ({ urlParams, queryParams }) => { }, [settings.subtitlesSize, settings.subtitlesOffset, settings.subtitlesTextColor, settings.subtitlesBackgroundColor, settings.subtitlesOutlineColor]); const onEnded = React.useCallback(() => { + player.nextVideo = nextVideoInitialData.current; ended(); if (player.nextVideo !== null) { onNextVideoRequested(); @@ -463,6 +466,7 @@ const Player = ({ urlParams, queryParams }) => { React.useLayoutEffect(() => { const onKeyDown = (event) => { switch (event.code) { + case 'MediaPlayPause': case 'Space': { if (!menusOpen && !nextVideoPopupOpen && video.state.paused !== null) { if (video.state.paused) { @@ -475,6 +479,8 @@ const Player = ({ urlParams, queryParams }) => { break; } + case 'Numpad6': + case 'MediaTrackNext': case 'ArrowRight': { if (!menusOpen && !nextVideoPopupOpen && video.state.time !== null) { const seekDuration = event.shiftKey ? settings.seekShortTimeDuration : settings.seekTimeDuration; @@ -484,6 +490,8 @@ const Player = ({ urlParams, queryParams }) => { break; } + case 'Numpad4': + case 'MediaTrackPrevious': case 'ArrowLeft': { if (!menusOpen && !nextVideoPopupOpen && video.state.time !== null) { const seekDuration = event.shiftKey ? settings.seekShortTimeDuration : settings.seekTimeDuration; @@ -493,6 +501,7 @@ const Player = ({ urlParams, queryParams }) => { break; } + case 'Numpad8': case 'ArrowUp': { if (!menusOpen && !nextVideoPopupOpen && video.state.volume !== null) { onVolumeChangeRequested(video.state.volume + 5); @@ -500,6 +509,7 @@ const Player = ({ urlParams, queryParams }) => { break; } + case 'Numpad2': case 'ArrowDown': { if (!menusOpen && !nextVideoPopupOpen && video.state.volume !== null) { onVolumeChangeRequested(video.state.volume - 5); @@ -556,7 +566,7 @@ const Player = ({ urlParams, queryParams }) => { } }; const onKeyUp = (event) => { - if (event.code === 'ArrowRight' || event.code === 'ArrowLeft') { + if (event.code === 'ArrowRight' || event.code === 'ArrowLeft' || event.code === 'Numpad6' || event.code === 'Numpad4') { setSeeking(false); } }; @@ -596,6 +606,8 @@ const Player = ({ urlParams, queryParams }) => { video.events.off('subtitlesTrackLoaded', onSubtitlesTrackLoaded); video.events.off('extraSubtitlesTrackLoaded', onExtraSubtitlesTrackLoaded); video.events.off('implementationChanged', onImplementationChanged); + if (document.querySelector('body').style.background) document.querySelector('body').style.background = ''; + if (document.getElementById('app').style.background) document.getElementById('app').style.background = ''; }; }, []);