mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
dispatch VideoParamsChanged action
This commit is contained in:
parent
4300f5206d
commit
cf74a57d46
2 changed files with 15 additions and 2 deletions
|
|
@ -33,7 +33,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
queryParams.has('maxAudioChannels') ? parseInt(queryParams.get('maxAudioChannels'), 10) : null
|
||||
];
|
||||
}, [queryParams]);
|
||||
const [player, timeChanged, pausedChanged, ended] = usePlayer(urlParams);
|
||||
const [player, videoParamsChanged, timeChanged, pausedChanged, ended] = usePlayer(urlParams);
|
||||
const [settings, updateSettings] = useSettings();
|
||||
const streamingServer = useStreamingServer();
|
||||
const routeFocused = useRouteFocused();
|
||||
|
|
@ -68,6 +68,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
volume: null,
|
||||
muted: null,
|
||||
playbackSpeed: null,
|
||||
videoParams: null,
|
||||
audioTracks: [],
|
||||
selectedAudioTrackId: null,
|
||||
subtitlesTracks: [],
|
||||
|
|
@ -352,6 +353,9 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
pausedChanged(videoState.paused);
|
||||
}
|
||||
}, [videoState.paused]);
|
||||
React.useEffect(() => {
|
||||
videoParamsChanged(videoState.videoParams);
|
||||
}, [videoState.videoParams]);
|
||||
React.useEffect(() => {
|
||||
if (!!settings.bingeWatching && player.nextVideo !== null && !nextVideoPopupDismissed.current) {
|
||||
if (videoState.time !== null && videoState.duration !== null && videoState.time < videoState.duration && (videoState.duration - videoState.time) <= settings.nextVideoNotificationDuration) {
|
||||
|
|
|
|||
|
|
@ -86,6 +86,15 @@ const usePlayer = (urlParams) => {
|
|||
};
|
||||
}
|
||||
}, [urlParams]);
|
||||
const videoParamsChanged = React.useCallback((videoParams) => {
|
||||
core.transport.dispatch({
|
||||
action: 'Player',
|
||||
args: {
|
||||
action: 'VideoParamsChanged',
|
||||
args: { videoParams }
|
||||
}
|
||||
}, 'player');
|
||||
}, []);
|
||||
const timeChanged = React.useCallback((time, duration, device) => {
|
||||
core.transport.dispatch({
|
||||
action: 'Player',
|
||||
|
|
@ -113,7 +122,7 @@ const usePlayer = (urlParams) => {
|
|||
}, 'player');
|
||||
}, []);
|
||||
const player = useModelState({ model: 'player', action, map });
|
||||
return [player, timeChanged, pausedChanged, ended];
|
||||
return [player, videoParamsChanged, timeChanged, pausedChanged, ended];
|
||||
};
|
||||
|
||||
module.exports = usePlayer;
|
||||
|
|
|
|||
Loading…
Reference in a new issue