diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index 8cf7002e6a4..b055abbf15d 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -98,8 +98,8 @@ const ack = (ev: CustomEvent) => widgetApi.transport.reply(ev new Promise(resolve => { widgetApi.once(`action:${ElementWidgetActions.ClientReady}`, ev => { ev.preventDefault(); - widgetApi.transport.reply(ev.detail, {}); resolve(); + widgetApi.transport.reply(ev.detail, {}); }); }), new Promise(resolve => { @@ -145,6 +145,7 @@ const ack = (ev: CustomEvent) => widgetApi.transport.reply(ev widgetApi.on(`action:${ElementWidgetActions.JoinCall}`, (ev: CustomEvent) => { + ev.preventDefault(); const { audioDevice, videoDevice } = ev.detail.data; joinConference(audioDevice as string | null, videoDevice as string | null); ack(ev); @@ -152,12 +153,14 @@ const ack = (ev: CustomEvent) => widgetApi.transport.reply(ev ); widgetApi.on(`action:${ElementWidgetActions.HangupCall}`, (ev: CustomEvent) => { + ev.preventDefault(); meetApi?.executeCommand('hangup'); ack(ev); }, ); widgetApi.on(`action:${ElementWidgetActions.ForceHangupCall}`, (ev: CustomEvent) => { + ev.preventDefault(); meetApi?.dispose(); notifyHangup(); meetApi = null; @@ -167,38 +170,43 @@ const ack = (ev: CustomEvent) => widgetApi.transport.reply(ev ); widgetApi.on(`action:${ElementWidgetActions.MuteAudio}`, async (ev: CustomEvent) => { - ack(ev); + ev.preventDefault(); if (meetApi && !await meetApi.isAudioMuted()) { meetApi.executeCommand('toggleAudio'); } + ack(ev); }, ); widgetApi.on(`action:${ElementWidgetActions.UnmuteAudio}`, async (ev: CustomEvent) => { - ack(ev); + ev.preventDefault(); if (meetApi && await meetApi.isAudioMuted()) { meetApi.executeCommand('toggleAudio'); } + ack(ev); }, ); widgetApi.on(`action:${ElementWidgetActions.MuteVideo}`, async (ev: CustomEvent) => { - ack(ev); + ev.preventDefault(); if (meetApi && !await meetApi.isVideoMuted()) { meetApi.executeCommand('toggleVideo'); } + ack(ev); }, ); widgetApi.on(`action:${ElementWidgetActions.UnmuteVideo}`, async (ev: CustomEvent) => { - ack(ev); + ev.preventDefault(); if (meetApi && await meetApi.isVideoMuted()) { meetApi.executeCommand('toggleVideo'); } + ack(ev); }, ); widgetApi.on(`action:${ElementWidgetActions.StartLiveStream}`, (ev: CustomEvent) => { + ev.preventDefault(); if (meetApi) { meetApi.executeCommand('startRecording', { mode: 'stream',