Java Code Examples for org.webrtc.CameraEnumerator#getDeviceNames()
The following examples show how to use
org.webrtc.CameraEnumerator#getDeviceNames() .
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: Camera.java From mollyim-android with GNU General Public License v3.0 | 7 votes |
public Camera(@NonNull Context context, @NonNull CameraEventListener cameraEventListener, @NonNull EglBase eglBase) { this.context = context; this.cameraEventListener = cameraEventListener; this.eglBase = eglBase; CameraEnumerator enumerator = getCameraEnumerator(context); cameraCount = enumerator.getDeviceNames().length; CameraVideoCapturer capturerCandidate = createVideoCapturer(enumerator, FRONT); if (capturerCandidate != null) { activeDirection = FRONT; } else { capturerCandidate = createVideoCapturer(enumerator, BACK); if (capturerCandidate != null) { activeDirection = BACK; } else { activeDirection = NONE; } } capturer = capturerCandidate; }
Example 2
Source File: PeerConnectionWrapper.java From bcm-android with GNU General Public License v3.0 | 6 votes |
Camera(@NonNull Context context, @NonNull CameraEventListener cameraEventListener) { this.cameraEventListener = cameraEventListener; CameraEnumerator enumerator = getCameraEnumerator(context); cameraCount = enumerator.getDeviceNames().length; CameraVideoCapturer cameraVideoCapturer = createVideoCapturer(enumerator, FRONT); if (cameraVideoCapturer != null) { activeDirection = FRONT; } else { cameraVideoCapturer = createVideoCapturer(enumerator, BACK); if (cameraVideoCapturer != null) { activeDirection = BACK; } else { activeDirection = NONE; } } capturer = cameraVideoCapturer; }
Example 3
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 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; }