client-sdk-js icon indicating copy to clipboard operation
client-sdk-js copied to clipboard

Bluetooth audio device not being used for audio output on Android

Open nbrustein opened this issue 9 months ago • 12 comments

Describe the bug

When I connect to my agent from my android device, it does not use my connected Bluetooth headset for audio output.

We've tested on 3 different android devices with bluetooth headsets.

  • In one case things worked as expected
  • In another case the audio never came out of the bluetooth headset
  • In another case the audio initially came out of the bluetooth headset, but then switched and started coming from phone speakers

We experience the same issues in the following environments:

  • The Livekit playground
  • The LiveKit Agents Playground: running in mobile Chrome, connected to a simple agent running locally.
  • Web App in Mobile Chrome: utilizing:
    • @livekit/components-react version 2.9.3
    • livekit-client version 2.11.4
  • Capacitor Deployment: The same app as above, but deployed in a webview

Things work as expected on iOS devices

When running this in our own app with a debugger, I can see that the devices returned from useMediaDeviceSelect({kind: 'audiooutput'}) is empty

This issue could be related to:

  • https://github.com/livekit/client-sdk-android/issues/650
  • https://github.com/livekit/client-sdk-android/issues/649
  • https://github.com/livekit/client-sdk-js/issues/1493

Reproduction

Steps:

  • Activate bluetooth headphones
  • Confirm that audio from the app is coming through the headphones
  • Connect to agent via Livekit Playground
  • When the remote agent speaks, the audio comes out of the phone speaker rather than the bluetooth headset

Logs


System Info

System:
    OS: macOS 15.4.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 114.69 MB / 64.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 22.13.1 - ~/.asdf/installs/nodejs/22.13.1/bin/node
    Yarn: 4.9.1 - ~/.asdf/installs/nodejs/22.13.1/bin/yarn
    npm: 10.9.2 - ~/.asdf/installs/nodejs/22.13.1/bin/npm
  Browsers:
    Chrome: 136.0.7103.49
    Safari: 18.4

Severity

blocking all usage of LiveKit

Additional Information

No response

nbrustein avatar May 05 '25 17:05 nbrustein

Update from the poster. We've now had 8 different people test the livekit playground on android with bluetooth devices connected. 3 of the 8 people experienced this issue

nbrustein avatar May 15 '25 13:05 nbrustein

sorry for the late reply, could you add some info regarding the different android (and chrome) versions those users were using?

If it's only reproducible on a subset of android devices, it would be incredibly helpful to get a sense on which versions this is failing vs on which ones it works as expected

lukasIO avatar May 21 '25 08:05 lukasIO

Hey Lukas,

We had a number of people test connecting to https://playground.livekit.io/ through a mobile browser on an Android device.

We've seen it not work in these environments (All Chrome)

  • Pixel 7a / Android 15 / SOUNDBEATS GoFree 2 (that's my own device)
  • Motorola g54 / Android 15 / Smokin buds AH-2422
  • Motorola g 5G / Android 13 / PocBuds Bluetooth Headphones Wireless
  • Google Pixel 9 Pro Fold / Android 15 / Skullcandy Push Ultra
  • Pixel 7a / ?? / Aukey EP-T21S

We've seen it work fine in these environments (All Chrome except where otherwise indicated):

  • Samsung Galaxy S25 Ultra. / Android 15 / Samsung Galaxy buds 3 pro
  • Google Pixel 6a / Android 15 / OpenFit Air by Shokz
  • OnePlus 7t / Android 12 / Jaybird Tarah / Browser: Breave
  • Moto g play - 2023 / Android 13 / ukey EP - T21S

nbrustein avatar May 21 '25 20:05 nbrustein

thank you for the details, that's helpful.

To be clear, in the environments in which it didn't work, was the issue consistently happening (i.e. it never worked) or did it seem like a transient issue?

lukasIO avatar May 22 '25 08:05 lukasIO

When it "didn't work", it was either that the sound did not come out of the connected device at all, or it came out of the connected device for a moment and then went back to coming from the phone.

nbrustein avatar May 22 '25 13:05 nbrustein

got it, and this happened all the time on the environments you mentioned above or only some times?

lukasIO avatar May 22 '25 13:05 lukasIO

On the devices with issues, it was consistent. Happened every time.

nbrustein avatar May 22 '25 13:05 nbrustein

that's helpful, thank you!

From your finding it’s neither consistent across bluetooth devices (Aukey EP - T21S is mentioned both in “working” and “not working” environments) nor connected to a specific Android version (that also looks really diverse). I'm trying to pin point some sort of connection between the failing ones, do you happen to know which browsers were used for these reproductions or were the reproductions all inside of capacitor?

lukasIO avatar May 22 '25 13:05 lukasIO

None of these were inside of capacitor. All of these tests were connecting to https://playground.livekit.io/ through a mobile browser. Everyone was on an Android device, so I assume most or all of them were using Chrome, though I didn't specify. I know I was using Chrome when I tested "Pixel 7a / Android 15 / SOUNDBEATS GoFree 2".

I'll follow up and ask about the browsers.

nbrustein avatar May 22 '25 13:05 nbrustein

I updated my previous message with browser info. Everyone was using Chrome except for one user who did not experience an issue connecting via bluetooth,

nbrustein avatar May 22 '25 15:05 nbrustein

Here are console logs from http://meet.livekit.io/ for an environment where it successfully used the bluetooth headset and one where it didn't.

Working environment

The participant Mai __bp7g is on Samsung Galaxy S21 / Android 15 / Airpods and the sound came through her bluetooth headset

headset-working.console.txt

Non-working environment

The participant Nb__djqb is on Pixel 7a / Android 15 / SOUNDBEATS GoFree 2 and the sound did not come through the heaset.

headset-not-working.console.txt

nbrustein avatar May 30 '25 19:05 nbrustein

any update?

shushenghong avatar Sep 19 '25 00:09 shushenghong