initStream method
Future<void>
initStream({
- int sampleRate = 44100,
- int channels = 1,
- SoundFormat format = SoundFormat.f32,
- double bufferLenS = 5.0,
Initializes the recorder for streaming.
Implementation
Future<void> initStream({
int sampleRate = 44100,
int channels = 1,
SoundFormat format = SoundFormat.f32,
double bufferLenS = 5.0,
}) async {
if (sampleRate <= 0 || channels <= 0 || bufferLenS <= 0) {
throw ArgumentError("Invalid recorder parameters");
}
if (!_isInit) {
await _recorder.initStream(
sampleRate: sampleRate,
channels: channels,
format: format,
bufferLenS: bufferLenS,
);
_isInit = true;
}
}