Fix bug causing mic/webcam to remain open after call

Fixes https://github.com/vector-im/element-call/issues/596
This commit is contained in:
David Baker 2022-09-23 15:35:05 +01:00
commit 7435f1101a

View file

@ -132,18 +132,17 @@ export function GroupCallView({
const history = useHistory(); const history = useHistory();
const onLeave = useCallback(() => { const onLeave = useCallback(() => {
setLeft(true);
leave(); leave();
if (widget) { if (widget) {
widget.api.transport.send(ElementWidgetActions.HangupCall, {}); widget.api.transport.send(ElementWidgetActions.HangupCall, {});
widget.api.setAlwaysOnScreen(false); widget.api.setAlwaysOnScreen(false);
} }
if (isPasswordlessUser) { if (!isEmbedded) {
setLeft(true);
} else if (!isEmbedded) {
history.push("/"); history.push("/");
} }
}, [leave, isPasswordlessUser, isEmbedded, history]); }, [leave, isEmbedded, history]);
useEffect(() => { useEffect(() => {
if (widget && state === GroupCallState.Entered) { if (widget && state === GroupCallState.Entered) {
@ -208,7 +207,14 @@ export function GroupCallView({
</FullScreenView> </FullScreenView>
); );
} else if (left) { } else if (left) {
return <CallEndedView client={client} />; if (isPasswordlessUser) {
return <CallEndedView client={client} />;
} else {
// If the user is a regular user, we'll have sent them back to the homepage,
// so just sit here & do nothing: otherwise we would (briefly) mount the
// LobbyView again which would open capture devices again.
return null;
}
} else if (preload) { } else if (preload) {
return null; return null;
} else if (isEmbedded) { } else if (isEmbedded) {