mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
Merge pull request #516 from Stremio/feat/next-video-action
Feat/Player Action NextVideo
This commit is contained in:
commit
4c95cf5672
2 changed files with 12 additions and 2 deletions
|
|
@ -33,7 +33,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
queryParams.has('maxAudioChannels') ? parseInt(queryParams.get('maxAudioChannels'), 10) : null
|
||||
];
|
||||
}, [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();
|
||||
|
|
@ -199,6 +199,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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue