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

MicStream.microphone() silences audio player plugins #66

Open
asmodeoux opened this issue Apr 24, 2023 · 2 comments
Open

MicStream.microphone() silences audio player plugins #66

asmodeoux opened this issue Apr 24, 2023 · 2 comments

Comments

@asmodeoux
Copy link

I'm trying to use this mic stream in an app and play some sound effects at the same time. But once the mic stream initializes and starts listening, all the sound effects are silenced. I tried just_audio and audioplayers libs and both fail to play any sound when this mic plugin is active. This behavior is only in iOS, in Android both audio input and output work well at the same time. What might be wrong and how can I fix it?

@asmodeoux
Copy link
Author

I found what's causing this, the plugin sets the AudioCategory in iOS to record-only, while I think it should be playAndRecord, or maybe even configurable:
try audioSession.setCategory(AVAudioSession.Category.playAndRecord, mode: .measurement, options: [.defaultToSpeaker, .mixWithOthers])

@anarchuser
Copy link
Owner

anarchuser commented Apr 24, 2023

hey, thank you for taking your time to look into this yourself already.

It's very likely that changing the category will resolve this issue. I cannot reliably test this, though, and therefore cannot fix this myself.
I'd appreciate if you can fix this, make sure it runs, and open a PR.
I'm happy to help with anything in the process, as long as it isn't platform-specific.

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