react-native-twilio-video-webrtc icon indicating copy to clipboard operation
react-native-twilio-video-webrtc copied to clipboard

Route audio to bluetooth headset

Open albertczyz opened this issue 4 years ago • 13 comments

Is there any way to route audio to bluetooth headset (especially on iOS)? When answering the call by clicking answer button on the screen audio is routed trough phone/speaker, how can I switch it back to bluetooth headset? I know there is setBluetoothHeadsetConnected() but it seems to not doing anything iOS.

albertczyz avatar Apr 10 '20 14:04 albertczyz

Does toggleSoundSetup work?

slycoder avatar Apr 10 '20 17:04 slycoder

@slycoder it does but it takes only true|false as an argument so I can only switch between phone and speaker, not to bluetooth headset

albertczyz avatar Apr 10 '20 17:04 albertczyz

If speaker is false I believe it goes through the "default route" which should be bluetooth (i.e. "phone" in this case should be bluetooth).

slycoder avatar Apr 12 '20 16:04 slycoder

@slycoder yes, but only if you receive the call using answer button on bluetooth headset. When answering using phone screen, there is no possibility to switch to bluetooth. I thnk it's iOS logic I think, but it's really dumb, I often have my headphones but when doing something on the phone I am just using it to answer the call.

albertczyz avatar Apr 14 '20 06:04 albertczyz

Related to #285

shamilovtim avatar Apr 16 '20 16:04 shamilovtim

@slycoder I am also facing this exactly. Route audio to bluetooth or bluetooth to audio is not working.

@albertc180 Is there right way to handle this? How do we know when to toggle?

Balasnest avatar Jun 01 '20 12:06 Balasnest

No this still isn't fixed to my knowledge

shamilovtim avatar Jun 01 '20 18:06 shamilovtim

@shamilovtim Found library for audio route! https://github.com/twilio/audioswitch This is developed by twilio recently and they had implemented in quickstart repo as well.

Can we also check and implement if its worked well.

FYI @slycoder @Praxey

Balasnest avatar Jun 02 '20 07:06 Balasnest

Looks promising. Do you know if anyone has made react native bindings for it yet?

slycoder avatar Jun 12 '20 06:06 slycoder

Correct me if I'm wrong but the OS is supposed to be able to route audio to bluetooth without any effort or custom code on our part. I think what's happening here is that there is code in the plugin that actively prevents the audio from going to bluetooth or the current connected audio device. That code should probably be changed.

shamilovtim avatar Jun 12 '20 17:06 shamilovtim

@shamilovtim Yes. OS is supposed to do all this by default. I am also surprised while things are working perfectly on iOS.

Did you manage to get it to work?

Balasnest avatar Jun 15 '20 07:06 Balasnest

ok, it is not ideal, but this is my simple solution https://github.com/Andriiklymiuk/react-native-twilio-video-webrtc/commit/a29a8485b885d2fb06008861fdd232c515317654

Andriiklymiuk avatar Feb 05 '21 11:02 Andriiklymiuk

Has there been any resolution to this? Audio still routing through device speaker (android) when bluetooth is connected, with no manual intervention.

owenadley avatar Dec 15 '21 17:12 owenadley