CaptureSession class Null safety

An object that manages capture activity and coordinates the flow of data from input devices to capture outputs.

To perform real-time capture, you instantiate an CaptureSession object and add appropriate inputs and outputs. The following code fragment illustrates how to configure a capture device to record audio.

// Create the capture session.
final CaptureSession captureSession = CaptureSession();

// Lookup the default audio device.
final CaptureDevice audioDevice =
    CaptureDevice.defaultDeviceWithMediaType(MediaType.audio);

final CaptureDeviceInput audioInput = CaptureDeviceInput(audioDevice);

if (await captureSession.canAddInput(audioInput)) {
  captureSession.addInput(audioInput);
}

You invoke startRunning to start the flow of data from the inputs to the outputs, and invoke stopRunning to stop the flow.

You use the setSessionPreset method to customize the quality level, bitrate, or other settings for the output. Most common capture configurations are available through session presets; however, some specialized options (such as high frame rate) require directly setting a capture format on an CaptureDevice instance.

Mixed in types
Annotations
  • @Reference('av_foundation/av_foundation/CaptureSession')

Constructors

CaptureSession()
Construct a CaptureSession.

Properties

hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

addInput(covariant CaptureInput input) Future<void>
Adds a given input to the session.
addOutput(covariant CaptureOutput output) Future<void>
Adds a given output to the session.
canAddInput(CaptureInput input) Future<bool>
Returns a Boolean value that indicates whether a given input can be added to the session.
canAddOutput(CaptureOutput output) Future<bool>
Returns a Boolean value that indicates whether a given output can be added to the session.
canSetSessionPresets(List<String> presets) Future<List<String>>
Returns a subset of preset values that indicates which presets can be used by the session.
isInterrupted() Future<bool>
Indicates whether the receiver has been interrupted.
isRunning() Future<bool>
Indicates whether the receiver has been interrupted.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
removeInput(CaptureInput input) Future<void>
Removes a given input.
removeOutput(CaptureOutput output) Future<void>
Removes a given output.
setSessionPreset(String preset) Future<void>
A constant value indicating the quality level or bit rate of the output.
startRunning() Future<void>
Tells the receiver to start running.
stopRunning() Future<void>
Tells the receiver to stop running.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited