Set ConnectyCube P2P video call On-Hold

160 views Asked by At

I am developing an application which is using ConnectyCube to establish a P2P video call between two contacts. During this call, I'm trying to use the SpeechRecognizer API to translate some voice inputs into text.

I am running into a few problems integrating both the ConnectyCube video call and the SpeechRecognizer, since they both need to run at the same time which means they both need to use the audio stream at the same time.

Trying to start listening through the SpeechRecognizer while a ConnectyCube video call is in progress throws an "ERROR_AUDIO" error:

/** Audio recording error. */
public static final int ERROR_AUDIO = 3;

Following this incompatibility, my idea was to pause or suspend ConnectyCube's audio stream so it could then be used by the SpeechRecognizer. However, I haven't had any success accomplishing this.

I have tested disabling the RTCSession AudioTrack as well as closing the MediaStream entirely, both with no success:

currentCall?.mediaStreamManager?.close()

and/or

currentCall?.mediaStreamManager?.localAudioTrack?.setEnabled(false)

I have also searched for a way to put the call On-Hold (so it would, in theory, release the audio stream) but found no method in the SDK to do so. Is there a way to put a call On-hold without hanging up?

If the above isn't possible, is there anything else I can try to achieve what I mentioned above?

Thank you!

1

There are 1 answers

1
Aubergine On

ERROR_AUDIO occurs because there is no access to android audio input which occupied by webrtc side.

So, to use SpeechRecognizer you need to close the current call, use SpeechRecognizer and then create new call again.