在 Windows Phone 8.1/WinRT 中设置 AutoFlash
Setting AutoFlash in Windows Phone 8.1/WinRT
我目前在 Windows Phone 8.1 应用程序中使用 MediaCapture。我让相机按要求工作,但事实证明改变闪光灯状态很困难。
与默认相机应用程序一样,我希望具有三种状态 - 自动、关闭和打开。我使用的代码如下:
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;
}
开和关模式工作得很好,当相机启动时它被设置为自动。但是,一旦您将相机更改为打开,然后关闭然后返回到自动,闪光灯就再也不会打开(我已经确认这不是场景的照明)。有什么办法可以重新启用自动闪光吗?
Enabled
优先于 Auto
,因为它在整个 FlashControl
.
上运行
如果要自动闪光,需要将Enabled
和Auto
设置为true
。
我目前在 Windows Phone 8.1 应用程序中使用 MediaCapture。我让相机按要求工作,但事实证明改变闪光灯状态很困难。 与默认相机应用程序一样,我希望具有三种状态 - 自动、关闭和打开。我使用的代码如下:
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;
}
开和关模式工作得很好,当相机启动时它被设置为自动。但是,一旦您将相机更改为打开,然后关闭然后返回到自动,闪光灯就再也不会打开(我已经确认这不是场景的照明)。有什么办法可以重新启用自动闪光吗?
Enabled
优先于 Auto
,因为它在整个 FlashControl
.
如果要自动闪光,需要将Enabled
和Auto
设置为true
。