From 737fa7dca5814a6ad6f8308bbbd23aada500e834 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 16 Sep 2020 14:39:40 -0600 Subject: [PATCH 1/2] Jitsi widget wrapper updates for hangup button See https://github.com/matrix-org/matrix-react-sdk/pull/5223 --- src/vector/jitsi/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index 6e697fee2f..e376a34d66 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -40,6 +40,7 @@ let jitsiAuth: string; let roomId: string; let widgetApi: WidgetApi; +let meetApi: any; // JitsiMeetExternalAPI (async function() { try { @@ -88,7 +89,13 @@ let widgetApi: WidgetApi; } else { enableJoinButton(); } + // TODO: register widgetApi listeners for PTT controls (https://github.com/vector-im/riot-web/issues/12795) + + widgetApi.on('hangup', () => { + console.log("@@ HANGUP"); + if (meetApi) meetApi.executeCommand('hangup'); + }); } else { enableJoinButton(); } @@ -199,7 +206,7 @@ function joinConference() { // event handler bound in HTML jwt: jwt, }; - const meetApi = new JitsiMeetExternalAPI(jitsiDomain, options); + meetApi = new JitsiMeetExternalAPI(jitsiDomain, options); if (displayName) meetApi.executeCommand("displayName", displayName); if (avatarUrl) meetApi.executeCommand("avatarUrl", avatarUrl); if (userId) meetApi.executeCommand("email", userId); @@ -214,5 +221,6 @@ function joinConference() { // event handler bound in HTML } document.getElementById("jitsiContainer").innerHTML = ""; + meetApi = null; }); } From 05d5e3f68036757ab0732c530a41da10f8cc9456 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 17 Sep 2020 14:59:43 -0600 Subject: [PATCH 2/2] Remove debugging --- src/vector/jitsi/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index e376a34d66..ca32ea7540 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -93,7 +93,6 @@ let meetApi: any; // JitsiMeetExternalAPI // TODO: register widgetApi listeners for PTT controls (https://github.com/vector-im/riot-web/issues/12795) widgetApi.on('hangup', () => { - console.log("@@ HANGUP"); if (meetApi) meetApi.executeCommand('hangup'); }); } else {