Javascript + phoneGap - how to determine when in an active phone call

I was looking for this question, and this is an unanswered question, I was wondering if anyone could help figure this out ...

Using javascript libraries and phone calls, I would like to place a phone call, and when the call is answered, play the audio file to the recipient. This sound should be played only to the recipient, and not through the speakers of the phone. In other words, sound is played as part of an active call. An example would be when calling a local store, and the call will be put on hold while playing music for the caller.

  • Question 1) Are there any methods or plugins that anyone knows that will detect when the call is really active / answered?

  • Question 2) How to play pre-recorded .mp3 sound during an active call?

Any help or pointers would be highly appreciated,

+8
javascript android ios cordova sencha-touch
source share
1 answer

You should probably see how this is done in native first.

Question 1 goes through listening to the system that dispatches the android.intent.action.PHONE_STATE event, and that is "childs".

A google search for Question 2 suggests something like:

  AudioTrack track = new AudioTrack(AudioManager.STREAM_VOICE_CALL, mySampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, myBuffersize, AudioTrack.MODE_STREAM); 

Perhaps this information may give you a more specific search if a telephone delay made transfers for this.

0
source share

All Articles