mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-09 08:10:53 +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]);
|
||||
const onChromecastButtonClick = React.useCallback(() => {
|
||||
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(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue