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
26 changes: 22 additions & 4 deletions src/webrtc/groupCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,16 @@ export class GroupCall extends TypedEventEmitter<GroupCallEvent, GroupCallEventH
return true;
}

public async setMicrophoneMuted(muted) {
if (!await this.client.getMediaHandler().hasAudioDevice()) {
/**
* Sets the mute state of the local participants's microphone.
* @param {boolean} muted Whether to mute the microphone
* @returns {Promise<boolean>} Whether muting/unmuting was successful
*/
public async setMicrophoneMuted(muted: boolean): Promise<boolean> {
// 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;
}

Expand Down Expand Up @@ -514,10 +522,19 @@ export class GroupCall extends TypedEventEmitter<GroupCallEvent, GroupCallEventH
}

this.emit(GroupCallEvent.LocalMuteStateChanged, muted, this.isLocalVideoMuted());
return true;
}

public async setLocalVideoMuted(muted) {
if (!await this.client.getMediaHandler().hasVideoDevice()) {
/**
* Sets the mute state of the local participants's video.
* @param {boolean} muted Whether to mute the video
* @returns {Promise<boolean>} Whether muting/unmuting was successful
*/
public async setLocalVideoMuted(muted: boolean): Promise<boolean> {
// 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;
}

Expand All @@ -533,6 +550,7 @@ export class GroupCall extends TypedEventEmitter<GroupCallEvent, GroupCallEventH
}

this.emit(GroupCallEvent.LocalMuteStateChanged, this.isMicrophoneMuted(), muted);
return true;
}

public async setScreensharingEnabled(
Expand Down