getCapabilities method

Future<Map<String, dynamic>> getCapabilities()

Get the platform's virtual background capabilities.

Returns information about what features are supported on this platform:

  • 'nativeWebRTCIntegration': Whether processed frames are sent via WebRTC pipeline
  • 'frameByFrameProcessing': Whether processFrame method is available
  • 'onnxSegmentation': Whether ONNX model is loaded for segmentation
  • 'gpuAcceleration': Whether GPU processing is available

This helps the app decide whether to use native processing or fall back to Dart-level processing with replaceTrack().

Implementation

Future<Map<String, dynamic>> getCapabilities() async {
  if (!isSupported) {
    return {
      'success': false,
      'platform': 'unsupported',
      'capabilities': <String, dynamic>{},
    };
  }

  try {
    final result = await _channel.invokeMethod<Map>('getCapabilities');
    if (result == null) {
      return {
        'success': false,
        'error': 'No response from native',
      };
    }
    return Map<String, dynamic>.from(result);
  } catch (e) {
    return {
      'success': false,
      'error': e.toString(),
    };
  }
}