android 录像静音,Android – 静音麦克风录制视频时
尝试以下代码:private void setMicMuted(boolean state){AudioManager myAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);// get the working mode and keep itint workingAudioMode = my
·
尝试以下代码:
private void setMicMuted(boolean state){
AudioManager myAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
// get the working mode and keep it
int workingAudioMode = myAudioManager.getMode();
myAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
// change mic state only if needed
if (myAudioManager.isMicrophoneMute() != state) {
myAudioManager.setMicrophoneMute(state);
}
// set back the original working mode
myAudioManager.setMode(workingAudioMode);
}
更多推荐
已为社区贡献3条内容
所有评论(0)