How to capture video in android with audio muted via default INTENT

657 views Asked by At

I want to capture video by simply opening default video recorder but sound must be disabled while capturing. Thanks in advance.

 Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
 intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
 startActivityForResult(intent, RESULT_VIDEO_CAP);
2

There are 2 answers

4
Mohd Mufiz On

I totally agree with CommonsWare answer it is all depending upon the third party application to accept the parameters and for now there is no third party application which is supporting this tag.

As much as I know there is no third party video recording application which is supporting that mute audio tag. you can override audio manager services and mute recording volume and start video recording Intent but there is no guarantee that third party application will not unmute audio. Another way around implement your own video recording Interface using Surface view or capture video and use any library to mute audio from it.

4
CommonsWare On

There is nothing in the ACTION_VIDEO_CAPTURE protocol that affects audio. You are welcome to use AudioManager and change audio settings yourself, but the third-party app that you are launching is also welcome to change the audio settings, and there is nothing that you can do about that.

The only way to ensure that the audio settings are what you want is to record the video yourself with a MediaRecorder.