livekit / client-sdk-js

LiveKit browser client SDK (javascript)
https://livekit.io
Apache License 2.0
335 stars 146 forks source link

Audio Playback Stops After Removing Default Bluetooth Device #1220

Open wezerr opened 1 month ago

wezerr commented 1 month ago

Describe the bug

Case:

Connect a new device, such as Bluetooth headphones (the system should set it as the default device). The device connects, and we can hear everyone properly, and they can hear us. Remove the device. The system switches to a new device, and we stop hearing others.

Expected Behavior:

After removing the device, the system should correctly switch to another available device and continue to playback sound.

Actual Behavior:

After removing the device, the system switches to a new device, but we stop hearing others.

Reproduction

Connect a new Bluetooth device (e.g., headphones). Ensure the device is set as default and audio is working correctly. Remove the device. Observe that audio playback stops.

Logs

No response

System Info

Operating System: Windows 10
Application Version: LiveKit 2.4.2
Additional Settings: webAudioMix: true

Severity

blocking all usage of LiveKit

Additional Information

No response

lukasIO commented 1 month ago

Is this reproducible only with webAudioMix: true ? What's the behaviour with webAudioMix: false ?

Please also post some debug logs from the /sample app in this repo from when you encounter this issue.

wezerr commented 1 month ago

We conducted further testing and here are the results:

User1:

Device: AirPods, Windows 11 Case 1:

Enter without headphones, then connect them: When connecting the headphones, the participant's input device remains the same until the microphone is manually switched. After disconnecting the headphones, everything becomes correct. Case 2:

Enter with headphones, disconnect them, and then reconnect them: After disconnecting, everything works fine, but when reconnecting, the same issue as in Case 1 occurs. Case 3:

Enter with headphones and change the default device from headphones to system devices: After changing, the microphone does not switch and remains as the headphone microphone, even though it should have switched to the system microphone. User2:

Device: Bluetooth headphones, Windows 10 General Case:

Enter without headphones, then connect them: When connecting the headphones, the participant loses sound and cannot hear anyone. This issue occurs with webAudioMix set to both true and false. All cases from User1 are reproducible for User2 as well.

Additionally, I am attaching two log files from the /sample app that were captured during these tests.

Please let me know if you need any further information. user2.log user1.log

lukasIO commented 1 month ago

This issue occurs with webAudioMix set to both true and false.

how about case 1 and 2 ?

wezerr commented 1 month ago

For сases 1 and 2, the value of webAudioMix (whether set to true or false) does not have any impact on the issue. The problems described occur regardless of the webAudioMix setting.

lukasIO commented 2 weeks ago

sorry for the delay, could you try with https://github.com/livekit/client-sdk-js/pull/1237 to see if this fixes the issue you're seeing?