components/background_components/background_components library

Background Components

Provides virtual background functionality for MediaSFU applications. Uses conditional imports to automatically select the right implementation per platform.

Classes

BackgroundModal
BackgroundModal - Modal for selecting virtual backgrounds.
BackgroundModalOptions
Options for the BackgroundModal widget.
BackgroundModalParameters
Parameters for the BackgroundModal widget.
BackgroundProcessorService
Singleton service that manages persistent background processing.
BackgroundSegmenter
Legacy abstract interface for backward compatibility.
BackgroundSegmenterBase
Abstract base class for background segmenters.
BackgroundVideoDisplay
A widget that displays either processed (background-replaced) video frames or falls back to standard RTCVideoView when no background is active.
Compositor
Composites a person with a virtual background using a segmentation mask.
FrameProcessor
Captures and processes video frames for virtual background
PresetBackgrounds
Default preset backgrounds available in the SDK.
ProcessedFrame
Represents a processed frame with segmentation data
ProcessedVideoRenderer
Widget that displays live camera preview with virtual background applied.
SegmentationResult
Result of background segmentation processing.
SegmenterConfig
Configuration options for the segmenter.
SegmenterInputMetadata
Metadata for input images.
StubBackgroundSegmenter
Stub implementation of BackgroundSegmenter for platforms without ML Kit.
StubSegmenter
Stub implementation that returns frames unprocessed.
VirtualBackground
Virtual background configuration.
VirtualBackgroundChannel
Platform channel interface for native virtual background video track creation.
VirtualBackgroundProcessor
Platform-aware virtual background processor.
VirtualStreamSource
Creates a MediaStream from processed video frames.
VirtualVideoTrackSource
Helper class to bridge virtual frames to WebRTC

Enums

BackgroundType
Enum representing the type of virtual background.
SegmenterInputFormat
Input image format for the segmenter.

Extensions

FrameConversion on Uint8List
Extension to help with frame conversion for ML Kit.
VirtualBackgroundChannelX on VirtualBackgroundChannel
Extension to make channel usage easier
VirtualBackgroundVideoIntegration on VirtualBackgroundProcessor
Extension to integrate with MediaSFU video pipeline.

Functions

createSegmenter() BackgroundSegmenterBase
Factory function - returns StubSegmenter.

Typedefs

BackgroundModalType = Widget Function({required BackgroundModalOptions options})
Type definition for BackgroundModal widget builder.
SegmenterFactory = BackgroundSegmenterBase Function()
Factory function type for creating segmenters.