Table of Contents

Class OnDemandCaptureSession

A wrapper for a native Camera2 CaptureSession and ImageReader.

public class OnDemandCaptureSession : ContinuousCaptureSession
Inheritance
object
OnDemandCaptureSession
Inherited Members

Remarks

This is different from ContinuousCaptureSession as it only returns a frame from the native plugin when required. This is recommended for single-image capturing or on-demand capturing where you don't need a continuous stream of images.

Why does OnDemandCaptureSession inherit from ContinuousCaptureSession? Because under the hood, both do the same thing - a repeating capture session. A true on-demand capture results in a black image, so OnDemandCaptureSession runs a repeating capture request running on an dummy texture natively, and reads the actual image through an ImageReader only when requested to do so. This means that while the ContinuousCaptureSession processes each and every frame sent to it, converting it to RGBA, OnDemandCaptureSession only does it when required.

Methods

RequestCapture(CaptureTemplate)

Requests a new capture from the session.

public bool RequestCapture(CaptureTemplate captureTemplate = CaptureTemplate.StillCapture)

Parameters

captureTemplate CaptureTemplate

The capture template to use for the capture

Returns

bool

If the capture request was set successfully, true, otherwise, false.