While user call using sinch video call, I need microphone to record what he said then translate. But I can't use microphone. Can somebody help me?
Asked
Active
Viewed 161 times
1 Answers
0
The microphone can only be used by one process at a time. You can check if the Sinch video call is occupying the microphone using the snipped below
public static boolean checkIfMicrophoneIsBusy(Context ctx){
AudioRecord audio = null;
boolean ready = true;
try{
int baseSampleRate = 44100;
int channel = AudioFormat.CHANNEL_IN_MONO;
int format = AudioFormat.ENCODING_PCM_16BIT;
int buffSize = AudioRecord.getMinBufferSize(baseSampleRate, channel, format );
audio = new AudioRecord(MediaRecorder.AudioSource.MIC, baseSampleRate, channel, format, buffSize );
audio.startRecording();
short buffer[] = new short[buffSize];
int audioStatus = audio.read(buffer, 0, buffSize);
if(audioStatus == AudioRecord.ERROR_INVALID_OPERATION || audioStatus == AudioRecord.STATE_UNINITIALIZED /* For Android 6.0 */)
ready = false;
}
catch(Exception e){
ready = false;
}
finally {
try{
audio.release();
}
catch(Exception e){}
}
return ready;
}

Sunny Varkas
- 88
- 7
-
It return false. the sinch video call hold the micro. Is there anyway to get micro for recording? – kings landing Apr 06 '17 at 04:12
-
Hi, no we need it, so its not possible, sorry – cjensen Apr 07 '17 at 17:36