We are developing the Android Framework, and the default of the audio output is HDMI.
When the bluetooth is connected with the Android, the audio output will be redirected to the bluetooth via A2DP protocol. How can we route the audio to the bluetooth speaker and the HDMI output at the same time? We have looked framework/base/media/java/android/media/AudioService.java and the frameworks/av/services/audioflinger/AudioFlinger.cpp, but I have no idea now. Does someone has the experience? Thanks!
I am quite certain that this is not possible to do.
I am completely convinced that this is something that you shouldn't do.
When you send audio over A2DP it is re-encoded, it is not the same audio stream that the one you send over HDMI.
They will also be out of sync, since you have completely different delays between A2DP and HDMI.
Related
I am developing an app that makes use of an Android device microphone and Bluetooth headset. The audio is transmitted from the microphone to the headset immediately. My use case might greatly benefit from the so called "audio beamforming", when the audio signal is amplified in a specific physical direction while sound from all the other directions is attenuated. As far as I understand, this technique requires at minimum 2 audio inputs running synchronously, which in my case should be the microphone of the device itself and the microphone on the Bluetooth headset.
Is this feasible in Android SDK or NDK? Thanks in advance!
I am currently trying to figure out an issue related to routing separate audio streams to different headsets simultaneously in my android application.
Basically, what I need is to stream one sound file to a wireless Bluetooth headset and simultaneously stream a different sound file to another headset. The second headset can be either wired or Bluetooth, it doesn't really matter as much.
Has anyone attempted something similar to this, or have an idea of how to go about doing this?
Thanks
I am currently working on an Android audio visualizer using connected smart home devices (such as Philips hue) to visualize music. I have trouble compensating the delay caused by bluetooth speakers.
I have noticed, that the Youtube app, in difference to many other video streaming apps, has almost no delay between audio and video, when using bluetooth speakers.
I figure, that they must compensate for the bluetooth latency by adjusting (delaying) the video signal.
Is there a reasonable way of detecting or approximating the latency/delay of bluetooth speakers?
Thank you very much for you help!!
Best,
Stefan
This would not work for Bluetooth speakers. However, I have been able to measure the audio latency of a Bluetooth dongle using Google's Dr. Rick O'Rang loopback dongle, using Glenn Kasten test app.
AVDTP 1.3 protocol supports delay reporting. Try looking to see if Android exports this data.
It's in the somewhere: AVDT_PSC_DELAY_RPT is present in https://android.googlesource.com/platform/system/bt/+/master/stack/include/avdt_api.h#153.
I have a headset device. I want to transfer my voice from the headset to my mobile. The mobile can play my sound via its speaker. Hence, I need to turn of Media audio in default setting (Left image) after headset connect with phone by Bluetooth. I am looking for a solution to turn off Media audio by programming such as right image. Could you suggest to me the solution for my work?
If you are searching for ways to toggle audio while being connected to A2DP or Non-A2DP I have written a test application which can provide you the basic knowledge of audio routing. Github Repo for the test application: https://github.com/sauravpradhan/Basic-Audio-Routing
I'm considering building an Android app that allows for streaming audio via bluetooth to and from the Android phone. I've read similar questions on Stackoverflow before, and based on my understanding, A2DP cannot be used as Android can't become an A2DP sink.
In theory, I believe that a profile such as HFP or HFP AG should allow for bidirectional audio streams. In the Android API, is there a way to force a bluetooth pairing to follow this profile, or does the OS decide which profile to use (such as forcing HFP only when there's a phone call going on)?
I've been able to achieve what I wanted using RFCOMM-based SPP. In order to send audio to the external device, I use the AudioRecord API to record PCM-16 audio to stream audio realtime over Bluetooth. In order to receive audio, I spawn a thread that is responsible for outputting audio to the speaker using the AudioTrack API (in streaming mode)