start method
Future<void>
start(
- RecordConfig config, {
- required String path,
})
Implementation
Future<void> start(RecordConfig config, {required String path}) async {
switch (config.encoder) {
case AudioEncoder.wav:
case AudioEncoder.pcm16bits:
await _delegate?.dispose();
_delegate = MicRecorderDelegate(onStateChanged: _updateState);
return _delegate!.start(config, path: path);
default:
await _delegate?.dispose();
final supported = await isEncoderSupported(config.encoder);
if (!supported) {
throw Exception('Encoder ${config.encoder} not supported.');
}
_delegate = MediaRecorderDelegate(onStateChanged: _updateState);
return _delegate!.start(config, path: path);
}
}