1

How to remove the sound "beep" when the video recording starts using MediaRecorder? To solve this problem I use the following method:

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);
}

But this method works for me only for android versions below 6. Is there a working mode for a android Marshmallow and above? Thanks.

Sergey Unk
  • 161
  • 1
  • 1
  • 11

1 Answers1

0

I just tried on Android 6.1:

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

and it works

Choletski
  • 7,074
  • 6
  • 43
  • 64