Skip to content

Add muteOthers capability to Call and RemoteParticipant #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
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
20 changes: 14 additions & 6 deletions Project/src/MakeCall/CallCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export default class CallCard extends React.Component {
canShareScreen: this.capabilities.shareScreen?.isPresent || this.capabilities.shareScreen?.reason === 'FeatureNotSupported',
canRaiseHands: this.capabilities.raiseHand?.isPresent || this.capabilities.raiseHand?.reason === 'FeatureNotSupported',
canSpotlight: this.capabilities.spotlightParticipant?.isPresent || this.capabilities.spotlightParticipant?.reason === 'FeatureNotSupported',
canMuteOthers: this.capabilities.muteOthers?.isPresent || this.capabilities.muteOthers?.reason === 'FeatureNotSupported',
canReact: this.capabilities.useReactions?.isPresent || this.capabilities.useReactions?.reason === 'FeatureNotSupported',
videoOn: this.call.isLocalVideoStarted,
screenSharingOn: this.call.isScreenSharingOn,
Expand Down Expand Up @@ -612,6 +613,10 @@ export default class CallCard extends React.Component {
(value.isPresent) ? this.setState({ canRaiseHands: true }) : this.setState({ canRaiseHands: false });
continue;
}
if(key === 'muteOthers' && value.reason != 'FeatureNotSupported') {
(value.isPresent) ? this.setState({ canMuteOthers: true }) : this.setState({ canMuteOthers: false });
continue;
}
if(key === 'reaction' && value.reason != 'FeatureNotSupported') {
(value.isPresent) ? this.setState({ canReact: true }) : this.setState({ canReact: false });
continue;
Expand Down Expand Up @@ -1319,12 +1324,15 @@ export default class CallCard extends React.Component {
<Icon iconName="Volume2" />
}
</span>
<span className="in-call-button"
title={`Mute all other participants`}
variant="secondary"
onClick={() => this.handleMuteAllRemoteParticipants()}>
<Icon iconName="VolumeDisabled" />
</span>
{
this.state.canMuteOthers &&
<span className="in-call-button"
title={`Mute all other participants`}
variant="secondary"
onClick={() => this.handleMuteAllRemoteParticipants()}>
<Icon iconName="VolumeDisabled" />
</span>
}
<span className="in-call-button"
title={`${this.state.screenSharingOn && this.localScreenSharingStream?.mediaStreamType === 'RawMedia' ? 'Stop' : 'Start'} screen sharing a dummy stream`}
variant="secondary"
Expand Down
7 changes: 6 additions & 1 deletion Project/src/MakeCall/RemoteParticipantCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default class RemoteParticipantCard extends React.Component {
isHandRaised: utils.isParticipantHandRaised(this.remoteParticipant.identifier, this.raiseHandFeature.getRaisedHands()),
isSpotlighted: utils.isParticipantHandRaised(this.remoteParticipant.identifier, this.spotlightFeature.getSpotlightedParticipants()),
canManageLobby: this.capabilities.manageLobby?.isPresent || this.capabilities.manageLobby?.reason === 'FeatureNotSupported',
canMuteOthers: this.capabilities.muteOthers?.isPresent || this.capabilities.muteOthers?.reason === 'FeatureNotSupported',
};
}

Expand Down Expand Up @@ -108,7 +109,11 @@ export default class RemoteParticipantCard extends React.Component {

handleMuteParticipant(e, remoteParticipant) {
e.preventDefault();
remoteParticipant.mute?.().catch((e) => console.error('Failed to mute specific participant.', e))
if (this.state.canMuteOthers) {
remoteParticipant.mute?.().catch((e) => console.error('Failed to mute specific participant.', e.message, e));
} else {
console.error('Soft mute of remote participants is not a supported capability for this participant.');
}
}

handleCheckboxChange(e) {
Expand Down
Loading