mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-01-11 22:40:31 +00:00
chore: player - clean up and use handleNextVideoNavigation
Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
This commit is contained in:
parent
32cf4cc12e
commit
3d163cf440
1 changed files with 24 additions and 36 deletions
|
|
@ -105,22 +105,27 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
video.setProp('extraSubtitlesOutlineColor', settings.subtitlesOutlineColor);
|
||||
}, [settings.subtitlesSize, settings.subtitlesOffset, settings.subtitlesTextColor, settings.subtitlesBackgroundColor, settings.subtitlesOutlineColor]);
|
||||
|
||||
// const handleNextVideoNavigation = React.useCallback((deepLinks, bingeWatching, ended) => {
|
||||
// if (bingeWatching && !ended) {
|
||||
// if (deepLinks.player) {
|
||||
// isNavigating.current = true;
|
||||
// window.location.replace(deepLinks.player);
|
||||
// } else if (deepLinks.metaDetailsStreams) {
|
||||
// isNavigating.current = true;
|
||||
// window.location.replace(deepLinks.metaDetailsStreams);
|
||||
// }
|
||||
// } else {
|
||||
// if (!ended && deepLinks.metaDetailsStreams) {
|
||||
// isNavigating.current = true;
|
||||
// window.location.replace(deepLinks.metaDetailsStreams);
|
||||
// }
|
||||
// }
|
||||
// }, []);
|
||||
const handleNextVideoNavigation = React.useCallback((deepLinks, bingeWatching, ended) => {
|
||||
if (ended) {
|
||||
if (profile.settings.bingeWatching) {
|
||||
if (deepLinks.player) {
|
||||
isNavigating.current = true;
|
||||
window.location.replace(deepLinks.player);
|
||||
} else if (deepLinks.metaDetailsStreams) {
|
||||
isNavigating.current = true;
|
||||
window.location.replace(deepLinks.metaDetailsStreams);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (deepLinks.player) {
|
||||
isNavigating.current = true;
|
||||
window.location.replace(deepLinks.player);
|
||||
} else if (deepLinks.metaDetailsStreams) {
|
||||
isNavigating.current = true;
|
||||
window.location.replace(deepLinks.metaDetailsStreams);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
const onEnded = React.useCallback(() => {
|
||||
// here we need to explicitly check for isNavigating.current
|
||||
|
|
@ -134,16 +139,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
nextVideo();
|
||||
|
||||
const deepLinks = window.playerNextVideo.deepLinks;
|
||||
// handleNextVideoNavigation(deepLinks, profile.settings.bingeWatching, true);
|
||||
if (profile.settings.bingeWatching) {
|
||||
if (deepLinks.player) {
|
||||
isNavigating.current = true;
|
||||
window.location.replace(deepLinks.player);
|
||||
} else if (deepLinks.metaDetailsStreams) {
|
||||
isNavigating.current = true;
|
||||
window.location.replace(deepLinks.metaDetailsStreams);
|
||||
}
|
||||
}
|
||||
handleNextVideoNavigation(deepLinks, profile.settings.bingeWatching, true);
|
||||
|
||||
} else {
|
||||
window.history.back();
|
||||
|
|
@ -274,17 +270,9 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
nextVideo();
|
||||
|
||||
const deepLinks = player.nextVideo.deepLinks;
|
||||
if (deepLinks.player) {
|
||||
isNavigating.current = true;
|
||||
window.location.replace(deepLinks.player);
|
||||
} else if (deepLinks.metaDetailsStreams) {
|
||||
isNavigating.current = true;
|
||||
window.location.replace(deepLinks.metaDetailsStreams);
|
||||
}
|
||||
// handleNextVideoNavigation(deepLinks, profile.settings.bingeWatching, false);
|
||||
handleNextVideoNavigation(deepLinks, profile.settings.bingeWatching, false);
|
||||
}
|
||||
// }, [player.nextVideo, handleNextVideoNavigation]);
|
||||
}, [player.nextVideo, profile.settings]);
|
||||
}, [player.nextVideo, handleNextVideoNavigation, profile.settings]);
|
||||
|
||||
const onVideoClick = React.useCallback(() => {
|
||||
if (video.state.paused !== null) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue