VirtualStreamSource class

Creates a MediaStream from processed video frames.

This is the Flutter equivalent of React's:

processedStream = mediaCanvas.captureStream(frameRate);
previewVideo.srcObject = processedStream;

In Flutter/WebRTC, we need to manually inject frames into an RTCVideoSource.

Constructors

VirtualStreamSource()

Properties

currentFrame Image?
Current frame for rendering
no setter
hashCode int
The hash code for this object.
no setterinherited
isInitialized bool
Whether the source is ready
no setter
onFrameAvailable ↔ void Function(Image frame)?
Callback when a new frame is available for rendering
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream MediaStream?
Get the virtual stream
no setter

Methods

clearBuffer() → void
Clear the frame buffer
createNativeStream() Future<MediaStream?>
Create a native MediaStream from processed frames
dispose() Future<void>
Dispose resources
imageToBytes(Image image) Future<Uint8List?>
Convert ui.Image to raw bytes for platform channel transfer
initialize({int width = 640, int height = 480, int fps = 15}) Future<void>
Initialize the virtual stream source
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pushFrame(Image frame) Future<void>
Push a processed frame to the virtual stream
startOutput() → void
Start outputting frames at the target FPS
stopOutput() → void
Stop frame output
toString() String
A string representation of this object.
inherited

Operators

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