While this is a old post, thought would share the experience i have so far with trying this..
In the simplest sense, no.. you can not But there are “some” exceptions here, but if your looking to build an application for the public.. This is not for you… its device specific…
WHY WE CANT PLAY AUDIO DURING A CALL
The simple fact is the microphone / input audio stream during a phone call is not able to be pre-processed or replaced with another stream of any form.
So simply while one would think its easy to use media during a call, it simply is not possible due to the way the android system processes the audio.
SO WHAT ARE THE WAYS PEOPLE HAVE DONE IT??
Well lets start simple… They have not, they have managed to hack or use a exploit to do so or some device specific programming to do this.. ONE CODE WILL NOT FIT ALL HERE
As far as i have been able to see and research on this topic, there are means by using adb or messing with codecs and the kernel.. But simply i have not looked to far into this as i am ideally seeking a solution that works on all devices and is only restrictive by the API being used.
WHY DID ANDROID/GOOGLE/HARDWARE DO THIS TO US???
Well your guess is as good as mine, but one would think its to do with the way this can be exploited.. Having a application to mask your voice, a rouge application that answers calls for you and so on.. Simply i myself can see plenty of good reasons why to not allow it, but really wish it was allowed/possible because with any technology people will be screwed over with anyway.
ALTERNATIVE METHODS FOR THIS????
Well this is the tricky question, simply there is no true alternative if your core requirement is to play an audio stream on a live call to the other party from your phone… Some people revert to using VoIP for redirecting and handling this or other logic methods..
APPLICATIONS WHO CLAIM TO DO THIS!?!?!
Firstly, download one and test it with two phones…. Does the sound truely get streamed along with your normal audio to them or does it just appear faint/broken up or not just there at all.
The only true known method that works on all android devices, is using the loud speaker.. Which also makes me wonder why Elias was down voted for this as technically its the only answer that is a valid way of doing this instead of people simply saying “No, Its Not Possible”..
The only applications to truly have this working in any way, are the ones who are targeted for set devices.. They will not work with a no-name brand or in general with all android devices. Read the reviews and find out for yourself
SO WHAT DO WE DO IN THE MEAN TIME
…………… wish that it was possible …………