ProcessedVideoRenderer class

Widget that displays live camera preview with virtual background applied.

This mirrors the React BackgroundModal's preview functionality:

<video ref={videoPreviewRef} srcObject={processedStream} />

Uses flutter_webrtc's MediaStreamTrack.captureFrame() to capture frames, runs ML Kit segmentation, composites with virtual background, then uses CustomPainter to render the composed frames.

Inheritance

Constructors

ProcessedVideoRenderer.new({Key? key, VirtualBackground? background, MediaStream? existingStream, bool processingEnabled = true, int targetFps = 15, double? width, double? height, VoidCallback? onReady, void onError(String error)?, void onFrameProcessed(Duration processingTime)?, void onStreamSourceReady(VirtualStreamSource source)?})
const

Properties

background → VirtualBackground?
Current virtual background to apply
final
existingStream → MediaStream?
Existing camera stream (optional - will create one if not provided)
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onError → void Function(String error)?
Callback on error
final
onFrameProcessed → void Function(Duration processingTime)?
Callback when a frame is processed (for debugging/stats)
final
onReady → VoidCallback?
Callback when preview is ready
final
onStreamSourceReady → void Function(VirtualStreamSource source)?
Callback when the virtual stream source is ready This provides the VirtualStreamSource that can be used to create a processed MediaStream for transport
final
processingEnabled → bool
Whether background processing is enabled
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
targetFps → int
Target frames per second
final
width → double?
Widget dimensions
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<ProcessedVideoRenderer>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

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