如何在静音android手机相机的快门声 [英] How to mute camera shutter sound on android phone
问题描述
有没有什么办法可以在静音的Android(不根植电话)?
Is there any way to mute the camera shutter sound in Android (not rooted phone)?
我用这个code静音我的音乐声拍照时:
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
它的工作对 HTC HERO上,HTC Desire,摩托罗拉ME860,MotoA953
。但是,当我测试了三星P1000标签
和索尼Experia还R800i
,它不工作。有没有其他变通?
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?
推荐答案
试试这个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...
不使用AudioManager.setStreamMute()方法,因为有对Android的一个已知问题下面的2.3版本。
do not use AudioManager.setStreamMute() method since there is a known issue on android below version 2.3..
这篇关于如何在静音android手机相机的快门声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!