how to mute the "beep" by MediaRecorder.start()?

I have tried all methods mentioned in the following links

How to shut off the sound MediaRecorder plays when the state changes

Need to shut off the sound MediaRecorder plays when the state changes

but none of them work.

Anyone knows how to achieve that ?


Though I am too late to answer it. It may still help peoples who all are googling the same problem.

Before starting media recorder add following two lines of code .. Its gonna mute phones sound..

//mute phone
 AudioManager audioManager = (AudioManager) context.getSystemService(AUDIO_SERVICE);
 audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
 mediaRecorder.start();

After starting media recorder wait one or two seconds and un-mute the phone, u may use following runnable...

new Thread(new UnmuterThread()).start();


 //timer thread to un-mute phone after 1 sec
//This is runnable inner class inside your activity/service
class UnmuterThread implements Runnable{

    @Override
    public void run() {
        synchronized (this){
            try {
                wait(1000);
            } catch (InterruptedException e) {
            } finally {
                //unmute the phone
                AudioManager audioManager1 = (AudioManager) context.getSystemService(AUDIO_SERVICE);
                audioManager1.setRingerMode(AudioManager.RINGER_MODE_NORMAL);                                   }
        }
    }
}
链接地址: http://www.djcxy.com/p/23926.html

上一篇: JavaScript中的事件循环模型

下一篇: 如何通过MediaRecorder.start()静音“嘟嘟”?