# Camera1ApiManager

open class Camera1ApiManager : Camera.PreviewCallback, Camera.FaceDetectionListener

Created by pedro on 20/01/17. This class need use same resolution, fps and imageFormat that VideoEncoder Tested with YV12 and NV21.

Advantage = you can control fps of the stream. Disadvantages = you cant use all resolutions, only resolution that your camera support.

If you want use all resolutions. You can use libYuv for resize images in OnPreviewFrame: https://chromium.googlesource.com/libyuv/libyuv/

## Constructors

Camera1ApiManager
Link copied to clipboard
constructor(surfaceView: SurfaceView, getCameraData: GetCameraData)
constructor(textureView: TextureView, getCameraData: GetCameraData)
constructor(surfaceTexture: SurfaceTexture, context: Context)

## Properties

height
Link copied to clipboard
open val height: Int
previewSizeBack
Link copied to clipboard
open val previewSizeBack: List<Camera.Size>
previewSizeFront
Link copied to clipboard
open val previewSizeFront: List<Camera.Size>
width
Link copied to clipboard
open val width: Int

## Functions

disableAutoFocus
Link copied to clipboard
open fun disableAutoFocus(): Boolean
disableFaceDetection
Link copied to clipboard
open fun disableFaceDetection()
disableLantern
Link copied to clipboard
open fun disableLantern()
@required:
disableRecordingHint
Link copied to clipboard
open fun disableRecordingHint()
disableVideoStabilization
Link copied to clipboard
open fun disableVideoStabilization()
enableAutoFocus
Link copied to clipboard
open fun enableAutoFocus(): Boolean
enableAutoWhiteBalance
Link copied to clipboard
open fun enableAutoWhiteBalance(mode: String): Boolean
enableFaceDetection
Link copied to clipboard
open fun enableFaceDetection(faceDetectorCallback: FaceDetectorCallback): Boolean
enableLantern
Link copied to clipboard
open fun enableLantern()
enableRecordingHint
Link copied to clipboard
open fun enableRecordingHint()
enableVideoStabilization
Link copied to clipboard
open fun enableVideoStabilization(): Boolean
getAutoWhiteBalanceModesAvailable
Link copied to clipboard
open fun getAutoWhiteBalanceModesAvailable(): List<String>
getCameraFacing
Link copied to clipboard
open fun getCameraFacing(): CameraHelper.Facing
getCameraPreviewImageFormatSupported
Link copied to clipboard
open fun getCameraPreviewImageFormatSupported(): List<Integer>
See: ImageFormat to know name of constant values Example: 842094169 -> YV12, 17 -> NV21
getCameraSize
Link copied to clipboard
open fun getCameraSize(width: Int, height: Int): Camera.Size
getExposure
Link copied to clipboard
open fun getExposure(): Int
getMaxExposure
Link copied to clipboard
open fun getMaxExposure(): Int
getMaxZoom
Link copied to clipboard
open fun getMaxZoom(): Int
getMinExposure
Link copied to clipboard
open fun getMinExposure(): Int
getMinZoom
Link copied to clipboard
open fun getMinZoom(): Int
getSupportedFps
Link copied to clipboard
open fun getSupportedFps(): List<Array<Int>>
getWhiteBalance
Link copied to clipboard
open fun getWhiteBalance(): String
getZoom
Link copied to clipboard
open fun getZoom(): Int
isAutoFocusEnabled
Link copied to clipboard
open fun isAutoFocusEnabled(): Boolean
isFaceDetectionEnabled
Link copied to clipboard
open fun isFaceDetectionEnabled(): Boolean
isLanternEnabled
Link copied to clipboard
open fun isLanternEnabled(): Boolean
isRunning
Link copied to clipboard
open fun isRunning(): Boolean
isVideoStabilizationEnabled
Link copied to clipboard
open fun isVideoStabilizationEnabled(): Boolean
onFaceDetection
Link copied to clipboard
open fun onFaceDetection(faces: Array<Camera.Face>, camera: Camera)
onPreviewFrame
Link copied to clipboard
open fun onPreviewFrame(data: Array<Byte>, camera: Camera)
setCameraCallbacks
Link copied to clipboard
open fun setCameraCallbacks(cameraCallbacks: CameraCallbacks)
setCameraFacing
Link copied to clipboard
open fun setCameraFacing(cameraFacing: CameraHelper.Facing)
setCameraSelect
Link copied to clipboard
open fun setCameraSelect(cameraFacing: Int)
setExposure
Link copied to clipboard
open fun setExposure(value: Int)
setPreviewOrientation
Link copied to clipboard
open fun setPreviewOrientation(orientation: Int)
setRotation
Link copied to clipboard
open fun setRotation(rotation: Int)
setSurfaceTexture
Link copied to clipboard
open fun setSurfaceTexture(surfaceTexture: SurfaceTexture)
setZoom
Link copied to clipboard
open fun setZoom(event: MotionEvent)
open fun setZoom(level: Int)
open fun setZoom(event: MotionEvent, delta: Int)
start
Link copied to clipboard
open fun start(width: Int, height: Int, fps: Int)
open fun start(cameraFacing: CameraHelper.Facing, width: Int, height: Int, fps: Int)
open fun start(facing: Int, width: Int, height: Int, fps: Int)
stop
Link copied to clipboard
open fun stop()
switchCamera
Link copied to clipboard
open fun switchCamera()
open fun switchCamera(cameraId: Int)
tapToFocus
Link copied to clipboard
open fun tapToFocus(view: View, event: MotionEvent): Boolean