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

Delay Microphone Engine stopping #597

Open
patryk-sredzinski opened this issue Feb 19, 2025 · 5 comments
Open

Delay Microphone Engine stopping #597

patryk-sredzinski opened this issue Feb 19, 2025 · 5 comments

Comments

@patryk-sredzinski
Copy link
Contributor

Would be nice to have a full option when to start microphone engine and when to stop it instead of having it handled by the SDK.

We can use:

AudioManager.shared.startLocalRecording()

This works great, although when we leave the room, the engine is killed immediately.
This causes some audio glitches on our end.

What we do is that when we have the connection ended. We want to play a disconnect sound. This glitches with AudioSession changes because of microphone turning off.

Is there any way we can control when to turn off the mic?

@hiroshihorie
Copy link
Member

Can you try AudioManager.shared.isRecordingAlwaysPrepared = true ?
This should mute the engine internally when disconnecting from the room instead of deallocating it.

@patryk-sredzinski
Copy link
Contributor Author

@hiroshihorie Unfortunately this doesn't work as you have described. Immediately when room is disconnected we get engine stopping

@hiroshihorie
Copy link
Member

hiroshihorie commented Feb 26, 2025

if isRecordingAlwaysPrepared is true, there shouldn't be a audio session category switch when disconnecting from the Room. It will simply mute the mic.

Can you record a demo video ?

@patryk-sredzinski
Copy link
Contributor Author

patryk-sredzinski commented Feb 27, 2025

I will see what I can do, maybe it is related to iOS CallKit? We have those integrated.

EDIT1:

Okay my observations:

✅ isRecordingAlwaysPrepared - true
❌ isLegacyMuteMode - false

This works as you described above, engine works as expected, although when I leave LiveKit room, there is the system muting sound

✅ isRecordingAlwaysPrepared - true
✅ isLegacyMuteMode - true

No system sounds, although, engine stops when leaving LiveKit room.

In my app, I am playing a custom sound when the call is ended. So I'd rather not have any audio session changes during LiveKit leaving.

Do you think we can also control the way if LiveKit controls muting?

if isRecordingAlwaysPrepared is true, there shouldn't be a audio session category switch when disconnecting from the Room. It will simply mute the mic.

This makes me think that LiveKit actually mutes the mic on disconnecting. Can you change that?

@punithstellantis
Copy link

The mic mute after disconnection was not happening till version 2.0.19
After 2.1.0, even after room disconnection the mic is muted.
Can you please fix this.

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

3 participants