fix: player - redirect to next video player deeplink only if bingeWatching is enabled, else go to stream list

Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
This commit is contained in:
Lachezar Lechev 2025-10-23 10:05:35 +03:00
parent 00ae74e9af
commit 20c7ba672a
No known key found for this signature in database
GPG key ID: 69BDCB3ED8CE8037

View file

@ -8,7 +8,7 @@ const langs = require('langs');
const { useTranslation } = require('react-i18next');
const { useRouteFocused } = require('stremio-router');
const { useServices } = require('stremio/services');
const { onFileDrop, useSettings, useFullscreen, useBinaryState, useToast, useStreamingServer, withCoreSuspender, CONSTANTS, useShell } = require('stremio/common');
const { onFileDrop, useSettings, useProfile, useFullscreen, useBinaryState, useToast, useStreamingServer, withCoreSuspender, CONSTANTS, useShell } = require('stremio/common');
const { HorizontalNavBar, Transition, ContextMenu } = require('stremio/components');
const BufferingLoader = require('./BufferingLoader');
const VolumeChangeIndicator = require('./VolumeChangeIndicator');
@ -36,7 +36,7 @@ const Player = ({ urlParams, queryParams }) => {
const forceTranscoding = React.useMemo(() => {
return queryParams.has('forceTranscoding');
}, [queryParams]);
const profile = useProfile();
const [player, videoParamsChanged, timeChanged, seek, pausedChanged, ended, nextVideo] = usePlayer(urlParams);
const [settings, updateSettings] = useSettings();
const streamingServer = useStreamingServer();
@ -104,15 +104,22 @@ const Player = ({ urlParams, queryParams }) => {
video.setProp('extraSubtitlesOutlineColor', settings.subtitlesOutlineColor);
}, [settings.subtitlesSize, settings.subtitlesOffset, settings.subtitlesTextColor, settings.subtitlesBackgroundColor, settings.subtitlesOutlineColor]);
const handleNextVideoNavigation = React.useCallback((deepLinks) => {
if (deepLinks.player) {
isNavigating.current = true;
window.location.replace(deepLinks.player);
} else if (deepLinks.metaDetailsStreams) {
isNavigating.current = true;
window.location.replace(deepLinks.metaDetailsStreams);
}
}, []);
// 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 onEnded = React.useCallback(() => {
// here we need to explicitly check for isNavigating.current
@ -126,7 +133,17 @@ const Player = ({ urlParams, queryParams }) => {
nextVideo();
const deepLinks = window.playerNextVideo.deepLinks;
handleNextVideoNavigation(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);
}
}
} else {
window.history.back();
}
@ -256,9 +273,17 @@ const Player = ({ urlParams, queryParams }) => {
nextVideo();
const deepLinks = player.nextVideo.deepLinks;
handleNextVideoNavigation(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);
}
}, [player.nextVideo, handleNextVideoNavigation]);
// }, [player.nextVideo, handleNextVideoNavigation]);
}, [player.nextVideo, profile.settings]);
const onVideoClick = React.useCallback(() => {
if (video.state.paused !== null) {
@ -550,7 +575,7 @@ const Player = ({ urlParams, queryParams }) => {
const videoId = player.selected ? player.selected.streamRequest.path.id : null;
const video = metaItem ? metaItem.videos.find(({ id }) => id === videoId) : null;
const videoInfo = video && video.season && video.episode ? ` (${video.season}x${video.episode})`: null;
const videoInfo = video && video.season && video.episode ? ` (${video.season}x${video.episode})` : null;
const videoTitle = video ? `${video.title}${videoInfo}` : null;
const metaTitle = metaItem ? metaItem.name : null;
const imageUrl = metaItem ? metaItem.logo : null;