Skip to content

Commit 2703121

Browse files
authored
fix: camera toggle along with flip (#1961)
Bug on RN: use camera.flip() to move to rear camera then use camera.toggle() to switch it off, now toggle() it comes back as front camera, but the expectation is to see rear camera ### 📝 Implementation notes Just deselect the device after applying constraints; the native side takes care of the device persistence.
1 parent 885394e commit 2703121

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/client/src/devices/CameraManager.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ export class CameraManager extends DeviceManager<CameraManagerState> {
4343
await videoTrack?.applyConstraints({
4444
facingMode: direction === 'front' ? 'user' : 'environment',
4545
});
46-
this.state.setDirection(direction);
47-
return;
4846
}
4947
// providing both device id and direction doesn't work, so we deselect the device
5048
this.state.setDirection(direction);
5149
this.state.setDevice(undefined);
50+
if (isReactNative()) {
51+
return;
52+
}
5253
this.getTracks().forEach((track) => track.stop());
5354
try {
5455
await this.unmuteStream();

0 commit comments

Comments
 (0)