Skip to content

After enabling the echoCancel: true configuration on iOS, playing a video while recording audio will cause the playback volume to decrease. The video volume only returns to normal after killing the app process #574

@liuzhihaoa

Description

@liuzhihaoa

Package version
6.0.0

Environment

  • OS: IOS

Describe the bug

After enabling the echoCancel: true configuration on iOS, playing a video while recording audio will cause the playback volume to decrease. The video volume only returns to normal after killing the app process

RecordConfig config = const RecordConfig(
    encoder: AudioEncoder.pcm16bits,
    sampleRate: 8000,
    numChannels: 1,
    androidConfig: AndroidRecordConfig(
        audioSource: AndroidAudioSource.voiceCommunication),
    autoGain: true,
    echoCancel: false,
    noiseSuppress: true);

void startTalk() async {
_log.i("startTalk");
RecordConfig config = const RecordConfig(
encoder: AudioEncoder.pcm16bits,
sampleRate: 8000,
numChannels: 1,
androidConfig: AndroidRecordConfig(
audioSource: AndroidAudioSource.voiceCommunication),
autoGain: true,
echoCancel: false,
noiseSuppress: true);

_audioRecorder = AudioRecorder();

bool hasPermission = await _audioRecorder!.hasPermission();
if (!hasPermission) {
  _log.w("startTalk error as no permission");
  _audioRecorder?.stop();
  _audioRecorder = null;
  return;
}
Stream<Uint8List> stream = await _audioRecorder!.startStream(config);
stream.listen((Uint8List data) {
  // print("data.length: ${data.length}");
  _mediaplayer?.sendData(data, data.length);
});
isTalking = true;
notifyListeners();

}

void stopTalk() {
_log.i("stopTalk");
_audioRecorder?.stop();
_audioRecorder = null;
isTalking = false;
notifyListeners();
} void startTalk() async {
_log.i("startTalk");
RecordConfig config = const RecordConfig(
encoder: AudioEncoder.pcm16bits,
sampleRate: 8000,
numChannels: 1,
androidConfig: AndroidRecordConfig(
audioSource: AndroidAudioSource.voiceCommunication),
autoGain: true,
echoCancel: false,
noiseSuppress: true);

_audioRecorder = AudioRecorder();

bool hasPermission = await _audioRecorder!.hasPermission();
if (!hasPermission) {
  _log.w("startTalk error as no permission");
  _audioRecorder?.stop();
  _audioRecorder = null;
  return;
}
Stream<Uint8List> stream = await _audioRecorder!.startStream(config);
stream.listen((Uint8List data) {
  // print("data.length: ${data.length}");
  _mediaplayer?.sendData(data, data.length);
});
isTalking = true;
notifyListeners();

}

void stopTalk() {
_log.i("stopTalk");
_audioRecorder?.stop();
_audioRecorder = null;
isTalking = false;
notifyListeners();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions