android如何关闭MediaRecorder录制视频时的提示音

自定义视频录制时,开始录制和结束录制都会有“哔”的提示音,怎么去掉呢?网上搜索了好些答案,尝试了个遍,都没有效果,比如以下这些:


    private int mVolumeStreamAlarm;
    private int mVolumeStreamDtmf;
    private int mVolumeStreamNotification;
    private int mVolumeStreamRing;
    private int mVolumeStreamSystem;
    private int mVolumeStreamMusic;

    private void closeSound() {
        //暂时关闭所有声音
//        AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
//        mVolumeStreamAlarm = audioManager.getStreamVolume(AudioManager.STREAM_ALARM);
//        mVolumeStreamDtmf = audioManager.getStreamVolume(AudioManager.STREAM_DTMF);
//        mVolumeStreamNotification = audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
//        mVolumeStreamRing = audioManager.getStreamVolume(AudioManager.STREAM_RING);
//        mVolumeStreamSystem = audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM);
//        mVolumeStreamMusic = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
//        audioManager.setStreamVolume(AudioManager.STREAM_ALARM, 0, 0);
//        audioManager.setStreamVolume(AudioManager.STREAM_DTMF, 0, 0);
//        audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, 0);
//        audioManager.setStreamVolume(AudioManager.STREAM_RING, 0, 0);
//        audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, 0, 0);
//        audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0);
        // disable sound when recording.
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_ALARM, true);
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_DTMF, true);
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_MUSIC, true);
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_RING, true);
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_SYSTEM, true);
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_VOICE_CALL, true);
    }

    private void recoverSound() {
        //恢复声音
//        AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
////        audioManager.setStreamVolume(AudioManager.STREAM_ALARM, mVolumeStreamAlarm, 0);
////        audioManager.setStreamVolume(AudioManager.STREAM_DTMF, mVolumeStreamDtmf, 0);
////        audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, mVolumeStreamNotification, 0);
////        audioManager.setStreamVolume(AudioManager.STREAM_RING, mVolumeStreamRing, 0);
////        audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, mVolumeStreamSystem, 0);
////        audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, mVolumeStreamMusic, 0);
        // re-enable sound after recording.
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_ALARM, false);
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_DTMF, false);
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_MUSIC, false);
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_RING, false);
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_SYSTEM, false);
        ((AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_VOICE_CALL, false);
    }

都没用。。。
为什么抖音,微信,QQ,人家都可以。。。

AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

audioManager.setStreamMute(AudioManager.STREAM_SYSTEM, true);
audioManager.setStreamMute(AudioManager.STREAM_MUSIC,true);
audioManager.setStreamVolume(AudioManager.STREAM_ALARM, 0, 0);
audioManager.setStreamVolume(AudioManager.STREAM_DTMF, 0, 0);
audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, 0);
audioManager.setStreamVolume(AudioManager.STREAM_RING, 0, 0);