mirror of
https://github.com/vector-im/element-call.git
synced 2026-09-10 21:55:19 +00:00
Add support for playing a sound when the user exits a call.
This commit is contained in:
@@ -120,6 +120,7 @@ export async function enterRTCSession(
|
||||
|
||||
const widgetPostHangupProcedure = async (
|
||||
widget: WidgetHelpers,
|
||||
promiseBeforeHangup?: Promise<unknown>,
|
||||
): Promise<void> => {
|
||||
// we need to wait until the callEnded event is tracked on posthog.
|
||||
// Otherwise the iFrame gets killed before the callEnded event got tracked.
|
||||
@@ -132,6 +133,8 @@ const widgetPostHangupProcedure = async (
|
||||
logger.error("Failed to set call widget `alwaysOnScreen` to false", e);
|
||||
}
|
||||
|
||||
// Wait for any last bits before hanging up.
|
||||
await promiseBeforeHangup;
|
||||
// We send the hangup event after the memberships have been updated
|
||||
// calling leaveRTCSession.
|
||||
// We need to wait because this makes the client hosting this widget killing the IFrame.
|
||||
@@ -140,9 +143,12 @@ const widgetPostHangupProcedure = async (
|
||||
|
||||
export async function leaveRTCSession(
|
||||
rtcSession: MatrixRTCSession,
|
||||
promiseBeforeHangup?: Promise<unknown>,
|
||||
): Promise<void> {
|
||||
await rtcSession.leaveRoomSession();
|
||||
if (widget) {
|
||||
await widgetPostHangupProcedure(widget);
|
||||
await widgetPostHangupProcedure(widget, promiseBeforeHangup);
|
||||
} else {
|
||||
await promiseBeforeHangup;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user