Skip to content

Commit

Permalink
Merge branch 'development' of github.com:Stremio/stremio-web into sur…
Browse files Browse the repository at this point in the history
…round_sound_enabled
  • Loading branch information
unclekingpin committed Dec 7, 2023
2 parents 1724f81 + 4c95cf5 commit be2e731
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/routes/Player/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Player = ({ urlParams, queryParams }) => {
const forceTranscoding = React.useMemo(() => {
return queryParams.has('forceTranscoding');
}, [queryParams]);
const [player, videoParamsChanged, timeChanged, pausedChanged, ended] = usePlayer(urlParams);
const [player, videoParamsChanged, timeChanged, pausedChanged, ended, nextVideo] = usePlayer(urlParams);
const [settings, updateSettings] = useSettings();
const streamingServer = useStreamingServer();
const routeFocused = useRouteFocused();
Expand Down Expand Up @@ -196,6 +196,8 @@ const Player = ({ urlParams, queryParams }) => {
}, []);
const onNextVideoRequested = React.useCallback(() => {
if (player.nextVideo !== null) {
nextVideo();

const deepLinks = player.nextVideo.deepLinks;
if (deepLinks.metaDetailsStreams && deepLinks.player) {
window.location.replace(deepLinks.metaDetailsStreams);
Expand Down
10 changes: 9 additions & 1 deletion src/routes/Player/usePlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,16 @@ const usePlayer = (urlParams) => {
}
}, 'player');
}, []);
const nextVideo = React.useCallback(() => {
core.transport.dispatch({
action: 'Player',
args: {
action: 'NextVideo'
}
}, 'player');
}, []);
const player = useModelState({ model: 'player', action, map });
return [player, videoParamsChanged, timeChanged, pausedChanged, ended];
return [player, videoParamsChanged, timeChanged, pausedChanged, ended, nextVideo];
};

module.exports = usePlayer;

0 comments on commit be2e731

Please sign in to comment.