Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/27858/head
Michael Telatynski 2024-07-25 20:07:00 +01:00
parent dd17436eb0
commit 5a1b38cd74
No known key found for this signature in database
GPG Key ID: A2B008A5F49F5D0D
1 changed files with 8 additions and 4 deletions

View File

@ -195,18 +195,22 @@ const setupCompleted = (async (): Promise<string | void> => {
handleAction(ElementWidgetActions.DeviceMute, async (params) => {
if (!meetApi) return;
const [audioEnabled, videoEnabled] = (
await Promise.all([meetApi.isAudioMuted(), meetApi.isVideoMuted()])
).map((muted) => !muted);
if (Object.keys(params).length === 0) {
// Handle query
return {
audio_enabled: !(await meetApi.isAudioMuted()),
video_enabled: !(await meetApi.isVideoMuted()),
audio_enabled: audioEnabled,
video_enabled: videoEnabled,
};
}
if (params.audio_enabled !== !(await meetApi.isAudioMuted())) {
if (params.audio_enabled !== audioEnabled) {
meetApi.executeCommand("toggleAudio");
}
if (params.video_enabled !== !(await meetApi.isVideoMuted())) {
if (params.video_enabled !== videoEnabled) {
meetApi.executeCommand("toggleVideo");
}
return params;