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

[Audio] isMicrophoneEnabled is false, but Microphone still recording #140

Closed
baveku opened this issue Sep 19, 2022 · 12 comments
Closed

[Audio] isMicrophoneEnabled is false, but Microphone still recording #140

baveku opened this issue Sep 19, 2022 · 12 comments

Comments

@baveku
Copy link

baveku commented Sep 19, 2022

the issue is funny
I turn off micro but the received still hear me,
console log:

print("[LIVEKIT][VOLUMES] \(speakers.map({($0.memberID, $0.isMicrophoneEnabled(), $0.audioLevel)}))")

there is the result:

[LIVEKIT][VOLUMES] [(2586, false, 0.125)]

isMicrophoneEnabled = false
audioLevel = 0.125

Why don't we disable the micro module after the microphone is set off?
Livekit still recording when microphone is off

@baveku
Copy link
Author

baveku commented Sep 19, 2022

Oh, I'm very stupid :D I call duplicate some function so It's break code,

but I need a solution to disable Microphone module when I mute micro

Why don't we disable the micro module after the microphone is set off?
Livekit still recording when microphone is off

@hiroshihorie
Copy link
Member

Hi, thats odd. You called localParticipant.setMicrophone(enabled: false) on participant A, but participant B can still hear ?

@baveku
Copy link
Author

baveku commented Sep 19, 2022

I'm sorry, it's my fail
I call track.stop() and localParticipant.setMicrophone(enabled: false) in same time, so it's break logic(Fixed)

I want to ask: when we turn off micro, why is Recorder still working?
(I saw a dotted yellow(microphone is recording) on iOS Statusbar)

@hiroshihorie
Copy link
Member

@baveku Please unpublish the track to turn off the mic recording indicator.

@baveku
Copy link
Author

baveku commented Sep 19, 2022

I mean I use localParticipant.setMicrophone(enabled: false), so I need unpublish track to stop recording, right?

@baveku
Copy link
Author

baveku commented Sep 19, 2022

@baveku Please unpublish the track to turn off the mic recording indicator.

I will try this solution.

@baveku
Copy link
Author

baveku commented Sep 19, 2022

@baveku Please unpublish the track to turn off the mic recording indicator.

It works, but why don't we disable audio if the microphone is turnoff?

@hiroshihorie
Copy link
Member

You have a good point, initially that was the default behavior.

But we need to switch AVAudioSession.category when mic switches on / off which also causes the volume to change which was confusing.

Therefore we decided not to switch category when mute() / unmute() (which is called internally by setMicrophone(enabled:)) but instead switch category when publish / unpublish.

cc: @davidzhao

@baveku
Copy link
Author

baveku commented Sep 20, 2022

I think we need to disable audio recorder module, I used Messenger or Google Meet and they disable the recorder when micro turn off.

@hiroshihorie
Copy link
Member

hiroshihorie commented Sep 20, 2022

You are right, this is actually a design flaw in the WebRTC's iOS SDK.
The AudioUnit should be able to switch on / off without category switch required. (ability to toggle mic usage while keeping .playAndRecord category)
Fixing the root cause will be a bit tricky and I don't think I can work on it any time soon.

@baveku
Copy link
Author

baveku commented Sep 20, 2022

You are right, this is actually a design flaw in the WebRTC's iOS SDK. The AudioUnit should be able to switch on / off without category switch required. (ability to toggle mic usage while keeping .playAndRecord category) Fixing the root cause will be a bit tricky and I don't think I can work on it any time soon.

okey, thank for your support, I solve my problem by your solution.
I still follow Livekit and use it for my production.
I hope Livekit will be more and more perfect. 🥂

@baveku baveku closed this as completed Sep 20, 2022
@Sotatek-TungNguyen7
Copy link

@baveku @hiroshihorie
Hi everyone, I have a trouble. I want to disable micro other user. Could you give me some advice

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