How to use capacitorjs to connect send two separate audio streams over bluetooth

102 Views Asked by At

I have not been able to find an answer to this with any of my research despite already starting my project. I have a vuejs w/quasar application setup with two audio files stored on my project. I am able to play each of them using the html5 audio tag. However, this application will be deployed to a iOS application using capacitorjs which is integrated into quasar cli by default. So I have already enabled that and it works in the simulator very well. My issue is I cannot find any resources regarding if this bluetooth option is possible. So first, can capitorjs allow a device to send an separate audio stream to two separate connected bluetooth devices?

I found the following library :

https://github.com/capacitor-community/bluetooth-le

And it handles the bluetooth connections in capacitorjs but there is no examples of connecting to more than one device. Its actually very limited examples. So can you direct data which data goes to which bluetooth device similar to what i am trying to accomplish but with audio only. I have read with bluetooth 5 you can connect to multiple bluetooth so newer iphones should be able to achieve this from a technical perspective I would assume.

Lastly, if this is possible, what is a simple example showing this exercise with capacitorjs library? Also, I am aware I am not able to test bluetooth in the xCode simulator so I will need to deploy to a real device to try this out.

1

There are 1 best solutions below

3
Rob Napier On

This is not currently possible on iOS. capacitorjs isn't relevant here. A framework can't do anything the OS doesn't allow.

There is multi-route support, but it is very limited and does not support Bluetooth:

Audio sessions using the multiRoute or record categories implicitly clear [the allowBluetoothA2DP] option. If you clear [allowBluetoothA2DP], paired Bluetooth A2DP devices don’t show up as available audio output routes.

Note that the bluetooth-le library you've linked is only for Bluetooth LE, which does not handle audio at all. (There is such a thing as "Bluetooth LE Audio," but as with so many things in the Bluetooth world, despite having a similar name it is a completely different protocol, and iOS apps have no access to it, and I don't believe any iPhones support it yet in any case.)