await leave rtc session (#1648)
so that the widget is only getting the hangup even, once the call has been cleaned up Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
@@ -217,13 +217,16 @@ export function GroupCallView({
|
|||||||
sendInstantly
|
sendInstantly
|
||||||
);
|
);
|
||||||
|
|
||||||
leaveRTCSession(rtcSession);
|
await leaveRTCSession(rtcSession);
|
||||||
if (widget) {
|
if (widget) {
|
||||||
// we need to wait until the callEnded event is tracked on posthog.
|
// we need to wait until the callEnded event is tracked on posthog.
|
||||||
// Otherwise the iFrame gets killed before the callEnded event got tracked.
|
// Otherwise the iFrame gets killed before the callEnded event got tracked.
|
||||||
await new Promise((resolve) => window.setTimeout(resolve, 10)); // 10ms
|
await new Promise((resolve) => window.setTimeout(resolve, 10)); // 10ms
|
||||||
widget.api.setAlwaysOnScreen(false);
|
widget.api.setAlwaysOnScreen(false);
|
||||||
PosthogAnalytics.instance.logout();
|
PosthogAnalytics.instance.logout();
|
||||||
|
|
||||||
|
// we will always send the hangup event after the memberships have been updated
|
||||||
|
// calling leaveRTCSession.
|
||||||
widget.api.transport.send(ElementWidgetActions.HangupCall, {});
|
widget.api.transport.send(ElementWidgetActions.HangupCall, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ export function enterRTCSession(rtcSession: MatrixRTCSession) {
|
|||||||
rtcSession.joinRoomSession([makeFocus(livekitAlias)]);
|
rtcSession.joinRoomSession([makeFocus(livekitAlias)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function leaveRTCSession(rtcSession: MatrixRTCSession) {
|
export async function leaveRTCSession(
|
||||||
|
rtcSession: MatrixRTCSession
|
||||||
|
): Promise<void> {
|
||||||
//groupCallOTelMembership?.onLeaveCall();
|
//groupCallOTelMembership?.onLeaveCall();
|
||||||
rtcSession.leaveRoomSession();
|
await rtcSession.leaveRoomSession();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user