From a0b71882bc66cb873df12011472d39366ebf7615 Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Tue, 14 Jun 2022 14:33:05 -0400 Subject: [PATCH 1/2] Don't block muting on determining whether the device exists --- src/webrtc/groupCall.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/webrtc/groupCall.ts b/src/webrtc/groupCall.ts index 5f192a08ec5..3c962299ccb 100644 --- a/src/webrtc/groupCall.ts +++ b/src/webrtc/groupCall.ts @@ -458,8 +458,11 @@ export class GroupCall extends TypedEventEmitter { + // hasAudioDevice can block indefinitely if the window has lost focus, + // and it doesn't make much sense to keep a device from being muted, so + // we always allow muted = true changes to go through + if (!muted && !await this.client.getMediaHandler().hasAudioDevice()) { return false; } @@ -516,8 +519,8 @@ export class GroupCall extends TypedEventEmitter { + if (!muted && !await this.client.getMediaHandler().hasVideoDevice()) { return false; } From eb6155a82535a6af09beed4e4817d5e8f77d9312 Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Thu, 16 Jun 2022 13:45:37 -0400 Subject: [PATCH 2/2] Add comments --- src/webrtc/groupCall.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/webrtc/groupCall.ts b/src/webrtc/groupCall.ts index 2bc0affc04a..a9794259f1b 100644 --- a/src/webrtc/groupCall.ts +++ b/src/webrtc/groupCall.ts @@ -458,7 +458,12 @@ export class GroupCall extends TypedEventEmitter { + /** + * Sets the mute state of the local participants's microphone. + * @param {boolean} muted Whether to mute the microphone + * @returns {Promise} Whether muting/unmuting was successful + */ + public async setMicrophoneMuted(muted: boolean): Promise { // hasAudioDevice can block indefinitely if the window has lost focus, // and it doesn't make much sense to keep a device from being muted, so // we always allow muted = true changes to go through @@ -517,9 +522,18 @@ export class GroupCall extends TypedEventEmitter { + /** + * Sets the mute state of the local participants's video. + * @param {boolean} muted Whether to mute the video + * @returns {Promise} Whether muting/unmuting was successful + */ + public async setLocalVideoMuted(muted: boolean): Promise { + // hasAudioDevice can block indefinitely if the window has lost focus, + // and it doesn't make much sense to keep a device from being muted, so + // we always allow muted = true changes to go through if (!muted && !await this.client.getMediaHandler().hasVideoDevice()) { return false; } @@ -536,6 +550,7 @@ export class GroupCall extends TypedEventEmitter