Vivek Saurav
Vivek Saurav

Reputation: 2275

C#: Set Brightness for phone Windows Phone 8.1 camera

I was trying to change the Windows phone Camera Brightness

I Have tried this code

private async Task StartCapture()
    {
                mediaCapture = new MediaCapture();

                var _deviceInformation = await GetCameraDeviceInfoAsync(Windows.Devices.Enumeration.Panel.Back);

                var settings = new MediaCaptureInitializationSettings();
                settings.StreamingCaptureMode = StreamingCaptureMode.Video;
                settings.PhotoCaptureSource = PhotoCaptureSource.VideoPreview;
                settings.AudioDeviceId = "";
                if (_deviceInformation != null)
                    settings.VideoDeviceId = _deviceInformation.Id;

                await mediaCapture.InitializeAsync(settings);
                mediaCapture.VideoDeviceController.Brightness.TrySetValue(50);



            captureReceipt.Source = mediaCapture;
            await mediaCapture.StartPreviewAsync();


    }

    private static async Task<DeviceInformation> GetCameraDeviceInfoAsync(Windows.Devices.Enumeration.Panel desiredPanel)
    {

        DeviceInformation device = (await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture))
            .FirstOrDefault(d => d.EnclosureLocation != null && d.EnclosureLocation.Panel == desiredPanel);


        return device;
    }

And the Xaml is :

<Grid>
    <CaptureElement x:Name="captureReceipt"/>
</Grid>

But i was not able to alter the brightness of the camera

Is there any way i could change the brightness of windows phone camera?

Upvotes: 2

Views: 275

Answers (1)

Jogy
Jogy

Reputation: 2475

Check the values in mediaCapture.VideoDeviceController.Brightness.Capabilities.

Are Supported and AutoModeSupported set to true? What are the values for Min, Max and Default?

Upvotes: 1

Related Questions