stopCapture method
Stop loopback capture.
Implementation
@override
Future<void> stopCapture() async {
// Don't throw if context is destroyed - just clean up Dart resources
if (_isDestroyed || _contextHandle == null) {
await _cleanupCallback();
return;
}
// Don't throw if already stopped - this is idempotent
if (_callbackHandle == null) {
return; // Already stopped
}
final res = bindings.MiniAV_Loopback_StopCapture(_contextHandle!);
await _cleanupCallback();
// Only warn on unexpected errors, not "already stopped" errors
if (res != bindings.MiniAVResultCode.MINIAV_SUCCESS &&
res != bindings.MiniAVResultCode.MINIAV_ERROR_NOT_RUNNING) {
print('Warning: MiniAV_Loopback_StopCapture failed: ${res.name}');
}
}