Setting AutoFlash on Windows Phone 8.1 / WinRT

I am currently using MediaCapture in a Windows Phone 8.1 application. My camera works as needed, but changing the state of the flash is difficult. As with the default camera application, I’m looking for three states - "Auto", "Off." And on. The code I use is as follows:

switch (mode)
    {
      case FlashMode.Auto:
        _captureManager.VideoDeviceController.FlashControl.Auto = true;
        _captureManager.VideoDeviceController.FlashControl.Enabled = false;
        if (_captureManager.VideoDeviceController.FlashControl.AssistantLightSupported)
          _captureManager.VideoDeviceController.FlashControl.AssistantLightEnabled = true;
        break;

      case FlashMode.On:
        _captureManager.VideoDeviceController.FlashControl.Auto = false;
        _captureManager.VideoDeviceController.FlashControl.Enabled = true;
        if (_captureManager.VideoDeviceController.FlashControl.AssistantLightSupported)
          _captureManager.VideoDeviceController.FlashControl.AssistantLightEnabled = true;
        break;

      case FlashMode.Off:
        _captureManager.VideoDeviceController.FlashControl.Auto = false;
        _captureManager.VideoDeviceController.FlashControl.Enabled = false;
        if (_captureManager.VideoDeviceController.FlashControl.AssistantLightSupported)
          _captureManager.VideoDeviceController.FlashControl.AssistantLightEnabled = false;
        break;
    }

On Modes and off work fine, and when you start the camera is set to "Auto". However, as soon as you change the camera to on, then off, and then back to auto, the flash never turns on (I checked that it wasn’t lighting the scene). Any ideas how I can reuse auto flash?

+4
source
1

Enabled Auto, FlashControl.

, Enabled Auto true.

+1

All Articles