1

So I am initialising a MediaCapture element in my UWP application on my Surface Pro device like so:

            // Create MediaCapture and its settings
            mediaCapture = new MediaCapture();
            var mediaInitSettings = new MediaCaptureInitializationSettings
            {
                VideoDeviceId = cameraDevice.Id,
                AudioDeviceId = string.Empty,
                //StreamingCaptureMode = StreamingCaptureMode.Video,
                //PhotoCaptureSource = PhotoCaptureSource.Photo
            };

            // Initialize MediaCapture
            try
            {
                await mediaCapture.InitializeAsync(mediaInitSettings);
                ....
            }

at the line InitializeAsync the application asks for both camera and microphone capabilities.

Now I have no need for the Microphone capability as I am only capturing photos and many of my users deny access to the Microphone saying "Why do you need microphone access to take a photo"

I tested using the built in "Camera" app and denying permission to the Microphone on windows and this works perfectly.

I looked at the documentation and it says:

InitializeAsync will launch a consent prompt to get the user's permission for the app to access the microphone or camera

So is it possible to stop the app asking for Microphone permissions?

JKennedy
  • 18,150
  • 17
  • 114
  • 198

1 Answers1

2

Ok I managed to solve it pretty easily by changing the StreamingCaptureMode on the MediaCaptureInitializationSettings adding this line:

StreamingCaptureMode = StreamingCaptureMode.Video

so it became:

var mediaInitSettings = new MediaCaptureInitializationSettings
{
     VideoDeviceId = cameraDevice.Id,
     AudioDeviceId = string.Empty,
     StreamingCaptureMode = StreamingCaptureMode.Video,
};
JKennedy
  • 18,150
  • 17
  • 114
  • 198