I am using this
camera.takePicture(null, rawCallback, jpegCallback);
but with some devices it makes a sound when the camera captures the image.
Please can any one help, how can I mute camera shutter sound?
You can turn it off programmatically from 4.2 onwards with:
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(id, info);
if (info.canDisableShutterSound) {
mCamera.enableShutterSound(false);
}
To mute, put this code before capturing an image
AudioManager mgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
mgr.setStreamMute(AudioManager.STREAM_SYSTEM, true);
camera.takePicture(null, rawCallback, jpegCallback);
After 1 second it will unmute by putting in the below code:
final Handler handler = new Handler();
Timer t = new Timer();
t.schedule(new TimerTask() {
public void run() {
handler.post(new Runnable() {
public void run() {
AudioManager mgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
mgr.setStreamMute(AudioManager.STREAM_SYSTEM, false);
}
});
}
}, 1000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With