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
parent ae66e4b3f8
commit 7435f1101a

View file

@ -132,18 +132,17 @@ export function GroupCallView({
const history = useHistory();
const onLeave = useCallback(() => {
setLeft(true);
leave();
if (widget) {
widget.api.transport.send(ElementWidgetActions.HangupCall, {});
widget.api.setAlwaysOnScreen(false);
}
if (isPasswordlessUser) {
setLeft(true);
} else if (!isEmbedded) {
if (!isEmbedded) {
history.push("/");
}
}, [leave, isPasswordlessUser, isEmbedded, history]);
}, [leave, isEmbedded, history]);
useEffect(() => {
if (widget && state === GroupCallState.Entered) {
@ -208,7 +207,14 @@ export function GroupCallView({
</FullScreenView>
);
} 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) {
return null;
} else if (isEmbedded) {