startRecorder method

  1. @override
Future<void> startRecorder(
  1. FlutterSoundRecorderCallback callback, {
  2. String? path,
  3. Codec? codec,
  4. StreamSink<Uint8List>? toStream,
  5. StreamSink<List<Float32List>>? toStreamFloat32,
  6. StreamSink<List<Int16List>>? toStreamInt16,
  7. AudioSource? audioSource,
  8. Duration timeSlice = Duration.zero,
  9. int sampleRate = 16000,
  10. int numChannels = 1,
  11. int bitRate = 16000,
  12. int bufferSize = 8192,
  13. bool enableVoiceProcessing = false,
})
override

Implementation

@override
Future<void> startRecorder(
  FlutterSoundRecorderCallback callback, {
  String? path,
  Codec? codec,
  StreamSink<Uint8List>? toStream,
  StreamSink<List<Float32List>>? toStreamFloat32,
  StreamSink<List<Int16List>>? toStreamInt16,
  AudioSource? audioSource,
  Duration timeSlice = Duration.zero,
  int sampleRate = 16000,
  int numChannels = 1,
  int bitRate = 16000,
  int bufferSize = 8192,
  bool enableVoiceProcessing = false,
}) async {
  mediaRecorderWeb = null;
  /*
  if (toStream != null || toStreamFloat32 != null || toStreamInt16 != null) {
    return startRecorderToStream(
      callback,
      codec: codec!,
      toStream: toStream,
      toStreamFloat32: toStreamFloat32,
      toStreamInt16: toStreamInt16,
      audioSource: audioSource,
      timeSlice: timeSlice,
      sampleRate: sampleRate,
      numChannels: numChannels,
      bufferSize: bufferSize,
    );
  } else */
  {
    assert(codec != Codec.pcmFloat32 && codec != Codec.pcm16);
    getWebSession(callback)!.startRecorder(
      path,
      sampleRate,
      numChannels,
      bitRate,
      bufferSize,
      enableVoiceProcessing,
      codec!.index,
      toStream != null,
      audioSource!.index,
    );
    //_recorderState = RecorderState.isRecording;
  }
}