AgoraIO-Extensions / react-native-agora

React Native around the Agora RTC SDKs for Android and iOS agora
https://www.agora.io
MIT License
625 stars 227 forks source link

[IOS] sound from remote user is discontinuity when local user turn on/off microphone #627

Closed tdvuanh closed 1 year ago

tdvuanh commented 1 year ago

Describe the bug Hi there, we are using react-native-agora (v3.7.1) for our production application for voice streaming. We use the API muteLocalAudioStream to archive the function mute / unmute of the user We notice that when a local user turns on/off the microphone, the remote user's sound will be interrupted shortly. I am not sure if it is a bug of react-native-agora or ios, but I do some research and have no results about it. So I am opening the issue here to ask any of you who ever faced this issue like me before and how you solved it. Thanks so much.

To Reproduce Steps to reproduce the behavior: When a user joins a voice stream room, and he/she is speaking, if a local speaker turns off/on the microphone, they will hear the sound from another remote speaker in discontinuity. Expected behavior The sound from the remote speaker is not discontinuity when the local speakers turn off/on their microphone

Smartphone - Tablet (please complete the following information):

ali-soltanii commented 1 year ago

same issue with v4.1.0

tdvuanh commented 1 year ago

same issue with v4.1.0

I see this issue happen on real device. Simulator is okay

ali-soltanii commented 1 year ago

same issue with v4.1.0

I see this issue happen on real device. Simulator is okay

Exactly. for us, it happens on both android and ios

tdvuanh commented 1 year ago

same issue with v4.1.0

I see this issue happen on real device. Simulator is okay

Exactly. for us, it happens on both android and ios

do you find any solution or at least reason why? I deep dive into react-native-agora source code but still now found nothing

tdvuanh commented 1 year ago

After give hours for this issue. I found it come from our app logic, not from react-native-agora. I will close this issue from here.

ali-soltanii commented 1 year ago

After give hours for this issue. I found it come from our app logic, not from react-native-agora. I will close this issue from here.

Really? Can you tell me what was causing it?

ali-soltanii commented 1 year ago

After give hours for this issue. I found it come from our app logic, not from react-native-agora. I will close this issue from here.

Really? Can you tell me what was causing it?

tdvuanh commented 1 year ago

After give hours for this issue. I found it come from our app logic, not from react-native-agora. I will close this issue from here.

Really? Can you tell me what was causing it?

We have a function named rejoinedChannel. That function calls API used to start the stream room and switch the role of the user base on audience or streamer by method switchToBroacaster and switchToAudience. Now I am looking for why my teammate put it called every time users toggle their mic because when I try to comment out that function, our feature still works well, but pretty sure it caused our app issue.

tdvuanh commented 1 year ago

After give hours for this issue. I found it come from our app logic, not from react-native-agora. I will lose this issue from here.

Really? Can you tell me what was causing it?

[Updated] Cause we use method enableLocalAudio to toogle mic so it cause problem. Follow by react-native-agora docs, note

[enableLocalAudio]enableLocalAudio: Disables/Re-enables the local audio capture and processing. If you disable or re-enable local audio recording using [enableLocalAudio]enableLocalAudio, the local user may hear a pause in the remote audio playback.

Hope this can help you solve your issue @ali-soltanii

ali-soltanii commented 1 year ago

After give hours for this issue. I found it come from our app logic, not from react-native-agora. I will close this issue from here.

Really? Can you tell me what was causing it?

We have a function named rejoinedChannel. That function calls API used to start the stream room and switch the role of the user base on audience or streamer by method switchToBroacaster and switchToAudience. Now I am looking for why my teammate put it called every time users toggle their mic because when I try to comment out that function, our feature still works well, but pretty sure it caused our app issue.

I think it is because of the cost of the agora. It is more expensive when you are in a call as a broadcaster

ali-soltanii commented 1 year ago

After give hours for this issue. I found it come from our app logic, not from react-native-agora. I will lose this issue from here.

Really? Can you tell me what was causing it?

[Updated] Cause we use method enableLocalAudio to toogle mic so it cause problem. Follow by react-native-agora docs, note

[enableLocalAudio]enableLocalAudio: Disables/Re-enables the local audio capture and processing. If you disable or re-enable local audio recording using [enableLocalAudio]enableLocalAudio, the local user may hear a pause in the remote audio playback.

Hope this can help you solve your issue @ali-soltanii

Thank you. But the issue is the 3rd user in the call can hear the pause as well. Also if you test it with a real device when a remote user tries to unmute using enableLocalAudio, the local user's mic permission status bar (the user who is unmuted -- in iPhone, there is an orange dot indicator when you are using the mic) interrupts