Table of Contents

Class OnDemandSurfaceTextureCaptureSession

On-demand version of SurfaceTextureCaptureSession.

public class OnDemandSurfaceTextureCaptureSession : SurfaceTextureCaptureSession
Inheritance
object
OnDemandSurfaceTextureCaptureSession
Inherited Members

Remarks

This experimental capture session uses a native OpenGL texture to capture images for better performance and requires OpenGL ES 3.0 as the project's graphics API. Works with single and multi-threaded rendering.

Constructors

OnDemandSurfaceTextureCaptureSession(Resolution)

public OnDemandSurfaceTextureCaptureSession(Resolution resolution)

Parameters

resolution Resolution

Properties

HasFrame

Has the capture session received its first frame?

public bool HasFrame { get; }

Property Value

bool

Methods

Invoke(string, nint)

public override nint Invoke(string methodName, nint javaArgs)

Parameters

methodName string
javaArgs nint

Returns

nint

RequestCapture()

Updates the unity texture with the latest capture from the camera.

public WaitUntil? RequestCapture()

Returns

WaitUntil?

Returns a WaitUntil operation if the renderer was invoked, null otherwise.

RequestCapture(Action<Texture2D, long>)

Updates the unity texture with the latest capture from the camera.

public bool RequestCapture(Action<Texture2D, long> onDone)

Parameters

onDone Action<Texture2D, long>

Called when the capture has been rendered in unity, with its timestamp.

Returns

bool

true if the renderer was invoked, false otherwise.

RequestCapture(TimeSpan, Action, WaitTimeoutMode)

Updates the unity texture with the latest capture from the camera.

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

Parameters

timeout TimeSpan
onTimeout Action
timeoutMode WaitTimeoutMode

Returns

WaitUntil?

Returns a WaitUntil operation if the renderer was invoked, null otherwise.

RequestCaptureAsync(CancellationToken)

Updates the unity texture with the latest capture from the camera.

public Task<(Texture2D?, long)> RequestCaptureAsync(CancellationToken token = default)

Parameters

token CancellationToken

Returns

Task<(Texture2D?, long)>

The rendered texture and timestamp, or default values if the renderer could not be invoked.