Java 类org.webrtc.Camera2Enumerator 实例源码

项目:Achilles_Android    文件:MainActivity.java   
private VideoCapturer createVideoCapturer() {
    VideoCapturer videoCapturer = null;
    Log.d(TAG, "Creating capturer using camera2 API.");

    // Creating camera capturer
    Camera2Enumerator enumerator = new Camera2Enumerator(this);
    final String[] deviceNames = enumerator.getDeviceNames();
    Log.d(TAG, "Looking for back facing cameras.");
    for (String deviceName : deviceNames) {
        if (enumerator.isBackFacing(deviceName)) {
            Log.d(TAG, "Creating back facing camera capturer.");
            videoCapturer = enumerator.createCapturer(deviceName, null);
            break;
        }
    }

    if (videoCapturer == null) {
        Log.e(TAG, "Failed to open camera.");
        return null;
    }
    return videoCapturer;
}
项目:video-quickstart-android    文件:CameraCapturerCompat.java   
private void setCameraPairs(Context context) {
    Camera2Enumerator camera2Enumerator = new Camera2Enumerator(context);
    for (String cameraId : camera2Enumerator.getDeviceNames()) {
        if (camera2Enumerator.isFrontFacing(cameraId)) {
            frontCameraPair = new Pair<>(CameraCapturer.CameraSource.FRONT_CAMERA, cameraId);
        }
        if (camera2Enumerator.isBackFacing(cameraId)) {
            backCameraPair = new Pair<>(CameraCapturer.CameraSource.BACK_CAMERA, cameraId);
        }
    }
}
项目:matrix-android-sdk    文件:MXWebRtcCall.java   
/**
 * Get a camera enumerator
 *
 * @param context the context
 * @return the camera enumerator
 */
private static CameraEnumerator getCameraEnumerator(Context context) {
    if (useCamera2(context)) {
        return new Camera2Enumerator(context);
    } else {
        return new Camera1Enumerator(false);
    }
}
项目:AppRTC-Android    文件:CallActivity.java   
private boolean useCamera2() {
  return Camera2Enumerator.isSupported(this) && getIntent().getBooleanExtra(EXTRA_CAMERA2, true);
}
项目:AndroidRTC    文件:CallActivity.java   
private boolean useCamera2() {
    return Camera2Enumerator.isSupported(this) && getIntent().getBooleanExtra(EXTRA_CAMERA2, true);
}
项目:VideoCRE    文件:VideoCapturers.java   
public static VideoCapturer createCamera2Capturer(Context context) {
    return createCameraCapturer(new Camera2Enumerator(context));
}
项目:voip_android    文件:WebRTCActivity.java   
private boolean useCamera2() {
    return Camera2Enumerator.isSupported(this) && getIntent().getBooleanExtra(EXTRA_CAMERA2, true);
}
项目:matrix-android-sdk    文件:MXWebRtcCall.java   
/**
 * Tells if the camera2 Api is supported
 *
 * @param context the context
 * @return true if the Camera2 API is supported
 */
private static boolean useCamera2(Context context) {
    return Camera2Enumerator.isSupported(context);
}