Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/vector/jitsi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ let jitsiAuth: string;
let roomId: string;

let widgetApi: WidgetApi;
let meetApi: any; // JitsiMeetExternalAPI

(async function() {
try {
Expand Down Expand Up @@ -88,7 +89,12 @@ let widgetApi: WidgetApi;
} else {
enableJoinButton();
}

// TODO: register widgetApi listeners for PTT controls (https://github.com/vector-im/riot-web/issues/12795)

widgetApi.on('hangup', () => {
if (meetApi) meetApi.executeCommand('hangup');
});
} else {
enableJoinButton();
}
Expand Down Expand Up @@ -199,7 +205,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);
Expand All @@ -214,5 +220,6 @@ function joinConference() { // event handler bound in HTML
}

document.getElementById("jitsiContainer").innerHTML = "";
meetApi = null;
});
}