Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

play an audio file on a voice call

Tags:

android

I have a rather tricky question this time.
I want to know how to Inject audio to microphone source during a call.
I know I have read dozens of topics here and there that states "it's not possible", "don't bother" etc..
But there are many things made impossible for us dev's by Android staff and we always managed to come up with a work-around-it.
For example, this time the easiest solution would be to play the audio via speaker with max volume, do a noise cancellation and hope for the best. ;)

like image 338
Phoenix666 Avatar asked Aug 12 '11 15:08

Phoenix666


People also ask

Can you play audio during a phone call?

Turn on the hands free function of your phone. Create a media player, set the media source, set the volume to 1.0f (highest) and call player. start() . If the microphone and speakers on the phone are of reasonable quality, the other party to the call will hear the music.

How can I listen to music while on a call speaker?

Playing music or any other audio while on a phone call is easy: While on an active phone call, tap the Home button to get to the home screen. Open the Music app, find any song or podcast, and press play.

How do I play an audio file?

Open File Manager and navigate to the folder where the audio file is located. Drag the audio file icon from File Manager and drop it on the Audio main window. The Selected file is opened. If Automatically play audio file on Open is selected in the Options-Play dialog box, the audio file starts playing.


1 Answers

From the official documentation:

Note: You can play back the audio data only to the standard output device. Currently, that is the mobile device speaker or a Bluetooth headset. You cannot play sound files in the conversation audio during a call.

The only thing I could think of would be to somehow interleave the call sound and the sound you want to play, but you don't have direct control over the call sound, so this is likely impossible.

It looks like this may change in 3.3, but it's currently not possible to do without using the NDK and/or writing your own distro of Android.

Sorry! :(

like image 66
Codeman Avatar answered Oct 16 '22 13:10

Codeman