mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 03:22:11 +00:00
toggle connection to chromecast from chromecast button
This commit is contained in:
parent
fda7150c2d
commit
cbd0f7a337
1 changed files with 6 additions and 1 deletions
|
|
@ -71,7 +71,12 @@ const ControlBar = ({
|
||||||
}, [onToggleInfoMenu]);
|
}, [onToggleInfoMenu]);
|
||||||
const onChromecastButtonClick = React.useCallback(() => {
|
const onChromecastButtonClick = React.useCallback(() => {
|
||||||
if (chromecast.active) {
|
if (chromecast.active) {
|
||||||
chromecast.transport.dispatch({ type: 'requestSession' });
|
const sessionState = chromecast.transport.getSessionState();
|
||||||
|
if (sessionState === cast.framework.SessionState.SESSION_STARTING || sessionState === cast.framework.SessionState.SESSION_STARTED) {
|
||||||
|
chromecast.transport.dispatch({ type: 'endCurrentSession', stopCasting: true });
|
||||||
|
} else {
|
||||||
|
chromecast.transport.dispatch({ type: 'requestSession' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue