Java Code Examples for org.webrtc.CameraEnumerator#isBackFacing()

The following examples show how to use org.webrtc.CameraEnumerator#isBackFacing() . 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 vote down vote up
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: Camera.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
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 3
Source File: PeerConnectionWrapper.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
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;
}