Skip to content

Add audioManagerMode and setSpeakerphoneOn support in record_android to fix Echo Cancellation on Samsung S20#454

Closed
keyur2maru wants to merge 2 commits intollfbandit:masterfrom
keyur2maru:master
Closed

Add audioManagerMode and setSpeakerphoneOn support in record_android to fix Echo Cancellation on Samsung S20#454
keyur2maru wants to merge 2 commits intollfbandit:masterfrom
keyur2maru:master

Conversation

@keyur2maru
Copy link
Contributor

Description

  • Bumped record_android to version 1.3.1.
  • Features:
    • Added audioManagerMode to configure AudioManager modes to fix echo cancellation issues on some Android devices (verified on Samsung S20).
    • Added setSpeakerphoneOn option to enable speakerphone, addressing echo issues and external playback needs.
  • Updated pubspec.yaml to reference record_android version 1.3.1.
  • Updated AndroidRecordConfig in Dart to support the new options.

These changes enhance recording capabilities by improving echo cancellation compatibility across devices, with specific testing on the Samsung S20.

…ing speakerphone

- Introduced `audioManagerMode` in `MethodCallHandlerImpl` to map configuration values to `AudioManager` modes.
- Updated `RecordConfig` to include new parameters:
  - `audioManagerMode` (default: `MODE_NORMAL`).
  - `setSpeakerphoneOn` (default: `false`).
- Modified `AudioRecorder` to:
  - Configure `AudioManager` mode during initialization if `audioManagerMode` is specified.
  - Enable speakerphone if `setSpeakerphoneOn` is `true`.
- Updated Dart `AndroidRecordConfig`:
  - Added `audioManagerMode` with an enum for supported modes.
  - Added `setSpeakerphoneOn` for controlling speakerphone behavior.
  - Updated `toMap` method to serialize new properties.

Reason for changes:
- Switching `AudioManager` modes (e.g., to `MODE_IN_COMMUNICATION`) helps address acoustic echo cancellation issues, particularly on devices like the Samsung S20.
- Enabling the speakerphone is useful for scenarios where external playback is needed or for devices with echo issues in recording.
- These additions provide greater flexibility for managing audio configurations, improving compatibility across a broader range of devices.

Signed-off-by: Keyur Maru <[email protected]>
- Updated `record_android` to v1.3.1 in `pubspec.yaml`.
- Includes support for `audioManagerMode` and `setSpeakerphoneOn` for improved echo cancellation and external playback scenarios.

Signed-off-by: Keyur Maru <[email protected]>
@keyur2maru keyur2maru changed the title Add audioManagerMode and setSpeakerphoneOn support in record_android Add audioManagerMode and setSpeakerphoneOn support in record_android to fix Echo Cancellation on Samsung S20 Dec 24, 2024
@mbfakourii
Copy link

@llfbandit

This PR solved my problem. I think it would be better to merge.

@llfbandit
Copy link
Owner

Closing this PR in favor of a24931a.
Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants