VirtualBackgroundChannel class

Platform channel interface for native virtual background video track creation.

This bridges Flutter's virtual background processing to native WebRTC video sources, mirroring React's mediaCanvas.captureStream() functionality.

React Equivalent

processedStream = mediaCanvas.captureStream(frameRate);
videoParams = { track: processedStream.getVideoTracks()[0] };

Platform Support

  • Android: Uses Surface/Texture-based video source
  • iOS: Uses CVPixelBuffer-based video source
  • Web/Desktop: Fallback (no native support)
Available extensions

Constructors

VirtualBackgroundChannel.new()
factory

Properties

canUseVirtualBackground → bool

Available on VirtualBackgroundChannel, provided by the VirtualBackgroundChannelX extension

Quick check if virtual backgrounds can work
no setter
hashCode → int
The hash code for this object.
no setterinherited
isSupported → bool
Whether native virtual background is supported on this platform
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
virtualStream → MediaStream?
Get the current virtual stream
no setter
virtualTrack → MediaStreamTrack?
Get the virtual video track
no setter

Methods

createProcessedStream({required int width, required int height, required int fps}) → Future<MediaStream?>
Create a MediaStream from processed frames
dispose() → Future<void>
Dispose resources
initialize({required int width, required int height, required int fps}) → Future<bool>
Initialize the native virtual background system
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pushFrame(Uint8List frameData, int width, int height) → Future<bool>
Push a processed frame to the virtual stream
startFrameInjection({required Future<Uint8List> frameProvider(), int fps = 15}) → void
Start continuous frame injection from a provider function
stopFrameInjection() → void
Stop frame injection
toString() → String
A string representation of this object.
inherited

Operators

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