1

使用 MediaRecorder 开始录制视频时如何消除“哔”声?为了解决这个问题,我使用以下方法:

private int[] audioStreams = new int[] { AudioManager.STREAM_ALARM,
            AudioManager.STREAM_DTMF, AudioManager.STREAM_MUSIC,
            AudioManager.STREAM_RING, AudioManager.STREAM_SYSTEM,
            AudioManager.STREAM_VOICE_CALL,AudioManager.STREAM_NOTIFICATION, AudioManager.RINGER_MODE_SILENT};

for (int i = 0; i < numStreams; i++) 
{
    audioManager.setStreamVolume(audioStreams[i], 0, 0);
}

但是这种方法仅适用于 6 以下的 android 版本。android Marshmallow 及以上版本是否有工作模式?谢谢。

4

1 回答 1

0

我刚刚在 Android 6.1 上试过:

((AudioManager)context.getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_SYSTEM,true);

它有效

于 2017-09-05T14:43:59.110 回答