Search code examples
delphidelphi-10-seattletablet-pc

Delphi - TCameraComponent won't find flash


I'm using Delphi 10.0 Seattle and trying to use the rear cameras's light on a Lenovo Thinkpad tablet running Windows 10 Pro. I am using TCameraComponent.

I tried using CameraComponent.TorchMode := TTorchMode.ModeOn from FMX.Media, but it raises an exception saying that the device has no torch.

Anyone know why this happens, and if there is some way to access this light/flash?


Solution

  • FMX in Delphi 10.0 Seattle does not implement either Flash or Torch functionality at all on Windows. It is only implemented on OSX, iOS, and Android.

    You will have to resort to using Windows-specific APIs, or even manufacturer-specific APIs, to access light/torch functionality. For example, there are FlashControl and TorchControl classes in the Windows UWP API.