pushFrame method

Future<bool> pushFrame(
  1. Uint8List frameData,
  2. int width,
  3. int height
)

Push a processed frame to the virtual stream

This sends RGBA frame data to the native video source for encoding.

frameData - RGBA pixel data (width * height * 4 bytes) width - Frame width height - Frame height

Implementation

Future<bool> pushFrame(Uint8List frameData, int width, int height) async {
  if (!isSupported || _virtualTrackId == null) {
    return false;
  }

  try {
    await _channel.invokeMethod('pushFrame', {
      'trackId': _virtualTrackId,
      'data': frameData,
      'width': width,
      'height': height,
    });
    return true;
  } on PlatformException catch (e) {
    debugPrint(
        'VirtualBackgroundChannel: Failed to push frame: ${e.message}');
    return false;
  }
}