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

Android Bluetooth headphones get no sound. #27

Closed
Aliharu opened this issue Aug 15, 2019 · 22 comments
Closed

Android Bluetooth headphones get no sound. #27

Aliharu opened this issue Aug 15, 2019 · 22 comments
Assignees
Labels
bug Something isn't working waiting for customer response waiting for customer response, or closed by no-reponse bot

Comments

@Aliharu
Copy link

Aliharu commented Aug 15, 2019

When I use bluetooth wireless headphones with an android device I get no sound.

@Matrixbirds
Copy link

Please provide your devices info and flutter environment here.
I will schedule try to reproduce ASAP.

@mikebcurtis
Copy link

mikebcurtis commented Aug 29, 2019

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" />

@Matrixbirds
Copy link

Matrixbirds commented Aug 30, 2019

Which bluetooth headphones did u use? And Please also provide your headphones bluetooth protocol, you could find it from your android system. @mikebcurtis

@Matrixbirds
Copy link

Matrixbirds commented Aug 30, 2019

@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

@alexsullivan114
Copy link

@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.

@LichKing-2234
Copy link
Contributor

@alexsullivan114 can you hear the voice from speakerphone or handset?

@alexsullivan114
Copy link

@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.

@LichKing-2234
Copy link
Contributor

@alexsullivan114 you can try setAudioProfile(AudioProfile.Default, AudioScenario.GameStreaming)

@alexsullivan114
Copy link

I'll give that a shot

@alexsullivan114
Copy link

@LichKing-2234 Hey it looks like that fixed it! Not sure why but thanks!

@LichKing-2234
Copy link
Contributor

@alexsullivan114 I think here have some problem, we will check it, but you can use the configuration above before we fixed it

@thangvq95
Copy link

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!

@LichKing-2234
Copy link
Contributor

@thangvq95 Have you try the dev version? I think it is fixed by native platform.

@thangvq95
Copy link

@LichKing-2234 yeps, i'm using dev version. it's only work for GameStreaming scenario!

@LichKing-2234
Copy link
Contributor

@thangvq95 I will check later

@LichKing-2234
Copy link
Contributor

@thangvq95
you can use LiveBroadcasting mode.

setChannelProfile(ChannelProfile.LiveBroadcasting);
setClientRole(ClientRole.Broadcaster);

@ishdemon
Copy link

@thangvq95
you can use LiveBroadcasting mode.

setChannelProfile(ChannelProfile.LiveBroadcasting);
setClientRole(ClientRole.Broadcaster);

Issue still occurs even with LiveBroadcasting mode.

@littleGnAl
Copy link
Contributor

Please try agora_rtc_engine: 5.1.0.

@littleGnAl littleGnAl added the waiting for customer response waiting for customer response, or closed by no-reponse bot label Apr 21, 2022
@github-actions
Copy link
Contributor

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.

@silversquall
Copy link

silversquall commented Feb 9, 2023

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 ?

@maylorsan
Copy link

@silversquall any updates?
We getting same issue on android devices.

@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working waiting for customer response waiting for customer response, or closed by no-reponse bot
Projects
None yet
Development

No branches or pull requests

10 participants