Skip to content
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

fix: Moderated unmute mode not working when web client is remotely muted #4039

Draft
wants to merge 1 commit into
base: next
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions packages/@webex/plugin-meetings/src/locus-info/selfUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ SelfUtils.mutedByOthersChanged = (oldSelf, changedSelf) => {
return false;
}

// there is no need to trigger user update if no one muted user
if (changedSelf.selfIdentity === changedSelf.modifiedBy) {
return false;
}

return (
changedSelf.remoteMuted !== null &&
(oldSelf.remoteMuted !== changedSelf.remoteMuted ||
Expand Down
7 changes: 1 addition & 6 deletions packages/@webex/plugin-meetings/src/meeting/muteState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,7 @@ export class MuteState {
}
if (muted !== undefined) {
this.state.server.remoteMute = muted;

// We never want to unmute the local stream from a server remote mute update.
// Moderated unmute is handled by a different function.
if (muted) {
this.muteLocalStream(meeting, muted, 'remotelyMuted');
}
this.muteLocalStream(meeting, muted, 'remotelyMuted');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,39 +345,37 @@ describe('plugin-meetings', () => {
});

describe('mutedByOthersChanged', () => {
it('throws an error if changedSelf is not provided', function () {
assert.throws(
() => SelfUtils.mutedByOthersChanged({}, null),
'New self must be defined to determine if self was muted by others.'
);
it('throws an error if changedSelf is not provided', function() {
assert.throws(() => SelfUtils.mutedByOthersChanged({}, null), 'New self must be defined to determine if self was muted by others.');
});

it('return false when oldSelf is not defined', function () {
assert.equal(SelfUtils.mutedByOthersChanged(null, {remoteMuted: false}), false);
it('return false when oldSelf is not defined', function() {
assert.equal(SelfUtils.mutedByOthersChanged(null, { remoteMuted: false }), false);
});

it('should return true when remoteMuted is true on entry', function () {
assert.equal(SelfUtils.mutedByOthersChanged(null, {remoteMuted: true}), true);
it('should return true when remoteMuted is true on entry', function() {
assert.equal(SelfUtils.mutedByOthersChanged(null, { remoteMuted: true }), true);
});

it('should return true when remoteMuted values are different', function () {
assert.equal(
SelfUtils.mutedByOthersChanged(
{remoteMuted: false},
{remoteMuted: true, selfIdentity: 'user1', modifiedBy: 'user2'}
),
true
);
it('should return false when selfIdentity and modifiedBy are the same', function() {
assert.equal(SelfUtils.mutedByOthersChanged(
{ remoteMuted: false },
{ remoteMuted: true, selfIdentity: 'user1', modifiedBy: 'user1' }
), false);
});

it('should return true when remoteMuted is true and unmuteAllowed has changed', function () {
assert.equal(
SelfUtils.mutedByOthersChanged(
{remoteMuted: true, unmuteAllowed: false},
{remoteMuted: true, unmuteAllowed: true, selfIdentity: 'user1', modifiedBy: 'user2'}
),
true
);
it('should return true when remoteMuted values are different', function() {
assert.equal(SelfUtils.mutedByOthersChanged(
{ remoteMuted: false },
{ remoteMuted: true, selfIdentity: 'user1', modifiedBy: 'user2' }
), true);
});

it('should return true when remoteMuted is true and unmuteAllowed has changed', function() {
assert.equal(SelfUtils.mutedByOthersChanged(
{ remoteMuted: true, unmuteAllowed: false },
{ remoteMuted: true, unmuteAllowed: true, selfIdentity: 'user1', modifiedBy: 'user2' }
), true);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,6 @@ describe('plugin-meetings', () => {
assert.isTrue(audio.isRemotelyMuted());
});

it('does not locally unmute on a server unmute', async () => {
const setServerMutedSpy = meeting.mediaProperties.audioStream.setServerMuted;

// simulate remote mute
audio.handleServerRemoteMuteUpdate(meeting, true, true);

assert.isTrue(audio.isRemotelyMuted());
assert.isTrue(audio.isLocallyMuted());

// mutes local
assert.calledOnceWithExactly(setServerMutedSpy, true, 'remotelyMuted');

setServerMutedSpy.resetHistory();

// simulate remote unmute
audio.handleServerRemoteMuteUpdate(meeting, false, true);

assert.isFalse(audio.isRemotelyMuted());
assert.isTrue(audio.isLocallyMuted());

// does not unmute local
assert.notCalled(setServerMutedSpy);
});

it('does local audio unmute if localAudioUnmuteRequired is received', async () => {
// first we need to have the local stream user muted
meeting.mediaProperties.audioStream.userMuted = true;
Expand Down
Loading