Stop Camera Click Sound Programmatically In Android
I am using android's default camera to click images from within my app. I want to stop the click sound that it does on clicking an image. Is there a way to stop that click sound pr
Solution 1:
I was able to successfully use the trick to turn the volume down. I did this just before taking the picture:
AudioManagermgr= (AudioManager)getSystemService(Context.AUDIO_SERVICE);
mgr.setStreamMute(AudioManager.STREAM_SYSTEM, true);
And this just after getting the first message back:
AudioManagermgr= (AudioManager)getSystemService(Context.AUDIO_SERVICE);
mgr.setStreamMute(AudioManager.STREAM_SYSTEM, false);
Solution 2:
To disable sound use this code:
AudioManagermgr= (AudioManager)getSystemService(Context.AUDIO_SERVICE);
intstreamType= AudioManager.STREAM_SYSTEM;
mgr.setStreamSolo(streamType, true);
mgr.setRingerMode(AudioManager.RINGER_MODE_SILENT);
mgr.setStreamMute(streamType, true);
To enable sound use this code:
mgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
streamType = AudioManager.STREAM_SYSTEM;
mgr.setStreamSolo(streamType, false);
mgr.setRingerMode(AudioManager.RINGER_MODE_SILENT);
mgr.setStreamMute(streamType, false);
Solution 3:
For my Nexus S running 4.0.3,
AudioManager.STREAM_SYSTEMdoes not prevent camera shutter sound from emitting, but
AudioManager.STREAM_MUSICworks!
Solution 4:
You can mute and unmute your device using the code below:
finalAudioManagermode= (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
//Silent Mode Programatically
mode.setRingerMode(AudioManager.RINGER_MODE_SILENT);
//Normal Mode Programatically
mode.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
Post a Comment for "Stop Camera Click Sound Programmatically In Android"