Use visibilitychange event on ios to leave call
This commit is contained in:
parent
739b983019
commit
323808f495
1 changed files with 8 additions and 1 deletions
|
@ -150,11 +150,18 @@ export function useVideoRoom(manager, roomId, timeout = 5000) {
|
|||
}));
|
||||
|
||||
function onBeforeUnload(event) {
|
||||
if (
|
||||
event.type === "visibilitychange" &&
|
||||
document.visibilityState === "visible"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
manager.leaveCall();
|
||||
}
|
||||
|
||||
// iOS doesn't fire beforeunload event, so leave the call when you hide the page.
|
||||
const unloadEvent = isIOS() ? "pagehide" : "beforeunload";
|
||||
const unloadEvent = isIOS() ? "visibilitychange" : "beforeunload";
|
||||
|
||||
window.addEventListener(unloadEvent, onBeforeUnload);
|
||||
|
||||
|
|
Loading…
Reference in a new issue