setStreamingConfig method
Sets the streaming configuration for real-time detection.
This method allows dynamic configuration of what data is included in the detection stream, enabling performance optimization based on application needs.
Example:
// Switch to minimal streaming for better performance
await controller.setStreamingConfig(
YOLOStreamingConfig.minimal(),
);
// Switch to full data streaming
await controller.setStreamingConfig(
YOLOStreamingConfig.full(),
);
@param config The streaming configuration to apply
Implementation
Future<void> setStreamingConfig(YOLOStreamingConfig config) async {
if (_methodChannel == null) {
logInfo(
'YOLOViewController: Warning - Cannot set streaming config, view not yet created',
);
return;
}
try {
await _methodChannel!.invokeMethod('setStreamingConfig', {
'includeDetections': config.includeDetections,
'includeClassifications': config.includeClassifications,
'includeProcessingTimeMs': config.includeProcessingTimeMs,
'includeFps': config.includeFps,
'includeMasks': config.includeMasks,
'includePoses': config.includePoses,
'includeOBB': config.includeOBB,
'includeOriginalImage': config.includeOriginalImage,
'maxFPS': config.maxFPS,
'throttleInterval': config.throttleInterval?.inMilliseconds,
'inferenceFrequency': config.inferenceFrequency,
'skipFrames': config.skipFrames,
});
logInfo('YOLOViewController: Streaming config updated');
} catch (e) {
logInfo('YOLOViewController: Error setting streaming config: $e');
}
}