OK, sự cố của tôi khá đơn giản.Bật/Tắt Flash
Tôi đã bật đèn flash Bật (và giữ nút Bật).
Tuy nhiên, tôi vẫn không chắc chắn cách tắt (lol).
Dưới đây là mã của tôi:
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);
}
Bất kỳ ý tưởng?
P.S.
- tôi tưởng tượng rằng chuyển đổi
.on
s để.off
s có thể làm việc, nhưng nó không. - này đã được thử nghiệm trên HTC 8S và Lumia 820.
Vâng, đó là tuyệt vời - và đơn giản như vậy! ** Nó hoạt động **! Cảm ơn rất nhiều, bạn thân! ;-) –