mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04: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);
|
$.getScript(widget.options.scriptUrl);
|
||||||
});
|
});
|
||||||
this.jitsiApiSubscription = ScalarWidgetApi.requestReceived.subscribe(request => {
|
this.jitsiApiSubscription = ScalarWidgetApi.requestReceived.subscribe(request => {
|
||||||
if (request.action === "audioMuteToggle" && this.isJoined) {
|
if (!this.isJoined) {
|
||||||
this.jitsiApiObj.executeCommand('toggleAudio');
|
return;
|
||||||
ScalarWidgetApi.replyAcknowledge(request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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