Merge pull request #602 from vector-im/dbkr/fix_capture_devices_left_on

Fix bug causing mic/webcam to remain open after call
This commit is contained in:
David Baker 2022-09-23 17:09:39 +01:00 committed by GitHub
commit b55aa12100
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,15 +132,14 @@ 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 (!isPasswordlessUser && !isEmbedded) {
setLeft(true);
} else if (!isEmbedded) {
history.push("/"); history.push("/");
} }
}, [leave, isPasswordlessUser, isEmbedded, history]); }, [leave, isPasswordlessUser, isEmbedded, history]);
@ -208,7 +207,14 @@ export function GroupCallView({
</FullScreenView> </FullScreenView>
); );
} else if (left) { } else if (left) {
if (isPasswordlessUser) {
return <CallEndedView client={client} />; 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) {