【发布时间】:2013-06-20 00:06:42
【问题描述】:
好的,我的问题很简单。
我已经成功地打开了闪光灯(并保持打开状态)。
但是,我仍然不确定如何将其关闭(笑)。
这是我的代码:
var sensorLocation = CameraSensorLocation.Back;
try
{
// get the AudioViceoCaptureDevice
var avDevice = await AudioVideoCaptureDevice.OpenAsync(sensorLocation,
AudioVideoCaptureDevice.GetAvailableCaptureResolutions(sensorLocation).First());
// turn flashlight on
var supportedCameraModes = AudioVideoCaptureDevice
.GetSupportedPropertyValues(sensorLocation, KnownCameraAudioVideoProperties.VideoTorchMode);
if (supportedCameraModes.ToList().Contains((UInt32)VideoTorchMode.On))
{
avDevice.SetProperty(KnownCameraAudioVideoProperties.VideoTorchMode, VideoTorchMode.On);
// set flash power to maxinum
avDevice.SetProperty(KnownCameraAudioVideoProperties.VideoTorchPower,
AudioVideoCaptureDevice.GetSupportedPropertyRange(sensorLocation, KnownCameraAudioVideoProperties.VideoTorchPower).Max);
}
else
{
turnWhiteScreen(true);
}
}
catch (Exception ex)
{
// Flashlight isn't supported on this device, instead show a White Screen as the flash light
turnWhiteScreen(true);
}
有什么想法吗?
附言
- 我原以为将
.ons 转换为.offs 可以,但它没有。 - 已在 HTC 8S 和 Lumia 820 上进行了测试。
【问题讨论】:
标签: c# xaml camera windows-phone-8