FrameProcessor class

Captures and processes video frames for virtual background

This class mirrors React's frame processing loop:

const processFrame = () => {
  selfieSegmentation.send({ image: videoElement });
  requestAnimationFrame(processFrame);
};

Uses flutter_webrtc's MediaStreamTrack.captureFrame() which returns PNG data, then decodes it to RGBA for segmentation processing.

Constructors

FrameProcessor()

Properties

hashCode int
The hash code for this object.
no setterinherited
isInitialized bool
Whether the processor is ready
no setter
isProcessing bool
Whether frames are being processed
no setter
onError ↔ void Function(String error)?
Error callback
getter/setter pair
onFrameProcessed ↔ void Function(ProcessedFrame frame)?
Frame processing callback - called for each processed frame
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
targetFps int
Current target FPS
no setter

Methods

dispose() Future<void>
Dispose of resources
initialize([SegmenterConfig? config]) Future<void>
Initialize the frame processor
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
processFrame(Uint8List frameData, {required int width, required int height}) Future<ProcessedFrame?>
Process a single frame manually (for testing or one-off processing)
startProcessing(MediaStream stream, {int fps = 15}) Future<void>
Start processing frames from the given media stream
stopProcessing() Future<void>
Stop frame processing
toString() String
A string representation of this object.
inherited

Operators

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