CameraCaptureSessionCompat

class CameraCaptureSessionCompat
kotlin.Any
   ↳ androidx.camera.camera2.impl.compat.CameraCaptureSessionCompat

Helper for accessing features in CameraCaptureSession in a backwards compatible fashion.

Summary

Public methods

static Int
captureBurstRequests(@NonNull captureSession: CameraCaptureSession, @NonNull requests: MutableList<CaptureRequest!>, @NonNull executor: Executor, @NonNull listener: CaptureCallback)

Submit a list of requests to be captured in sequence as a burst.

static Int
captureSingleRequest(@NonNull captureSession: CameraCaptureSession, @NonNull request: CaptureRequest, @NonNull executor: Executor, @NonNull listener: CaptureCallback)

Submit a request for an image to be captured by the camera device.

static Int
setRepeatingBurstRequests(@NonNull captureSession: CameraCaptureSession, @NonNull requests: MutableList<CaptureRequest!>, @NonNull executor: Executor, @NonNull listener: CaptureCallback)

Request endlessly repeating capture of a sequence of images by this capture session.

static Int
setSingleRepeatingRequest(@NonNull captureSession: CameraCaptureSession, @NonNull request: CaptureRequest, @NonNull executor: Executor, @NonNull listener: CaptureCallback)

Request endlessly repeating capture of images by this capture session.

Public methods

captureBurstRequests

static fun captureBurstRequests(@NonNull captureSession: CameraCaptureSession, @NonNull requests: MutableList<CaptureRequest!>, @NonNull executor: Executor, @NonNull listener: CaptureCallback): Int

Submit a list of requests to be captured in sequence as a burst. The burst will be captured in the minimum amount of time possible, and will not be interleaved with requests submitted by other capture or repeat calls.

The behavior of this method matches that of , except that it uses Executor as an argument instead of Handler.

Parameters
requests CameraCaptureSession: the list of settings for this burst capture
executor CameraCaptureSession: the executor which will be used for invoking the listener.
listener CameraCaptureSession: The callback object to notify each time one of the requests in the burst has been processed.
Return
Int: int A unique capture sequence ID used by CameraCaptureSession.CaptureCallback#onCaptureSequenceCompleted.
Exceptions
CameraAccessException if the camera device is no longer connected or has encountered a fatal error
IllegalStateException if this session is no longer active, either because the session was explicitly closed, a new session has been created or the camera device has been closed.
IllegalArgumentException If the requests target no Surfaces, or the requests target Surfaces not currently configured as outputs; or one of the requests targets a set of Surfaces that cannot be submitted simultaneously in a reprocessable capture session; or a reprocess capture request is submitted in a non-reprocessable capture session; or one of the reprocess capture requests was created with a TotalCaptureResult from a different session; or one of the captures targets a Surface in the middle of being prepared; or if the executor is null; or if the listener is null.

captureSingleRequest

static fun captureSingleRequest(@NonNull captureSession: CameraCaptureSession, @NonNull request: CaptureRequest, @NonNull executor: Executor, @NonNull listener: CaptureCallback): Int

Submit a request for an image to be captured by the camera device.

The behavior of this method matches that of , except that it uses Executor as an argument instead of Handler.

Parameters
captureSession CameraCaptureSession: the CameraCaptureSession used to submit the request.
request CameraCaptureSession: the settings for this capture
executor CameraCaptureSession: the executor which will be used for invoking the listener.
listener CameraCaptureSession: The callback object to notify once this request has been processed.
Return
Int: int A unique capture sequence ID used by CameraCaptureSession.CaptureCallback#onCaptureSequenceCompleted.
Exceptions
CameraAccessException if the camera device is no longer connected or has encountered a fatal error
IllegalStateException if this session is no longer active, either because the session was explicitly closed, a new session has been created or the camera device has been closed.
IllegalArgumentException if the request targets no Surfaces or Surfaces that are not configured as outputs for this session; or the request targets a set of Surfaces that cannot be submitted simultaneously in a reprocessable capture session; or a reprocess capture request is submitted in a non-reprocessable capture session; or the reprocess capture request was created with a TotalCaptureResult from a different session; or the capture targets a Surface in the middle of being prepared; or the executor is null, or the listener is not null.

setRepeatingBurstRequests

static fun setRepeatingBurstRequests(@NonNull captureSession: CameraCaptureSession, @NonNull requests: MutableList<CaptureRequest!>, @NonNull executor: Executor, @NonNull listener: CaptureCallback): Int

Request endlessly repeating capture of a sequence of images by this capture session.

The behavior of this method matches that of , except that it uses java.util.concurrent.Executor as an argument instead of android.os.Handler.

Parameters
requests CameraCaptureSession: the list of requests to cycle through indefinitely
executor CameraCaptureSession: the executor which will be used for invoking the listener.
listener CameraCaptureSession: The callback object to notify each time one of the requests in the repeating bursts has finished processing.
Return
Int: int A unique capture sequence ID used by CameraCaptureSession.CaptureCallback#onCaptureSequenceCompleted.
Exceptions
CameraAccessException if the camera device is no longer connected or has encountered a fatal error
IllegalStateException if this session is no longer active, either because the session was explicitly closed, a new session has been created or the camera device has been closed.
IllegalArgumentException If the requests reference no Surfaces or reference Surfaces not currently configured as outputs; or one of the requests is a reprocess capture request; or one of the captures targets a Surface in the middle of being prepared; or the executor is null; or the listener is null.

setSingleRepeatingRequest

static fun setSingleRepeatingRequest(@NonNull captureSession: CameraCaptureSession, @NonNull request: CaptureRequest, @NonNull executor: Executor, @NonNull listener: CaptureCallback): Int

Request endlessly repeating capture of images by this capture session.

The behavior of this method matches that of CameraCaptureSession#setRepeatingRequest(CaptureRequest, * CameraCaptureSession.CaptureCallback, Handler), except that it uses Executor as an argument instead of Handler.

Parameters
request CameraCaptureSession: the request to repeat indefinitely
executor CameraCaptureSession: the executor which will be used for invoking the listener.
listener CameraCaptureSession: The callback object to notify every time the request finishes processing.
Return
Int: int A unique capture sequence ID used by CameraCaptureSession.CaptureCallback#onCaptureSequenceCompleted.
Exceptions
CameraAccessException if the camera device is no longer connected or has encountered a fatal error
IllegalStateException if this session is no longer active, either because the session was explicitly closed, a new session has been created or the camera device has been closed.
IllegalArgumentException If the request references no Surfaces or references Surfaces that are not currently configured as outputs; or the request is a reprocess capture request; or the capture targets a Surface in the middle of being prepared; or the executor is null; or the listener is null.