Table of Contents

Class ContinuousCaptureSession

A wrapper for a native Camera2 CaptureSession and ImageReader.

public class ContinuousCaptureSession : AndroidJavaProxy
Inheritance
object
ContinuousCaptureSession
Derived

Remarks

This is different from OnDemandCaptureSession as it returns a continuous stream of images.

Constructors

ContinuousCaptureSession()

public ContinuousCaptureSession()

Fields

_captureSession

The native capture session object.

protected AndroidJavaObject? _captureSession

Field Value

AndroidJavaObject?

Properties

CurrentState

The current assumed state of the native CaptureSession wrapper.

public NativeWrapperState CurrentState { get; }

Property Value

NativeWrapperState

Methods

DisposeAsync()

Closes and disposes the capture session.

public ValueTask DisposeAsync()

Returns

ValueTask

~ContinuousCaptureSession()

protected ~ContinuousCaptureSession()

Invoke(string, nint)

public override nint Invoke(string methodName, nint javaArgs)

Parameters

methodName string
javaArgs nint

Returns

nint

WaitForInitialization()

Waits until the CaptureSession is open or erred out.

public WaitUntil WaitForInitialization()

Returns

WaitUntil

WaitForInitialization(TimeSpan, Action, WaitTimeoutMode)

Waits until the CaptureSession opens or errs out.

public WaitUntil WaitForInitialization(TimeSpan timeout, Action onTimeout, WaitTimeoutMode timeoutMode = null)

Parameters

timeout TimeSpan
onTimeout Action
timeoutMode WaitTimeoutMode

Returns

WaitUntil

WaitForInitializationAsync(CancellationToken)

Waits until the CaptureSession opens or errs out.

public Task<bool> WaitForInitializationAsync(CancellationToken token = default)

Parameters

token CancellationToken

Returns

Task<bool>

true if the session was opened successfully, false otherwise.

Events

OnDisposeCompleted

Called when the native wrapper has been completely disposed.

protected event Action? OnDisposeCompleted

Event Type

Action

OnFrameReady

Callback for processing the YUV 4:2:0 frame.

public event Action<nint, long, nint, nint, long, int, int, int, long>? OnFrameReady

Event Type

Action<nint, long, nint, nint, long, int, int, int, long>

Remarks

This callback may not be called from the main thread.

Parameters
yBuffer (IntPtr)The pointer to this frame's Y (luminance) data.
yBufferSize (long)The size of the Y buffer in bytes.
uBuffer (IntPtr)The pointer to this frame's U (color) data.
vBuffer (IntPtr)The pointer to this frame's V (color) data.
uvBufferSize (long)The size of the U and V buffers in bytes.
yRowStride (int)The size of each row of the image in yBuffer in bytes.
uvRowStride (int)The size of each row of the image in uBuffer and vBuffer in bytes.
uvPixelStride (int)The size of a pixel in a row of the image in uBuffer and vBuffer in bytes.
timestamp (long)The timestamp the frame was captured at in nanoseconds.

OnSessionActive

Called when the session has started actively processing capture requests.

public event Action? OnSessionActive

Event Type

Action

OnSessionClosed

Called when the session is closed.

public event Action? OnSessionClosed

Event Type

Action

OnSessionConfigurationFailed

Called when the session could not be configured, and a boolean value indicating if the failure was caused due to a camera access/security exception.

public event Action<bool>? OnSessionConfigurationFailed

Event Type

Action<bool>

OnSessionConfigured

Called when the session has been configured.

public event Action? OnSessionConfigured

Event Type

Action

OnSessionRequestFailed

Called when the session request could not be set.

public event Action? OnSessionRequestFailed

Event Type

Action

OnSessionRequestSet

Called when the session request has been set.

public event Action? OnSessionRequestSet

Event Type

Action