Skip to content

Commit e683f5d

Browse files
authored
ios: enable camera switching (react-native-webrtc#837)
If the devices has been requested with the parameter `deviceId` like this `navigator.mediaDevices.getUserMedia({video: {deviceId: 'n'}})` the method `_switchCamera` will not work. Setting the `_deviceId` to `NULL` in the `switchCamera` method will allow the change.
1 parent 059aca9 commit e683f5d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ios/RCTWebRTC/VideoCaptureController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ -(void)stopCapture {
116116

117117
-(void)switchCamera {
118118
_usingFrontCamera = !_usingFrontCamera;
119+
_deviceId = NULL;
119120

120121
[self startCapture];
121122
}

0 commit comments

Comments
 (0)