mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
test(Player): fix binge watching
This commit is contained in:
parent
18ac3583b4
commit
672a0067ce
1 changed files with 24 additions and 12 deletions
|
|
@ -102,6 +102,7 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
}, [settings.subtitlesSize, settings.subtitlesOffset, settings.subtitlesTextColor, settings.subtitlesBackgroundColor, settings.subtitlesOutlineColor]);
|
}, [settings.subtitlesSize, settings.subtitlesOffset, settings.subtitlesTextColor, settings.subtitlesBackgroundColor, settings.subtitlesOutlineColor]);
|
||||||
|
|
||||||
const onEnded = React.useCallback(() => {
|
const onEnded = React.useCallback(() => {
|
||||||
|
console.log('Player in on ended callback', player.nextVideo); // eslint-disable-line no-console
|
||||||
ended();
|
ended();
|
||||||
if (player.nextVideo !== null) {
|
if (player.nextVideo !== null) {
|
||||||
onNextVideoRequested();
|
onNextVideoRequested();
|
||||||
|
|
@ -215,19 +216,26 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
|
|
||||||
const onNextVideoRequested = React.useCallback(() => {
|
const onNextVideoRequested = React.useCallback(() => {
|
||||||
if (player.nextVideo !== null) {
|
if (player.nextVideo !== null) {
|
||||||
const deepLinks = player.nextVideo.deepLinks;
|
const navigationData = {
|
||||||
const navigateToPlayer = deepLinks.player ? deepLinks.player : null;
|
playerLink: player.nextVideo.deepLinks.player,
|
||||||
const navigateToDetails = deepLinks.metaDetailsStreams ? deepLinks.metaDetailsStreams : null;
|
metaDetailsLink: player.nextVideo.deepLinks.metaDetailsStreams
|
||||||
|
};
|
||||||
|
|
||||||
nextVideo();
|
if (navigationData.playerLink) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
requestAnimationFrame(() => {
|
window.location.replace(navigationData.playerLink);
|
||||||
if (navigateToPlayer) {
|
});
|
||||||
window.location.replace(navigateToPlayer);
|
setTimeout(() => {
|
||||||
} else if (navigateToDetails) {
|
nextVideo();
|
||||||
window.location.replace(navigateToDetails);
|
}, 500);
|
||||||
}
|
} else if (navigationData.metaDetailsLink) {
|
||||||
});
|
requestAnimationFrame(() => {
|
||||||
|
window.location.replace(navigationData.metaDetailsLink);
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
nextVideo();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [player.nextVideo]);
|
}, [player.nextVideo]);
|
||||||
|
|
||||||
|
|
@ -629,6 +637,10 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
onImplementationChanged
|
onImplementationChanged
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
console.log('Player next video in use effect', player.nextVideo); // eslint-disable-line no-console
|
||||||
|
}, [player.nextVideo]);
|
||||||
|
|
||||||
React.useLayoutEffect(() => {
|
React.useLayoutEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
setImmersedDebounced.cancel();
|
setImmersedDebounced.cancel();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue