CameraInstance

= a handler class used to deal with the camera2 api

Methods

  • openCamera()

    • initiates the camera
  • setUpCameraOutputs()

    • iterates over cameraDevices (cameraIdList)
    • checks preview sizes → chooseOptimalSize() → mPreviewSize
  • chooseOptimalSize()

    • chooses the biggest possible size from a given array of sizes

Variables

  • mPreviewSize: biggest possible preview size

Sequence

  1. SurfaceTextureListener
    1. onSurfaceTextureAvailable → openCamera()
    2. onSurfaceTextureChanged → configureTransform()
  2. openCamera()
    1. setUpCameraOutputs()
    2. manager.openCamera → mStateCallback
  3. mStateCallback
    1. onOpened → createCameraPreviewSession()
    2. else → close cameraDevice (and finish activity)
  4. createCameraPreviewSession()
    1. mPreviewRequestBuilder
    2. createCaptureSession() → captureSessionStateCallback
  5. captureSessionStateCallback
    1. onConfigured → configure mPreviewRequestBuilder