mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 06:32:11 +00:00
feat(Player): stop video when opening in external player
This commit is contained in:
parent
253322f690
commit
392c1f594e
1 changed files with 8 additions and 1 deletions
|
|
@ -23,7 +23,7 @@ const useSettings = require('./useSettings');
|
|||
const styles = require('./styles');
|
||||
|
||||
const Player = ({ urlParams, queryParams }) => {
|
||||
const { chromecast, shell } = useServices();
|
||||
const { chromecast, shell, core } = useServices();
|
||||
const [forceTranscoding, maxAudioChannels] = React.useMemo(() => {
|
||||
return [
|
||||
queryParams.has('forceTranscoding'),
|
||||
|
|
@ -427,11 +427,18 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
);
|
||||
}
|
||||
};
|
||||
const onCoreEvent = ({ event }) => {
|
||||
if (event === 'PlayingOnDevice') {
|
||||
onPauseRequested();
|
||||
}
|
||||
};
|
||||
chromecast.on('stateChanged', onChromecastServiceStateChange);
|
||||
core.transport.on('CoreEvent', onCoreEvent);
|
||||
onChromecastServiceStateChange();
|
||||
return () => {
|
||||
toast.removeFilter(toastFilter);
|
||||
chromecast.off('stateChanged', onChromecastServiceStateChange);
|
||||
core.transport.off('CoreEvent', onCoreEvent);
|
||||
if (chromecast.active) {
|
||||
chromecast.transport.off(
|
||||
cast.framework.CastContextEventType.CAST_STATE_CHANGED,
|
||||
|
|
|
|||
Loading…
Reference in a new issue