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

VIH-10603 Fix - mic still audible when host chooses to enter hearing muted #2125

Merged
merged 2 commits into from
Apr 16, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -1081,53 +1081,45 @@ describe('HearingControlsBaseComponent', () => {
});
});

describe('ngOnInit', () => {
describe('handleHearingCountdownComplete for host', () => {
let conferenceSetting: ConferenceSetting;

beforeEach(() => {
conferenceSetting = new ConferenceSetting('conferenceId', true);
component.participant = globalConference.participants.find(x => x.role === Role.Judge);
component.isPrivateConsultation = false;
videoCallServiceSpy.toggleMute.calls.reset();
eventsServiceSpy.sendMediaStatus.calls.reset();
});

it('should mute audio when starting with audio muted', () => {
it('should not unmute audio when host requests to start with audio muted', async () => {
// Arrange
conferenceSetting.startWithAudioMuted = true;
userMediaServiceSpy.getConferenceSetting.and.returnValue(conferenceSetting);
videoCallServiceSpy.toggleMute.and.returnValue(true);
// Act
component.ngOnInit();
await component.handleHearingCountdownComplete(component.conferenceId);
// Assert
expect(component.audioMuted).toBeTrue();
expect(videoCallServiceSpy.toggleMute).toHaveBeenCalledTimes(1);
expect(eventsServiceSpy.sendMediaStatus).toHaveBeenCalledWith(
jasmine.any(String),
jasmine.any(String),
jasmine.objectContaining({ is_local_audio_muted: true })
);
});

it('should not mute audio when not starting with audio muted', () => {
it('should unmute audio when host requests to start without audio muted', async () => {
// Arrange
conferenceSetting.startWithAudioMuted = false;
userMediaServiceSpy.getConferenceSetting.and.returnValue(conferenceSetting);
// Act
component.ngOnInit();
// Assert
expect(component.audioMuted).toBeFalse();
});
});

describe('handleHearingCountdownComplete', () => {
let conferenceSetting: ConferenceSetting;

beforeEach(() => {
conferenceSetting = new ConferenceSetting('conferenceId', true);
videoCallService.toggleMute.calls.reset();
});

it('should not unmute audio when host is starting with audio muted', async () => {
// Arrange
component.participant = globalConference.participants.find(x => x.role === Role.Judge);
conferenceSetting.startWithAudioMuted = true;
userMediaServiceSpy.getConferenceSetting.and.returnValue(conferenceSetting);
component.isPrivateConsultation = false;
component.audioMuted = true;
// Act
component.ngOnInit();
await component.handleHearingCountdownComplete(component.conferenceId);
// Assert
expect(videoCallService.toggleMute).toHaveBeenCalledTimes(0);
expect(videoCallServiceSpy.toggleMute).toHaveBeenCalledTimes(0);
expect(eventsServiceSpy.sendMediaStatus).toHaveBeenCalledTimes(0);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export abstract class HearingControlsBaseComponent implements OnInit, OnDestroy
}

ngOnInit(): void {
this.audioMuted = this.videoCallService.pexipAPI.call.mutedAudio || this.startWithAudioMuted;
this.audioMuted = this.videoCallService.pexipAPI.call.mutedAudio;
this.videoMuted = this.videoCallService.pexipAPI.call.mutedVideo || this.audioOnly;

this.userMediaService.isAudioOnly$.pipe(takeUntil(this.destroyedSubject)).subscribe(audioOnly => {
Expand Down
Loading