AI-generated Key Takeaways
- 
          CameraXSource manages the camera in conjunction with a Detector and DetectionTaskCallback, receiving and processing preview frames from the camera. 
- 
          This camera source utilizes CameraX APIs internally and requires the android.permissions.CAMERApermission.
- 
          CameraXSource can be created with a CameraSourceConfig and optionally a PreviewView to display camera preview frames. 
- 
          Key methods include start()to open and begin processing,stop()to halt and release camera resources, andclose()to release all resources.
- 
          You can retrieve the selected camera facing (front or back) using getCameraFacing()and the current preview size usinggetPreviewSize().
implements LifecycleOwner
Manages the camera in conjunction with an underlying Detector and
      DetectionTaskCallback.
      This receives preview frames from the camera at a specified rate, sending those frames to the
      detector as fast as it is able to process those frames.
This camera source is using CameraX APIs internally.
The following Android permission is required to use the camera:
- android.permissions.CAMERA
Public Constructor Summary
| 
                  
                  CameraXSource(CameraSourceConfig
                  cameraSourceConfig)
                   
                    Create a  CameraXSourcewith givenCameraSourceConfig. | |
| 
                  
                  CameraXSource(CameraSourceConfig
                  cameraSourceConfig, PreviewView previewView)
                   
                    Create a  CameraXSourcewith givenCameraSourceConfigand aPreviewViewfor the preview frames to be displayed to the user. | 
Public Method Summary
| void | 
                  close()
                   
                    Closes the camera and releases the resources of the camera and underlying
                    detector.
                   | 
| int | 
                  
                  getCameraFacing()
                   
                    Returns the selected camera; one of  
                    CameraSourceConfig.CAMERA_FACING_BACKor
                    CameraSourceConfig.CAMERA_FACING_FRONT. | 
| Size | 
                  
                  getPreviewSize()
                   
                    Returns the preview size that is currently in use by the underlying camera.
                   | 
| void | 
                  start()
                   
                    Opens the camera and starts sending preview frames to the underlying detector.
                   | 
| void | 
                  stop()
                   
                    Stops the camera and releases the resources of the camera.
                   | 
Inherited Method Summary
Public Constructors
public CameraXSource (CameraSourceConfig cameraSourceConfig)
Create a CameraXSource
            with given CameraSourceConfig.
public CameraXSource (CameraSourceConfig cameraSourceConfig, PreviewView previewView)
Create a CameraXSource
            with given CameraSourceConfig
            and a PreviewView for
            the preview frames to be displayed to the user.
Public Methods
public void close ()
Closes the camera and releases the resources of the camera and underlying detector.
public int getCameraFacing ()
Returns the selected camera; one of 
            CameraSourceConfig.CAMERA_FACING_BACK or 
            CameraSourceConfig.CAMERA_FACING_FRONT.
public Size getPreviewSize ()
Returns the preview size that is currently in use by the underlying camera. The result could be null if the PreviewView has not been started.
public void start ()
Opens the camera and starts sending preview frames to the underlying detector.
public void stop ()
Stops the camera and releases the resources of the camera.
