录制视频时禁用麦克风

时间:2016-10-07 16:07:36

标签: android video-recording

我试着:

audioManager.setMicrophoneMute(true);
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0);

并没有帮助!! (请帮助找到解决方案)

1 个答案:

答案 0 :(得分:0)

mrec = new MediaRecorder();  
mCamera.unlock();

mrec.setCamera(mCamera);

mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA);

CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_480P);

mrec.setOutputFormat(profile.fileFormat);
mrec.setVideoFrameRate(profile.videoFrameRate);
mrec.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight);
mrec.setVideoEncodingBitRate(profile.videoBitRate);
mrec.setVideoEncoder(profile.videoCodec);
mrec.setPreviewDisplay(surfaceHolder.getSurface());
mrec.setOutputFile("/sdcard/sample.3gp");

mrec.prepare();
mrec.start();