Skip to content

Commit 8af8771

Browse files
authored
Merge pull request #476 from ant-media/effect-camera
Remove video effect check from turn off local camera
2 parents 4b03cb1 + 38348d7 commit 8af8771

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

react/src/__tests__/pages/AntMedia.test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,6 +3815,33 @@ describe('AntMedia Component', () => {
38153815

38163816
consoleSpy.mockRestore();
38173817
});
3818+
3819+
describe('checkAndTurnOffLocalCamera', () => {
3820+
it('should call webRTCAdaptor.turnOffLocalCamera with the correct stream id', async () => {
3821+
const { container } = render(
3822+
<AntMedia isTest={true}>
3823+
<MockChild/>
3824+
</AntMedia>
3825+
);
3826+
3827+
await waitFor(() => {
3828+
expect(webRTCAdaptorConstructor).not.toBe(undefined);
3829+
});
3830+
3831+
currentConference.isMyMicMuted = false;
3832+
await act(async () => {
3833+
currentConference.setPublishStreamId('test-stream-id');
3834+
});
3835+
3836+
// Call the function
3837+
await act(async () => {
3838+
currentConference.checkAndTurnOffLocalCamera();
3839+
});
3840+
3841+
// Assertion: only check the observable side effect
3842+
expect(webRTCAdaptorConstructor.turnOffLocalCamera).toHaveBeenCalledWith('test-stream-id');
3843+
});
3844+
});
38183845
});
38193846

38203847

react/src/pages/AntMedia.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2946,11 +2946,7 @@ function AntMedia(props) {
29462946
}
29472947

29482948
function checkAndTurnOffLocalCamera(streamId) {
2949-
if (isVideoEffectRunning) {
2950-
webRTCAdaptor?.turnOffEffectCamera();
2951-
} else {
29522949
webRTCAdaptor?.turnOffLocalCamera(publishStreamId);
2953-
}
29542950

29552951
updateUserStatusMetadata(isMyMicMuted, false);
29562952
setIsMyCamTurnedOff(true);

0 commit comments

Comments
 (0)