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

Connecting a Bluetooth headset on Android while in a session is broken with Gradle Plugin 4.2.x or higher #624

Open
OttoLaitinen opened this issue Nov 2, 2022 · 13 comments

Comments

@OttoLaitinen
Copy link

Bug Report

Current behavior

Using Android Gradle Plugin 4.2.x or higher results in problems with Bluetooth on Android.

Steps to reproduce

  1. Clone BasicVideoChat example Link
  2. Change Gradle Plugin version to 4.2.2 in android/build.gradle (It needs Gradle version 6.7.1 so change that also)
  3. Open the App on a physical Android device
  4. Test sound without using a Bluetooth headset - microphone should work and output should be through the phone speaker
  5. Connect a Bluetooth headset to the mobile device
  6. Test sound -> Output is still coming through the device speaker and not the Bluetooth headset.

Example Project

Link to a fork with the problem

What is the current bug behavior?

Sound output doesn't come through a connected Bluetooth headset if the Bluetooth headset is connected to the mobile device during a session. (Sound comes through the mobile device speakers instead.)

If the Bluetooth headset is connected before opening the app (not session) then sound will come through the headset. However if headset is disconnected and reconnected the sound will keep coming through the mobile device speaker.

What is the expected correct behavior?

Sound output should come through the Bluetooth headset whenever it is connected to the mobile device. Otherwise the sound should come through the mobile device speakers.

Relevant logs and/or screenshots

N/A

@enricop89
Copy link
Contributor

WE are aware of it, it's an issue present also on the Android SDK. The team is working on a fix.

@pietgk
Copy link
Contributor

pietgk commented Nov 10, 2022

FYI: we tried a workaround using enableStereoOutput: true option on the session.
with it the inSession bluetooth disconnect connect is working.
but we get an issue that the microphone is set as if we have the phone at your ear mode (not in speaker phone mode) when switching headset - speaker.

@enricop89
Copy link
Contributor

@OttoLaitinen
Copy link
Author

@OttoLaitinen can you try with opentok-react-native 0.21.1? https://github.com/OttoLaitinen/opentok-react-native-samples-gradle-plugin-issue/blob/main/BasicVideoChat/package.json#L13

Hi! Sorry it took some time to get back to you here on GH but I can confirm the bug can still be reproduced on 0.21.1 if every other version is kept the same as in the original issue description.

@pietgk
Copy link
Contributor

pietgk commented Dec 28, 2022

@enricop89 i got feedback last week by mail from Roger Furtenheim, that the issue is solved in the android specific code.
can you give any feedback on this?

@pietgk
Copy link
Contributor

pietgk commented Dec 29, 2022

After testing BasicVideoChat with updated build.gradle

-    implementation 'com.opentok.android:opentok-android-sdk:2.23.1'
+    implementation 'com.opentok.android:opentok-android-sdk:2.24.1'

and OTSessionManager.java comment-out of @OverRide

                    // @Override
                    public boolean isCamera2Capable() {
                        return isCamera2Capable;
                    }

the issue seems to be solved.

What remains an issue for us is getting a proper release including this update.
As noted in the recent open issues, we will first need solving off the video freezing issue.

@cnx-carlosvogt
Copy link
Contributor

Hi, I'm getting the same issue, but @pietgk answert didn't work for me, using the last version.

@pietgk
Copy link
Contributor

pietgk commented Mar 24, 2023

@cnx-carlosvogt
I am using the 0.21.3 version and tested it (it uses the android sdk 2.24.1).
My reconnect bluetooth headset issue seems to be solved.
We now experience that on android its not using speaker mode (low audio level), we are looking into that.

@pietgk
Copy link
Contributor

pietgk commented Sep 18, 2023

I think we can close this issue from our point of view.

@nicolasdevienne
Copy link

Hi all! I've just test on 3 devices with the lastest version. On Samsung S9 (Android 9) and Huawei P20 (Android 9) it works : when I connect my bluetooth device during a video call, the switch from speaker to bluetooth device works. But on Pixel 5 (Android 14) the audio is always from speaker whereas the bluetooth device is connected. I must restart the app to use bluetooth device.

@pietgk
Copy link
Contributor

pietgk commented Mar 25, 2024

@enricop89 We are running our app with the latest versions:
opentok-react-native 2.27.2
react-native 0.73.6
All with the standard android config / versions from the standard RN upgrade to 0.73.6.

disconnecting a connected bluetooth headset in a call switches to speaker, reconnecting the bluetooth headset does not turn the sound to the headset (tested on Galaxy S10e, Android 9).

So the issue is NOT resolved.

This again blocks our release of the app.

We tried using react-native-incall-manager InCallManager.chooseAudioRoute to work around the issue but that does not solve the issue.

@pietgk
Copy link
Contributor

pietgk commented Mar 26, 2024

tried enableStereoOutput in the session options to see if it makes a difference, but that crashes the app...

@pietgk
Copy link
Contributor

pietgk commented Mar 27, 2024

I Created a Gist https://gist.github.com/pietgk/24d5dabb80cbe146de3bd6c4e3f3b6c1
that shows our workaround to get android headsets (bluetooth and wired) working:

  • reconnecting in a call works
  • mute unmute mute works with an issue of the speaker being active for about 1s on mute.
  • wired speaker - bluetooth speaker - speaker switching works

the remaining open issue is that on mute on android 13 (probably >= 12) we need
InCallManager.stop(); InCallManage.start({ media: "video"});
while on android 9 we tested that you can use
InCallManager.setSpeakerphoneOn(false); InCallManage.start({ media: "video"});
The issue is that the stop() makes the speaker active for about 1s before bluetooth is activated again.

So as React-native is supported by Vonage.
I Would like to STRESS that a proper headset support is added to a sample app
with properly working (bluetooth) headsets.

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants