mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 02:22:09 +00:00
pausedChanged action sent to core
This commit is contained in:
parent
0101c015dd
commit
28a8c9cdfa
2 changed files with 16 additions and 2 deletions
|
|
@ -25,7 +25,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
queryParams.has('maxAudioChannels') ? parseInt(queryParams.get('maxAudioChannels'), 10) : null
|
||||
];
|
||||
}, [queryParams]);
|
||||
const [player, timeChanged, pushToLibrary, ended] = usePlayer(urlParams);
|
||||
const [player, timeChanged, pausedChanged, ended, pushToLibrary] = usePlayer(urlParams);
|
||||
const [settings, updateSettings] = useSettings();
|
||||
const streamingServer = useStreamingServer();
|
||||
const routeFocused = useRouteFocused();
|
||||
|
|
@ -302,6 +302,11 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
timeChanged(videoState.time, videoState.duration, videoState.manifest.name);
|
||||
}
|
||||
}, [videoState.time, videoState.duration, videoState.manifest]);
|
||||
React.useEffect(() => {
|
||||
if (videoState.paused !== null) {
|
||||
pausedChanged(videoState.paused);
|
||||
}
|
||||
}, [videoState.paused]);
|
||||
React.useEffect(() => {
|
||||
if ((!Array.isArray(videoState.subtitlesTracks) || videoState.subtitlesTracks.length === 0) &&
|
||||
(!Array.isArray(videoState.extraSubtitlesTracks) || videoState.extraSubtitlesTracks.length === 0) &&
|
||||
|
|
|
|||
|
|
@ -111,8 +111,17 @@ const usePlayer = (urlParams) => {
|
|||
}
|
||||
}, 'player');
|
||||
}, []);
|
||||
const pausedChanged = React.useCallback((paused) => {
|
||||
core.transport.dispatch({
|
||||
action: 'Player',
|
||||
args: {
|
||||
action: 'PausedChanged',
|
||||
args: { paused }
|
||||
}
|
||||
}, 'player');
|
||||
}, []);
|
||||
const player = useModelState({ model: 'player', action, map });
|
||||
return [player, timeChanged, pushToLibrary, ended];
|
||||
return [player, timeChanged, pausedChanged, ended, pushToLibrary];
|
||||
};
|
||||
|
||||
module.exports = usePlayer;
|
||||
|
|
|
|||
Loading…
Reference in a new issue