Android play sound during phone call

2019-04-12 08:15发布

问题:

I want to play music from android phone when some one receives a call. I am able to play music but other side can not listen that music. How can I make other side to listen to music(what should be the coding so that music playback can be inserted into mic for other side to hear)?

I am getting mixed suggestion regarding this feature.check here it is possible

回答1:

If you're still curious, the reason you cannot play to the other side is that Android's hardware usually doesn't interconnect the actual GSM call stream with any part of software stack that can be used to modify it; what it does is mirroring actual call data (microphone/speaker) to software after it's been sent to line (allowing a little control like setting microphone mute, sending DTMFs and hanging the call).

The exact sound routing is done in phone chip, so no control over it can be achieved; more to say, Bluetooth audio streams are decoded and mirrored in chip (this technology is called DAIBT for direct audio interface), and this effectively works for latency and power effeciency.


Some vendors (currently known: Qualcomm) are providing vendor-specific way to inject audio into GSM call uplink on certain chipsets (MSM8960, APQ8064) - refer to this answer: https://stackoverflow.com/a/15205455/438039;



回答2:

I am using HTC device and it was not possible to achieve the above functionality in this device. This setting varies according to manufacturer. My code might play sound to the listener side in some other manufacturer phones.