initStream method

Future<void> initStream({
  1. int sampleRate = 44100,
  2. int channels = 1,
  3. SoundFormat format = SoundFormat.f32,
  4. 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;
  }
}