setBackground method

void setBackground(
  1. VirtualBackground? background
)

Set the virtual background to apply

Implementation

void setBackground(VirtualBackground? background) {
  _currentBackground = background;
  _compositor?.clearCache();

  debugPrint(
      'BackgroundProcessorService: Background set to ${background?.name ?? 'none'}');

  // If no background, stop processing
  if (background == null || background.type == BackgroundType.none) {
    if (_isProcessing) {
      _stopProcessingInternal();
    }
    _currentFrame = null;
  } else if (_sourceStream != null && !_isProcessing) {
    // Start processing if we have a stream and a background
    _startProcessingInternal();
  }
}