Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mute camera shutter sound on android phone

Tags:

Is there any way to mute the camera shutter sound in Android (not rooted phone)?

I use this code to mute my audio sound when taking picture:

  AudioManager mgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
    int streamType = AudioManager.STREAM_SYSTEM;
    mgr.setStreamSolo(streamType, true);
    mgr.setRingerMode(AudioManager.RINGER_MODE_SILENT);
    mgr.setStreamMute(streamType, true);

I mute the sound and silent the phone.

mCamera.takePicture(null, null, photoCallback); 

then take the picture

It's working on HTC HERO, HTC Desire, Motorola ME860, MotoA953. But when I tested it on Samsung Tab p1000 and Sony Experia R800i, it's not working. Is there any other work around?

like image 658
user430926 Avatar asked Apr 30 '12 11:04

user430926


People also ask

How do I turn off the Shutter sound on my Samsung phone?

From the main screen, tap the "Camera" icon. Tap the "Settings" icon. Locate and tap "Shutter sound" to enable/disable the shutter tone. Tap the "Back" icon.

How do I make my pictures silent on my phone?

Just flip the Ring/Silent switch – located on the left side of your phone – down, revealing the orange color behind it, and the camera won't make noise when taking a picture. Quick tip: On older iPhones, you'll have to flip the Ring/Silent switch away from you instead of down.

How do I get my phone to stop making the noise everytime I take a pic on snap or Insta?

For an Android phone, bring down your notification panel. For an iOS device, bring up your control center. You'll see the “do not disturb” icon in either the control center or notification panel. Click on it to disable the shutter sound when taking your snaps.


2 Answers

try this code:

AudioManager manager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
if(TextUtils.equals(muteMode, "mute")){
    manager.setStreamVolume(AudioManager.STREAM_SYSTEM, 0 , AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
}else{
    manager.setStreamVolume(AudioManager.STREAM_SYSTEM, manager.getStreamMaxVolume(AudioManager.STREAM_SYSTEM) , AudioManager.FLAG_ALLOW_RINGER_MODES);
}
//here continue to take picture...

do not use AudioManager.setStreamMute() method since there is a known issue on android below version 2.3..

like image 186
Kimia Zhu Avatar answered Oct 17 '22 08:10

Kimia Zhu


Since API level 17 (4.2) there is a proper, reliable way to do this, if the phone manufacturer supports it.

First, detect whether you can disable the shutter sound programatically, then disable it

Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(id, info);
if (info.canDisableShutterSound) {
    mCamera.enableShutterSound(false)
}

You'll need to set id to the appropriate camera id in the call to Camera.getCameraInfo, or disable them all in a loop from 0 to Camera.getNumberOfCameras()- 1.

The developer documentation recommends that you play another sound in place of the shutter sound, but you're not obliged to.

like image 36
David Snabel-Caunt Avatar answered Oct 17 '22 06:10

David Snabel-Caunt