pushFrame method

Future<void> pushFrame(
  1. Image frame
)

Push a processed frame to the virtual stream

This is called by the compositor after blending person + background. The frame will be output at the target FPS.

Implementation

Future<void> pushFrame(ui.Image frame) async {
  if (!_isInitialized) {
    throw StateError('VirtualStreamSource not initialized');
  }

  // Add to buffer
  _frameBuffer.add(frame);

  // Limit buffer size
  while (_frameBuffer.length > _maxBufferSize) {
    _frameBuffer.removeAt(0);
  }

  // Update current frame immediately for preview
  _currentFrame = frame;
  onFrameAvailable?.call(frame);
}