From 748bb4c6f1b06be898a1d05b0fe42f71e5c52389 Mon Sep 17 00:00:00 2001 From: Ayman-Barghout Date: Sat, 5 Jun 2021 12:03:40 +0200 Subject: [PATCH] [Android] falling back to the first available camera fix #580 --- .../java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java b/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java index 4ab58812b4..9ba1e7d7c3 100755 --- a/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java +++ b/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java @@ -279,7 +279,13 @@ private VideoCapturer createVideoCapturer( } } } - // should we fallback to available camera automatically? + + // falling back to the first available camera + if (videoCapturer == null && deviceNames.length > 0){ + videoCapturer = enumerator.createCapturer(deviceNames[0], new CameraEventsHandler()); + Log.d(TAG, "Falling back to the first available camera"); + } + return videoCapturer; }