Java Code Examples for org.webrtc.CameraEnumerator#isFrontFacing()
The following examples show how to use
org.webrtc.CameraEnumerator#isFrontFacing() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OwtVideoCapturer.java From owt-client-android with Apache License 2.0 | 6 votes |
private static String getDeviceName(boolean captureToTexture, boolean isCameraFront) { CameraEnumerator enumerator = new Camera1Enumerator(captureToTexture); String deviceName = null; for (String device : enumerator.getDeviceNames()) { if (enumerator.isFrontFacing(device) && isCameraFront) { deviceName = device; break; } if (enumerator.isBackFacing(device) && !isCameraFront) { deviceName = device; break; } } return deviceName == null ? enumerator.getDeviceNames()[0] : deviceName; }
Example 2
Source File: WebRTCWrapper.java From Pix-Art-Messenger with GNU General Public License v3.0 | 6 votes |
private Optional<CapturerChoice> getVideoCapturer() { final CameraEnumerator enumerator = getCameraEnumerator(); final Set<String> deviceNames = ImmutableSet.copyOf(enumerator.getDeviceNames()); for (final String deviceName : deviceNames) { if (enumerator.isFrontFacing(deviceName)) { final CapturerChoice capturerChoice = of(enumerator, deviceName, deviceNames); if (capturerChoice == null) { return Optional.absent(); } capturerChoice.isFrontCamera = true; return Optional.of(capturerChoice); } } if (deviceNames.size() == 0) { return Optional.absent(); } else { return Optional.fromNullable(of(enumerator, Iterables.get(deviceNames, 0), deviceNames)); } }
Example 3
Source File: WebRTCWrapper.java From Conversations with GNU General Public License v3.0 | 6 votes |
private Optional<CapturerChoice> getVideoCapturer() { final CameraEnumerator enumerator = getCameraEnumerator(); final Set<String> deviceNames = ImmutableSet.copyOf(enumerator.getDeviceNames()); for (final String deviceName : deviceNames) { if (enumerator.isFrontFacing(deviceName)) { final CapturerChoice capturerChoice = of(enumerator, deviceName, deviceNames); if (capturerChoice == null) { return Optional.absent(); } capturerChoice.isFrontCamera = true; return Optional.of(capturerChoice); } } if (deviceNames.size() == 0) { return Optional.absent(); } else { return Optional.fromNullable(of(enumerator, Iterables.get(deviceNames, 0), deviceNames)); } }
Example 4
Source File: Camera.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
private @Nullable CameraVideoCapturer createVideoCapturer(@NonNull CameraEnumerator enumerator, @NonNull CameraState.Direction direction) { String[] deviceNames = enumerator.getDeviceNames(); for (String deviceName : deviceNames) { if ((direction == FRONT && enumerator.isFrontFacing(deviceName)) || (direction == BACK && enumerator.isBackFacing(deviceName))) { return enumerator.createCapturer(deviceName, null); } } return null; }
Example 5
Source File: RTCCall.java From meshenger-android with GNU General Public License v3.0 | 5 votes |
private CameraVideoCapturer createCapturer() { CameraEnumerator enumerator = new Camera1Enumerator(); for (String name : enumerator.getDeviceNames()) { if (enumerator.isFrontFacing(name)) { return enumerator.createCapturer(name, null); } } return null; }
Example 6
Source File: PeerConnectionWrapper.java From bcm-android with GNU General Public License v3.0 | 5 votes |
private @Nullable CameraVideoCapturer createVideoCapturer(@NonNull CameraEnumerator enumerator, @NonNull CameraState.Direction direction) { String[] deviceNames = enumerator.getDeviceNames(); for (String deviceName : deviceNames) { if ((direction == FRONT && enumerator.isFrontFacing(deviceName)) || (direction == BACK && enumerator.isBackFacing(deviceName))) { return enumerator.createCapturer(deviceName, null); } } return null; }
Example 7
Source File: VideoCapturerForTest.java From owt-client-android with Apache License 2.0 | 5 votes |
private static String getDeviceName(boolean captureToTexture) { CameraEnumerator enumerator = new Camera1Enumerator(captureToTexture); String deviceName = null; for (String device : enumerator.getDeviceNames()) { if (enumerator.isFrontFacing(device)) { deviceName = device; break; } } return deviceName == null ? enumerator.getDeviceNames()[0] : deviceName; }
Example 8
Source File: RTCCall.java From Meshenger with GNU General Public License v3.0 | 5 votes |
private CameraVideoCapturer createCapturer() { CameraEnumerator enumerator = new Camera1Enumerator(); for (String name : enumerator.getDeviceNames()) { if (enumerator.isFrontFacing(name)) { return enumerator.createCapturer(name, null); } } return null; }