mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-08-31 06:02:09 +00:00
Jitsi widget supports muting/unmuting at will
This commit is contained in:
parent
c811b273dd
commit
8eb52712bf
@ -46,10 +46,38 @@ export class JitsiWidgetWrapperComponent extends CapableWidget implements OnInit
|
||||
$.getScript(widget.options.scriptUrl);
|
||||
});
|
||||
this.jitsiApiSubscription = ScalarWidgetApi.requestReceived.subscribe(request => {
|
||||
if (request.action === "audioMuteToggle" && this.isJoined) {
|
||||
this.jitsiApiObj.executeCommand('toggleAudio');
|
||||
ScalarWidgetApi.replyAcknowledge(request);
|
||||
if (!this.isJoined) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (request.action) {
|
||||
case "audioToggle":
|
||||
this.jitsiApiObj.executeCommand('toggleAudio');
|
||||
break;
|
||||
case "audioMute":
|
||||
this.jitsiApiObj.isAudioMuted().then((muted) => {
|
||||
// Toggle audio if Jitsi is not currently muted
|
||||
if (!muted) {
|
||||
this.jitsiApiObj.executeCommand('toggleAudio');
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "audioUnmute":
|
||||
this.jitsiApiObj.isAudioMuted().then((muted) => {
|
||||
// Toggle audio if Jitsi is currently muted
|
||||
if (muted) {
|
||||
this.jitsiApiObj.executeCommand('toggleAudio');
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
// Unknown command sent
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Travis, should this fire even if we didn't get a command we're
|
||||
// handling?
|
||||
ScalarWidgetApi.replyAcknowledge(request);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user