Play an audio clip onto an ongoing call - android

Is it possible to modify an active call by overlaying a sound track during the call? I looked up the SDK, but couldn't find any API to do this in the documentation.
I am trying to investigate the feasibility of playing a previously recorded call/audio clip onto an ongoing call.

Is it possible to modify an active call by overlaying a sound track during the call?
No, sorry, there is no API to access the in-call audio stream.

Related

Android: AudioManager for audio, is there a equivalent for Video

For android, I've researched for controlling Audio using AudioManager. Will there be one for video which I can control the video player to play/stop/pause.
The purpose of AudioManager isn't really to control audio playback, but to control such properties as volume, audio mode, and so on. If there is a media player in the background, that doesn't really mean that you control it, you can only send certain requests to the AudioManager which cause the system either to take some actions regarding the audio, or to send some events, which the audio player may respond to. So you don't have direct control over the other application.
Likewise, there is no system service which will make the video pause. The best equivalent of AudioManager you have which controls what is shown on the screen is WindowManager, but I think it's obvious that it can't be used to make a video player pause.
Your best bet for controlling an external video player would be to look up its intents, it may have some ways to control the playback from outside. This, of course, will be application specific.
There is no such API like VideoManager
You can handle videos through Primary API MediaPlayer and also see this useful article of multiple ways to handle videos

How to detect if a video is playing on android platform?

Is there some api or method to know if some video is playing on android platform?
I want to stop some background job when a video is playing at foreground.
The api or method had better comes from surfaceflinger, window manager service etc. framework modules.
Thanks.
The SurfaceFlinger process can know that it is receiving frames at a consistent rate, but it can't know if it's a video or just app animation.
The mediaserver process is responsible for managing the hardware video decoders. It can know if a video is being decoded, but it can't know if the video is being displayed. It won't be involved if the app is using a custom software-only decoder.
There isn't an unequivocal way to detect that a video is being played and presented on the display.

Play music during a call [duplicate]

Is it possible to modify an active call by overlaying a sound track during the call? I looked up the SDK, but couldn't find any API to do this in the documentation.
I am trying to investigate the feasibility of playing a previously recorded call/audio clip onto an ongoing call.
Is it possible to modify an active call by overlaying a sound track during the call?
No, sorry, there is no API to access the in-call audio stream.

Play audio file when receiving the call [duplicate]

Is it possible to modify an active call by overlaying a sound track during the call? I looked up the SDK, but couldn't find any API to do this in the documentation.
I am trying to investigate the feasibility of playing a previously recorded call/audio clip onto an ongoing call.
Is it possible to modify an active call by overlaying a sound track during the call?
No, sorry, there is no API to access the in-call audio stream.

How do I play synthesized sounds on Android?

I wrote an iPhone app some time ago that creates sound programatically. It uses an AudioQueue to generate sound. With the AudioQueue, I can register for a callback whenever the system needs sound, and respond by filling a buffer with raw audio data. The buffers are small, so the sound can respond to user inputs with reasonably low latency.
I'd like to do a similar app on Android, but I'm not sure how. The MediaPlayer and SoundPool classes seems to be for playing canned media from files, which is not what I need. The JetPlayer appears to be some sort of MIDI playback engine.
Is there an equivalent to AudioQueue in the Android Java API? Do I have to use native code to accomplish what I want?
Thanks.
With the AudioQueue, I can register for a callback whenever the system needs sound, and respond by filling a buffer with raw audio data.
The closest analogy to this in Android is AudioTrack. Rather than the callback (pull) mechanism you are using, AudioTrack is more of a push model, where you keep writing to the track (presumably in a background thread) using blocking calls.

Categories

Resources