Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bluetooth audio streaming between android devices

I made a research on the same topic and found that android devices are a2dp sources and the audio can be streamed only from an a2dp source to an a2dp sink. A2dp sink can be a bluetooth headset or a bluetooth speaker.

But my question is then how the android app named "Bluetooth Music Player" works?

It allows streaming from one mobile to another. So in this case the listening mobile device must act as a sink. How this is possible? Are they using some other profile instead of a2dp?

Ok, that may be a different profile what they are using. Because the application needs to be installed in the client side also. But how it becomes possible to stream voice from a bluetooth microphone to an android device?

Please help.

like image 978
Nidhin Joseph Avatar asked Nov 23 '13 06:11

Nidhin Joseph


People also ask

Can you Bluetooth sound from one phone to another?

Android users need to go to Bluetooth Settings and pair either Bluetooth headphones or speakers one by one. Once connected, tap the three-dot icon on the right and click on Advanced Settings. Toggle on the 'dual audio' option if not already turned on. This should enable users to connect to two devices at once.

How do I Bluetooth music from one Android phone to another?

Go to your “File Manager” application or open the music app of your phone. Select the music files you intend to move and tap on “Share.” Pick “Bluetooth” from the sharing option and choose your Bluetooth device. Tap on “Accept” from the other Android phone and let the file sharing begin.


1 Answers

Without knowing details about the mentioned Bluetooth Music Player, it seems to use simple Bluetooth data connection, otherwise you would not need to install a client on playing/sending device.

To stream audio from microphone to another device, you can record it on your sending device and send it to the receiving device. You will need to implement a protocol for that purpose.
OR
You can implement an alternative A2DP sink service. This is, what the sink is: a device with a Bluetooth Protocol Stack with an implementation of A2DP Sink.

Edit:
For the case you detailed by your comments, the sending device should be left as-is, without installing any app. That implicitly means that your solution must make use of out-of-the-box Bluetooth functionality of that Android device.
What you can use here is therefor limited to those profiles that Android typically support, which is HSP, HFP and A2DP. Since you obviously want to stream music, A2DP would be your choice.
On the device supposed to receive the audio stream and do the playback, you have to implement a service providing the A2DP sink as an self implemented BluetoothService opening a BluetoothServerSocket on RFCOMM as described in Android documentation.

You will have to spend much effort implementing this, and I am not sure if you will need a license for this.

like image 75
Schlangi Avatar answered Oct 11 '22 13:10

Schlangi