AgoraIO-Extensions / react-native-agora

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

enableLocalAudio mute speaker #405

Closed ysimoo closed 3 years ago

ysimoo commented 3 years ago

I want to send like Whatsapp audio (enable/disable Mic) but with a chosen music in the background, I notice that when I call enableLocalAudio the music stops, I'm using this config:

      engine.setChannelProfile(ChannelProfile.LiveBroadcasting);

      engine.setAudioProfile(
        AudioProfile.MusicStandard,
        AudioScenario.GameStreaming
      );

Can anyone help please

LichKing-2234 commented 3 years ago

iOS or Android?

ysimoo commented 3 years ago

@LichKing-2234 on iOs

LichKing-2234 commented 3 years ago

I think this API will change the audio session.

ysimoo commented 3 years ago

I think that too, but when I use also setClientRole to switch between Broadcaster and Audience (without using enableLocalAudio) I have the same issue

LichKing-2234 commented 3 years ago

the audience can not record audio or capture video.

ysimoo commented 3 years ago

I'm doing this switch between client role to replace enableLocalAudio, Broadcaster <=> enableLocalAudio(true) and Audience <=> enableLocalAudio(false)

LichKing-2234 commented 3 years ago

you can try the setDefaultAudioRoutetoSpeakerphone method.

ysimoo commented 3 years ago

I tried setDefaultAudioRoutetoSpeakerphone always the same issue after calling enableLocalAudio(true)

ysimoo commented 3 years ago

@LichKing-2234 fixed by adding setParameters("{\"che.audio.keep.audiosession\":true}")