How does the bluetooth a2dp profile work? - android

I want to create a bluetooth music player application which streams audio from one device to another. I have read everything on the android developers page about bluetooth and I found that a profile called a2dp has been specifically created for audio streaming. However not much has been provided on how to use it. I have also gone through the bluetooth chat example but i have been unable to figure out how to actually send audio and how to receive it. I have also read that a2dp sink functionality has been added as of android 5.0.
After spending hours on stackoverflow I see numerous questions asking the same thing but without any satisfactory answer.
My main questions are-
How does the bluetooth a2dp profile work?
Are there better methods to implement audio streaming between
android devices apart from a2dp?
Any help would be greatly appreciated.

You can read the AVDTP core specification to know what happens during an a2dp connection.
But if you want to know about the working of it in terms of coding, I suggest you go through this blog which I found useful.

Related

How to play audio by a specific audio device in Android?

I've looked up around for a way to achieve mainly 3 different things with Android:
How to getting listed all the audio output and input devices?
I've found out that there's a method added since API 23 on AudioManager instances according to Android documentation which does this, but there's no documentation about a solution for previous versions. This question remains unanswered here at StackOverflow and several places online.
How to pick up a specific audio output device to stream audio?
The purpose I want to acomplish with this is to select one of the available output devices and stream out the audio by it. Is there a way to do so?
How to record by a specific input device?
The same that before, specific device usage, but in the other way around, I mean, to select one of the available microphones and use it to record audio.
Please help me with some guidence, source code or idea, all of them will be very welcome.

Accessing Android 6.0 all audio out buffer for streaming over WiFi-Direct

I'm a newbie to programming on Android (who got sent here by Android.SE) and I was wondering if the following is possible:
Can i access the audio out buffer that would play on the system speaker? If yes, what would be the best way to go about accessing it.
I'm trying to make an android app that will send said audio buffer over WiFi-Direct to a Raspberry Pi 3, but I have no idea how to find this one specific buffer on android 6.0.
Any help would be appreciated!
After hours of searching for a solution, it seems quite clear that there is no legal way to do this for privacy reasons.

Audio input through USB in Android

I have been wondering, on how to capture Audio inputs through USB in Android.
My scenario is to receive audio through external hardware and play that received audio through android app. This transmission is to be done over USB.
Is there any way to do this using Android SDK / Android NDK.
Any suggestion will be helpful to me.
Task Done Right by time I am able to interact with Hardware using CDC class and also able to play some random noisy audio through USB in my app. Neither I am able to get clear sound by that approach, nor there is consistency within the transmission of audio.
Thanks.
Regards, Vivek
Most modern Android devices can act as USB host. So you can connect e.g. USB microphone for capturing the audio. Android also contains support for usb_audio class. Use that to get access to the audio on the device.
Since you have already experimented with Communication Device Class (CDC), you are aware of Android's USB host functionality. Now you need to ensure your peripheral has implemented USB audio class (the audio source part) and make your app to use the audio class to obtain the audio. This pretty well explained here, so it does not make sense to copy all the information to this post. If you are already using audio class, that page may explain some of the issues you have (e.g. using wrong format).
USB Audio class specifications can be found at USB.org website. The problem with those is that Audio class is pretty large and Android probably does not support everything.

Streaming media content between Android and IOS devices

I would like to implement this scenario:
- one IOS device and one Android device;
- the first simply exposes it's media library to the Android one (connected through BT);
- the second accesses the first's media library and plays with its contents.
I've been looking throught IOS/Android Official documentation and searching online for clean solutions, but it's said everywhere that a2dp (which is the standard BT protocol used for the streaming of media contents) isn't supported natively by Android OS, so that I can't hope in a clean solution.
Could you help me? Or the only possibility i've got is implementing a self-made protocol with buffering and all the other stuff?
PLEASE NOTE!! I'm not asking you to write the application for me, I would only like to know if anybody knows something more about this.

What is RemoteControlClient in Android 4.0?

I know the rules of StackOverflow and hence apologize beforehand for asking such a subjective question.
I tried the documentation but all it says is this :
RemoteControlClient enables exposing information meant to be consumed
by remote controls capable of displaying metadata, artwork and media
transport control buttons.
A remote control client object is associated with a media button event
receiver. This event receiver must have been previously registered
with registerMediaButtonEventReceiver(ComponentName) before the
RemoteControlClient can be registered through
registerRemoteControlClient(RemoteControlClient).
I don't know about others but for me, this much of documentation was not enough for something which has such a cool name as "RemoteControlClient".
I searched a lot of forums for this but unfortunately, the concept is still not clear to me.
Would indeed be grateful if someone helped me understand it, how it works and most importantly, what all it is capable of.
Thanks in advance and apologies for asking a subjective question.
http://developer.android.com/about/versions/android-4.0.html
The new RemoteControlClient allows media players to enable playback controls from remote control clients such as the device lock screen. Media players can also expose information about the media currently playing for display on the remote control, such as track information and album art.
and a few more paragraphs on the subject.
It also points out:
For a sample implementation, see the Random Music Player, which provides compatibility logic such that it enables the remote control client on Android 4.0 devices while continuing to support devices back to Android 2.1.

Categories

Resources