mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
Merge pull request #903 from Stremio/fix/binge-watching-bugs
Player(Shell): Fix binge watching bugs
This commit is contained in:
commit
252de8c496
1 changed files with 19 additions and 15 deletions
|
|
@ -88,6 +88,8 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
const defaultAudioTrackSelected = React.useRef(false);
|
||||
const [error, setError] = React.useState(null);
|
||||
|
||||
const isNavigating = React.useRef(false);
|
||||
|
||||
const onImplementationChanged = React.useCallback(() => {
|
||||
video.setProp('subtitlesSize', settings.subtitlesSize);
|
||||
video.setProp('subtitlesOffset', settings.subtitlesOffset);
|
||||
|
|
@ -101,7 +103,21 @@ 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 onEnded = React.useCallback(() => {
|
||||
if (isNavigating.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
ended();
|
||||
if (player.nextVideo !== null) {
|
||||
onNextVideoRequested();
|
||||
|
|
@ -218,14 +234,9 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
nextVideo();
|
||||
|
||||
const deepLinks = player.nextVideo.deepLinks;
|
||||
if (deepLinks.metaDetailsStreams && deepLinks.player) {
|
||||
window.location.replace(deepLinks.metaDetailsStreams);
|
||||
window.location.href = deepLinks.player;
|
||||
} else {
|
||||
window.location.replace(deepLinks.player ?? deepLinks.metaDetailsStreams);
|
||||
}
|
||||
handleNextVideoNavigation(deepLinks);
|
||||
}
|
||||
}, [player.nextVideo]);
|
||||
}, [player.nextVideo, handleNextVideoNavigation]);
|
||||
|
||||
const onVideoClick = React.useCallback(() => {
|
||||
if (video.state.paused !== null) {
|
||||
|
|
@ -620,14 +631,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
video.events.off('extraSubtitlesTrackAdded', onExtraSubtitlesTrackAdded);
|
||||
video.events.off('implementationChanged', onImplementationChanged);
|
||||
};
|
||||
}, [
|
||||
onError,
|
||||
onEnded,
|
||||
onSubtitlesTrackLoaded,
|
||||
onExtraSubtitlesTrackLoaded,
|
||||
onExtraSubtitlesTrackAdded,
|
||||
onImplementationChanged
|
||||
]);
|
||||
}, []);
|
||||
|
||||
React.useLayoutEffect(() => {
|
||||
return () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue