I am making an android application in which I have to answer the call and then I want to play pre-recorded audio so that the person calling will hear this.
Is there any API or any library which can I use for this?
Can we do it through text-to-speech ?
Thank you
It is not possible to play audio during call in Android device.
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.
Link to android documentation
https://developer.android.com/guide/topics/media/mediaplayer
For more information
How to play an audio file on a voice call in android
Related
currently I'm developing Android app which using WebRTC native. I want to know if there is a way to record only my voice to file during the call? There is RecordedAudioToFileController.java but it will record my voice and caller voice also. I need to record my voice during the call only. Thank you.
I got it, we need to change the audio source in WebRTCAudioRecord from Voice communication to Mic.
I have a music player in Android, which uses android.media.MediaPlayer to play music from the SD card.
I would like to add the ability to cast the music to a Chromecast device.
I have played around with the democastplayer demo app. Specifically I tried to get the MediaRouteSelector to work with a 'live audio' route, but the 'cast' action button didn't show (suggesting live audio is not supported perhaps?). I also tried a few other things, but had no luck getting democastplayer to send MP3 audio to Chromecast.
Is streaming/sending local SD MP3 files to Chromecast even possible? If so, are there any sample apps or open source projects I can refer to?
Thanks in advance.
You need to add/write a small web server to your android application so it can serve the local media. Then have your sender application send the url of the media (that your local server is serving) to chromecast so it can play the music directly served from your phone.
Yes, Possible to stream your MP3 files by sending file url to chromecast device you can be using remote media player to load the media file. Refer this sample https://github.com/ovingalafsal/ChromeCastSampleApp it might be helpful
Is there a way to play sound through the iPhone or android phone app. Can I play a sound so the other party can hear a song. Is there API access to the telephone stack.
Android does not allow you to modify the outgoing audio stream during a call. The best you can do is to play whatever you want to over the loudspeaker and hope the microphone picks it up.
Apple doesn't allow you to do anything except initiate calls on iOS, so it isn't possible on that either.
Hi i want to record sound that is currently played in android handset, actually i want to get access to audio played by speaker or headphones.
Is there any way to do it?
Not via the Android SDK, sorry.
I'm trying to develop an Android app where as soon as the text to speech is completed an audio file has to be played. How to do this?
If I didn't get wrong idea, you want to use text-to-speech to read some text and store the speech audio into phone in the meantime? And play the audio later?
Have you checked AudioRecordTest? You can record audio and then play it later. Worth to try but I don't think you can get a good quality from the microphone. Hope this helps:)
By the way, as far as I know, android only support to record from mic for unrooted phone, which you can check here. Let me know if you can record sound source from the android system.
I have found the solution and that is in the method onUtteranceCompletedListener() we can know whether the speech is stopped or not and then we can write the code to play the audio file