[web][cast] Close on sender disconnect

This commit is contained in:
Neeraj Gupta 2024-04-25 18:14:02 +05:30
parent a243db032c
commit 1dc8ac6023

View file

@ -64,6 +64,15 @@ export default function PairingMode() {
"urn:x-cast:pair-request",
messageReceiveHandler,
);
// listen to close request and stop the context
context.addEventListener(
cast.framework.system.EventType.SENDER_DISCONNECTED,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(_) => {
context.stop();
},
);
context.start(options);
setIsCastReady(true);
} catch (e) {