twilio / audioswitch

An Android audio management library for real-time communication apps.
Apache License 2.0
163 stars 50 forks source link

Multiple connected bluetooth headsets #115

Open sdfadsfsdf opened 2 years ago

sdfadsfsdf commented 2 years ago

Describe the bug Unable to switch to other Bluetooth while connected to Bluetooth

To Reproduce

  1. Bluetooth "A" Device connected then log audioDevices:["BluetoothHeadSet(name=A)", "Earpiece(name=Earpiece)","Speakerphone(name=Speakerphone)",] selectedDevice:BluetoothHeadSet(name=A)
  2. Connect Bluetooth "B" Device, and enable B from the Bluetooth setting screen. then log audioDevices:["BluetoothHeadSet(name=Bluetooth)", "Earpiece(name=Earpiece)","Speakerphone(name=Speakerphone)",] selectedDevice:BluetoothHeadSet(name=Bluetooth)
  3. In the end, Earpiece is selected and sound is heard from Earpiece and no sound from B then log audioDevices:[BluetoothHeadset(name=Bluetooth), Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)], selectedDevice:Earpiece(name=Earpiece)
  4. If you select B again, it will immediately return to Earpiece

Expected behavior Switch to device B

Actual behavior Earpiece is selected and sound is heard

Application Logs 2022-01-20 21:14:04.768 5582-5582/app D/test: audioDevices:[Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)], selectedDevice:Earpiece(name=Earpiece) 2022-01-20 21:14:04.998 5582-5582/app D/test: audioDevices:[BluetoothHeadset(name=Bluetooth), Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)], selectedDevice:BluetoothHeadset(name=Bluetooth) 2022-01-20 21:14:05.908 5582-5582/app D/test: audioDevices:[BluetoothHeadset(name=A), Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)], selectedDevice:BluetoothHeadset(name=A) ---Enable B----------------------------------------------------------------------------------------- 2022-01-20 21:14:25.416 5582-5582/app D/test: audioDevices:[BluetoothHeadset(name=Bluetooth), Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)], selectedDevice:BluetoothHeadset(name=Bluetooth) 2022-01-20 21:14:30.346 5582-5582/app D/test: audioDevices:[BluetoothHeadset(name=Bluetooth), Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)], selectedDevice:Earpiece(name=Earpiece)

AudioSwitch Version

Android Device (please complete the following information):