while user call using sinch video call, need microphone record said translate. can't use microphone. can me?
the microphone can used 1 process @ time. can check if sinch video call occupying microphone using 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 /* android 6.0 */) ready = false; } catch(exception e){ ready = false; } { try{ audio.release(); } catch(exception e){} } return ready; }
Comments
Post a Comment