mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
fix(Player): binge watching in shell
This commit is contained in:
parent
ce0c5da3fd
commit
f3a7ef5978
1 changed files with 21 additions and 7 deletions
|
|
@ -88,6 +88,8 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
const defaultAudioTrackSelected = React.useRef(false);
|
const defaultAudioTrackSelected = React.useRef(false);
|
||||||
const [error, setError] = React.useState(null);
|
const [error, setError] = React.useState(null);
|
||||||
|
|
||||||
|
const isNavigating = React.useRef(false);
|
||||||
|
|
||||||
const onImplementationChanged = React.useCallback(() => {
|
const onImplementationChanged = React.useCallback(() => {
|
||||||
video.setProp('subtitlesSize', settings.subtitlesSize);
|
video.setProp('subtitlesSize', settings.subtitlesSize);
|
||||||
video.setProp('subtitlesOffset', settings.subtitlesOffset);
|
video.setProp('subtitlesOffset', settings.subtitlesOffset);
|
||||||
|
|
@ -101,7 +103,24 @@ 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) => {
|
||||||
|
if (deepLinks.player) {
|
||||||
|
isNavigating.current = true;
|
||||||
|
window.location.href = deepLinks.player;
|
||||||
|
return true;
|
||||||
|
} else if (deepLinks.metaDetailsStreams) {
|
||||||
|
isNavigating.current = true;
|
||||||
|
window.location.href = deepLinks.metaDetailsStreams;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}, []);
|
||||||
|
|
||||||
const onEnded = React.useCallback(() => {
|
const onEnded = React.useCallback(() => {
|
||||||
|
if (isNavigating.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ended();
|
ended();
|
||||||
if (player.nextVideo !== null) {
|
if (player.nextVideo !== null) {
|
||||||
onNextVideoRequested();
|
onNextVideoRequested();
|
||||||
|
|
@ -218,14 +237,9 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
nextVideo();
|
nextVideo();
|
||||||
|
|
||||||
const deepLinks = player.nextVideo.deepLinks;
|
const deepLinks = player.nextVideo.deepLinks;
|
||||||
if (deepLinks.metaDetailsStreams && deepLinks.player) {
|
handleNextVideoNavigation(deepLinks);
|
||||||
window.location.replace(deepLinks.metaDetailsStreams);
|
|
||||||
window.location.href = deepLinks.player;
|
|
||||||
} else {
|
|
||||||
window.location.replace(deepLinks.player ?? deepLinks.metaDetailsStreams);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, [player.nextVideo]);
|
}, [player.nextVideo, handleNextVideoNavigation]);
|
||||||
|
|
||||||
const onVideoClick = React.useCallback(() => {
|
const onVideoClick = React.useCallback(() => {
|
||||||
if (video.state.paused !== null) {
|
if (video.state.paused !== null) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue