Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG - Android] Cannot select mic in Android #331

Closed
Sp4Rx opened this issue May 31, 2024 · 2 comments
Closed

[BUG - Android] Cannot select mic in Android #331

Sp4Rx opened this issue May 31, 2024 · 2 comments

Comments

@Sp4Rx
Copy link

Sp4Rx commented May 31, 2024

Package version
record: ^5.1.1

Environment

  • OS: Andorid

Describe the bug

Facing the same issue like #296 for Android also, if I have BT headset it's picking up the BT mic irrespective of device selection.
Sample code:

await record?.start(
  RecordConfig(encoder: AudioEncoder.wav, device: _selectedMic),
  path: vocalPath!,
);

I am also doing _micList = await record?.listInputDevices(); from which I'm selecting the mic

Also I have another query. While recording is it possible to cancel out phones internal sounds like a music is playing or notification sounds.
@llfbandit

@llfbandit
Copy link
Owner

Did you set MODIFY_AUDIO_SETTINGS in your manifest?
There may be an issue in this area.

For internal sounds, yes, check RecordConfig#androidConfig.

@Sp4Rx
Copy link
Author

Sp4Rx commented Jun 6, 2024

Hey @llfbandit sorry for the delayed response.
Yes I have added the permission in the manifest as mentioned in the readme

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<!-- Bluetooth telephony device like headset/earbuds (min SDK: 23) -->
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<!-- Optional: Add this permission if you want to save your recordings in public folders -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

And what should I look into this RecordConfig#androidConfig ?
You meant this class right?

class RecordConfig(
val path: String?,
val encoder: String,
val bitRate: Int,
val sampleRate: Int,
numChannels: Int,
val device: AudioDeviceInfo?,
val autoGain: Boolean = false,
val echoCancel: Boolean = false,
val noiseSuppress: Boolean = false,
val useLegacy: Boolean = false,
val muteAudio: Boolean = false,
) {
val numChannels: Int = 2.coerceAtMost(1.coerceAtLeast(numChannels))
}

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

No branches or pull requests

2 participants