Closed Aliharu closed 2 years ago
Please provide your devices info and flutter environment here. I will schedule try to reproduce ASAP.
All audio (including audio from other apps) plays through bluetooth headphones until an Agora call starts. We call AgoraRtcEngine.setDefaultAudioRouteToSpeaker(false) and AgoraRtcEngine.setEnableSpeakerphone(false) before joining the call, but as soon as an Agora call starts the audio output switches from bluetooth headphones to speakerphone. When the Agora call ends, audio output switches back to the bluetooth headphones, including audio from other apps. There are no uncaught exceptions during this process.
I put a print statement in the AgoraRtcEngine.onAudioRouteChanged callback and another right after we call AgoraRtcEngine.setEnableSpeakerphone and this is the output:
I/flutter (18438): setEnableSpeakerphone(false)
I/flutter (18438): onAudioRouteChanged: 5 (AUDIO_ROUTE_HEADSETBLUETOOTH)
I/flutter (18438): onAudioRouteChanged: 5 (AUDIO_ROUTE_HEADSETBLUETOOTH)
I/flutter (18438): setEnableSpeakerphone(true)
I/flutter (18438): onAudioRouteChanged: 3 (AUDIO_ROUTE_SPEAKERPHONE)
I/flutter (18438): onAudioRouteChanged: 3 (AUDIO_ROUTE_SPEAKERPHONE)
However, audio outputs through the speakerphone during the entire audio call, even when onAudioRouteChanged reports 5 (AUDIO_ROUTE_HEADSETBLUETOOTH).
I reproduced the issue on a T-Mobile REVVL (REVVL 5049W) running Android 7.0 and a Samsung Galaxy S8 (SM-G950U) running Android 9
Here is my results from flutter doctor: Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.6 18G87, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 10.2.1) [✓] iOS tools - develop for iOS devices [✓] Android Studio (version 3.3) [✓] VS Code (version 1.37.1) [✓] Connected device (2 available)
• No issues found!
During my test, I expanded our AndroidManifest.xml permissions to include the following:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Which bluetooth headphones did u use? And Please also provide your headphones bluetooth protocol, you could find it from your android system. @mikebcurtis
@mikebcurtis If you r using communication mode, you could try setAudioProfile(AudioProfile.SpeechStandard, AudioScenario.ChatRoomEntertainment)
If you r using live broadcasting mode, you could try setAudioProfile(AudioProfile.MusicStandard, AudioScenario.ChatRoomEntertainment)
. You need call setAudioProfile before joinChannel
@mikebcurtis or @Aliharu Did either of y'all find a resolution to this? I'm running into the same problem on native Android. The above solution didn't change anything for me.
@alexsullivan114 can you hear the voice from speakerphone or handset?
@LichKing-2234 Yes. The sound comes out of the earpiece, if I set speakerphone on it comes through the speakerphone and if I have headphones plugged in then it comes through the headphones. But if I have headphones connected via bluetooth it will still come out of the earpiece or speakerphone.
@alexsullivan114 you can try setAudioProfile(AudioProfile.Default, AudioScenario.GameStreaming)
I'll give that a shot
@LichKing-2234 Hey it looks like that fixed it! Not sure why but thanks!
@alexsullivan114 I think here have some problem, we will check it, but you can use the configuration above before we fixed it
Hey @LichKing-2234, I have same issue with this, config setAudioProfile(AudioProfile.Default, AudioScenario.GameStreaming) will have solve solution but i don't want to use the scenario GameStreaming to my application. Could you please take a look on this. Thanks a lot!
@thangvq95 Have you try the dev version? I think it is fixed by native platform.
@LichKing-2234 yeps, i'm using dev version. it's only work for GameStreaming scenario!
@thangvq95 I will check later
@thangvq95
you can use LiveBroadcasting
mode.
setChannelProfile(ChannelProfile.LiveBroadcasting);
setClientRole(ClientRole.Broadcaster);
@thangvq95 you can use
LiveBroadcasting
mode.setChannelProfile(ChannelProfile.LiveBroadcasting); setClientRole(ClientRole.Broadcaster);
Issue still occurs even with LiveBroadcasting
mode.
Please try agora_rtc_engine: 5.1.0
.
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.
Hi, I am getting the same issue: 1) on android (i didnt try yet on ios) the sound of conversations is not redirected to the bluetooth headset 2) when i play some .mp3 sound with some external library & if i join a channel: a. the mp3 sound starts on headset then goes to speakers b. the sound of the conversation goes on speaker.
--> it seems that all sound of android system is redirected to the speakers.
I have already used: await agora.engine.setDefaultAudioRouteToSpeakerphone(false); await agora.engine.setEnableSpeakerphone(false); await agora.engine.setChannelProfile(ChannelProfile.LiveBroadcasting); await agora.engine.setClientRole(ClientRole.Broadcaster);
The impact is very big on the project because everybody now is using bluetooth. It seems that you have recurrent issues with bluetooth, when are you planning to have serious look at it ?
@silversquall any updates? We getting same issue on android devices.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue.
When I use bluetooth wireless headphones with an android device I get no sound.