mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 11:42:05 +00:00
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:
parent
00ae74e9af
commit
20c7ba672a
1 changed files with 40 additions and 15 deletions
|
|
@ -8,7 +8,7 @@ const langs = require('langs');
|
||||||
const { useTranslation } = require('react-i18next');
|
const { useTranslation } = require('react-i18next');
|
||||||
const { useRouteFocused } = require('stremio-router');
|
const { useRouteFocused } = require('stremio-router');
|
||||||
const { useServices } = require('stremio/services');
|
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 { HorizontalNavBar, Transition, ContextMenu } = require('stremio/components');
|
||||||
const BufferingLoader = require('./BufferingLoader');
|
const BufferingLoader = require('./BufferingLoader');
|
||||||
const VolumeChangeIndicator = require('./VolumeChangeIndicator');
|
const VolumeChangeIndicator = require('./VolumeChangeIndicator');
|
||||||
|
|
@ -36,7 +36,7 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
const forceTranscoding = React.useMemo(() => {
|
const forceTranscoding = React.useMemo(() => {
|
||||||
return queryParams.has('forceTranscoding');
|
return queryParams.has('forceTranscoding');
|
||||||
}, [queryParams]);
|
}, [queryParams]);
|
||||||
|
const profile = useProfile();
|
||||||
const [player, videoParamsChanged, timeChanged, seek, pausedChanged, ended, nextVideo] = usePlayer(urlParams);
|
const [player, videoParamsChanged, timeChanged, seek, pausedChanged, ended, nextVideo] = usePlayer(urlParams);
|
||||||
const [settings, updateSettings] = useSettings();
|
const [settings, updateSettings] = useSettings();
|
||||||
const streamingServer = useStreamingServer();
|
const streamingServer = useStreamingServer();
|
||||||
|
|
@ -104,15 +104,22 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
video.setProp('extraSubtitlesOutlineColor', settings.subtitlesOutlineColor);
|
video.setProp('extraSubtitlesOutlineColor', settings.subtitlesOutlineColor);
|
||||||
}, [settings.subtitlesSize, settings.subtitlesOffset, settings.subtitlesTextColor, settings.subtitlesBackgroundColor, settings.subtitlesOutlineColor]);
|
}, [settings.subtitlesSize, settings.subtitlesOffset, settings.subtitlesTextColor, settings.subtitlesBackgroundColor, settings.subtitlesOutlineColor]);
|
||||||
|
|
||||||
const handleNextVideoNavigation = React.useCallback((deepLinks) => {
|
// const handleNextVideoNavigation = React.useCallback((deepLinks, bingeWatching, ended) => {
|
||||||
if (deepLinks.player) {
|
// if (bingeWatching && !ended) {
|
||||||
isNavigating.current = true;
|
// if (deepLinks.player) {
|
||||||
window.location.replace(deepLinks.player);
|
// isNavigating.current = true;
|
||||||
} else if (deepLinks.metaDetailsStreams) {
|
// window.location.replace(deepLinks.player);
|
||||||
isNavigating.current = true;
|
// } else if (deepLinks.metaDetailsStreams) {
|
||||||
window.location.replace(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(() => {
|
const onEnded = React.useCallback(() => {
|
||||||
// here we need to explicitly check for isNavigating.current
|
// here we need to explicitly check for isNavigating.current
|
||||||
|
|
@ -126,7 +133,17 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
nextVideo();
|
nextVideo();
|
||||||
|
|
||||||
const deepLinks = window.playerNextVideo.deepLinks;
|
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 {
|
} else {
|
||||||
window.history.back();
|
window.history.back();
|
||||||
}
|
}
|
||||||
|
|
@ -256,9 +273,17 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
nextVideo();
|
nextVideo();
|
||||||
|
|
||||||
const deepLinks = player.nextVideo.deepLinks;
|
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(() => {
|
const onVideoClick = React.useCallback(() => {
|
||||||
if (video.state.paused !== null) {
|
if (video.state.paused !== null) {
|
||||||
|
|
@ -550,7 +575,7 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
const videoId = player.selected ? player.selected.streamRequest.path.id : null;
|
const videoId = player.selected ? player.selected.streamRequest.path.id : null;
|
||||||
const video = metaItem ? metaItem.videos.find(({ id }) => id === videoId) : 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 videoTitle = video ? `${video.title}${videoInfo}` : null;
|
||||||
const metaTitle = metaItem ? metaItem.name : null;
|
const metaTitle = metaItem ? metaItem.name : null;
|
||||||
const imageUrl = metaItem ? metaItem.logo : null;
|
const imageUrl = metaItem ? metaItem.logo : null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue