react-native-webrtc 106.0.3 → 106.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -128,27 +128,27 @@ public class CameraCaptureController extends AbstractVideoCaptureController {
|
|
|
128
128
|
String[] deviceNames = cameraEnumerator.getDeviceNames();
|
|
129
129
|
List<String> failedDevices = new ArrayList<>();
|
|
130
130
|
|
|
131
|
-
String
|
|
131
|
+
String cameraName = null;
|
|
132
132
|
try {
|
|
133
133
|
int index = Integer.parseInt(deviceId);
|
|
134
|
-
|
|
134
|
+
cameraName = deviceNames[index];
|
|
135
135
|
} catch (Exception e) {
|
|
136
136
|
Log.d(TAG, "failed to find device with id: " + deviceId);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
// If deviceId is specified, then it takes precedence over facingMode.
|
|
140
|
-
if (
|
|
140
|
+
if (cameraName != null) {
|
|
141
141
|
VideoCapturer videoCapturer
|
|
142
|
-
= cameraEnumerator.createCapturer(
|
|
143
|
-
String message = "Create user-specified camera " +
|
|
142
|
+
= cameraEnumerator.createCapturer(cameraName, cameraEventsHandler);
|
|
143
|
+
String message = "Create user-specified camera " + cameraName;
|
|
144
144
|
if (videoCapturer != null) {
|
|
145
145
|
Log.d(TAG, message + " succeeded");
|
|
146
|
-
this.isFrontFacing = cameraEnumerator.isFrontFacing(
|
|
146
|
+
this.isFrontFacing = cameraEnumerator.isFrontFacing(cameraName);
|
|
147
147
|
return videoCapturer;
|
|
148
148
|
} else {
|
|
149
149
|
// fallback to facingMode
|
|
150
150
|
Log.d(TAG, message + " failed");
|
|
151
|
-
failedDevices.add(
|
|
151
|
+
failedDevices.add(cameraName);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -159,17 +159,7 @@ public class CameraCaptureController extends AbstractVideoCaptureController {
|
|
|
159
159
|
if (failedDevices.contains(name)) {
|
|
160
160
|
continue;
|
|
161
161
|
}
|
|
162
|
-
|
|
163
|
-
// This can throw an exception when using the Camera 1 API.
|
|
164
|
-
if (cameraEnumerator.isFrontFacing(name) != isFrontFacing) {
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
} catch (Exception e) {
|
|
168
|
-
Log.e(
|
|
169
|
-
TAG,
|
|
170
|
-
"Failed to check the facing mode of camera " + name,
|
|
171
|
-
e);
|
|
172
|
-
failedDevices.add(name);
|
|
162
|
+
if (cameraEnumerator.isFrontFacing(name) != isFrontFacing) {
|
|
173
163
|
continue;
|
|
174
164
|
}
|
|
175
165
|
VideoCapturer videoCapturer
|
|
@@ -198,7 +188,6 @@ public class CameraCaptureController extends AbstractVideoCaptureController {
|
|
|
198
188
|
} else {
|
|
199
189
|
Log.d(TAG, message + " failed");
|
|
200
190
|
failedDevices.add(name);
|
|
201
|
-
// fallback to the next device.
|
|
202
191
|
}
|
|
203
192
|
}
|
|
204
193
|
}
|