Java Code Examples for android.hardware.camera2.CameraMetadata#LENS_FACING_FRONT
The following examples show how to use
android.hardware.camera2.CameraMetadata#LENS_FACING_FRONT .
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: Camera2Session.java From webrtc_android with MIT License | 6 votes |
private void start() { checkIsOnCameraThread(); Logging.d(TAG, "start"); try { cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraId); } catch (final CameraAccessException e) { reportError("getCameraCharacteristics(): " + e.getMessage()); return; } cameraOrientation = cameraCharacteristics.get(CameraCharacteristics.SENSOR_ORIENTATION); isCameraFrontFacing = cameraCharacteristics.get(CameraCharacteristics.LENS_FACING) == CameraMetadata.LENS_FACING_FRONT; findCaptureFormat(); openCamera(); }
Example 2
Source File: Camera2Session.java From VideoCRE with MIT License | 6 votes |
private void start() { checkIsOnCameraThread(); Logging.d(TAG, "start"); try { cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraId); } catch (final CameraAccessException e) { reportError("getCameraCharacteristics(): " + e.getMessage()); return; } cameraOrientation = cameraCharacteristics.get(CameraCharacteristics.SENSOR_ORIENTATION); isCameraFrontFacing = cameraCharacteristics.get(CameraCharacteristics.LENS_FACING) == CameraMetadata.LENS_FACING_FRONT; findCaptureFormat(); openCamera(); }
Example 3
Source File: Camera2Enumerator.java From webrtc_android with MIT License | 5 votes |
@Override public boolean isFrontFacing(String deviceName) { CameraCharacteristics characteristics = getCameraCharacteristics(deviceName); return characteristics != null && characteristics.get(CameraCharacteristics.LENS_FACING) == CameraMetadata.LENS_FACING_FRONT; }
Example 4
Source File: CameraUtil.java From Camera2 with Apache License 2.0 | 5 votes |
/** * Given the device orientation and Camera2 characteristics, this returns * the required JPEG rotation for this camera. * * @param deviceOrientationDegrees the clockwise angle of the device orientation from its * natural orientation in degrees. * @return The angle to rotate image clockwise in degrees. It should be 0, 90, 180, or 270. */ public static int getJpegRotation(int deviceOrientationDegrees, CameraCharacteristics characteristics) { if (deviceOrientationDegrees == OrientationEventListener.ORIENTATION_UNKNOWN) { return 0; } boolean isFrontCamera = characteristics.get(CameraCharacteristics.LENS_FACING) == CameraMetadata.LENS_FACING_FRONT; int sensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION); return getImageRotation(sensorOrientation, deviceOrientationDegrees, isFrontCamera); }
Example 5
Source File: CameraDirectionProvider.java From Camera2 with Apache License 2.0 | 5 votes |
public OneCamera.Facing getDirection() { switch (mCharacteristics.get(CameraCharacteristics.LENS_FACING)) { case CameraMetadata.LENS_FACING_BACK: return OneCamera.Facing.BACK; case CameraMetadata.LENS_FACING_FRONT: return OneCamera.Facing.FRONT; } return OneCamera.Facing.BACK; }
Example 6
Source File: Camera2Enumerator.java From VideoCRE with MIT License | 5 votes |
@Override public boolean isFrontFacing(String deviceName) { CameraCharacteristics characteristics = getCameraCharacteristics(deviceName); return characteristics != null && characteristics.get(CameraCharacteristics.LENS_FACING) == CameraMetadata.LENS_FACING_FRONT; }
Example 7
Source File: Camera2ApiManager.java From rtmp-rtsp-stream-client-java with Apache License 2.0 | 4 votes |
private static int getFacing(CameraHelper.Facing facing) { return facing == CameraHelper.Facing.BACK ? CameraMetadata.LENS_FACING_BACK : CameraMetadata.LENS_FACING_FRONT; }