I need to turn ON and OFF the built in camera LED FLASHER on a Windows 8 tablet.
This is bascially the same as a common FLASHLIGHT APP on a cell phone.
I need to make this work within a Delphi 2010 VCL application and all I can
find is code written in C++. I do not know how to implement the Windows system
function calls for the "AudioVideoCaptureDevice" method.
The code snippet below is from a fully functional FLASHLIGHT APP for Windows 8 devices.
HELP !!!! PLEASE !!!
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
{
ShowWhiteScreenInsteadOfCameraTorch();
}
}
catch(Exception ex)
{
// Flashlight isn't supported on this device, instead show a White Screen as the flash light
ShowWhiteScreenInsteadOfCameraTorch();
}