Camera, light, action!
We can take photos with special action components, so what is the purpose of the TCameraComponent
component that can be found in the Additional
category on the tool palette? A quick answer could be that it is the way to switch on and off the bright torch light that most phones are equipped with. A more elaborate answer would be that it can be used to make videos.
The source code for switching on and off the integrated camera light is simple. Create a new multi-device, blank application. Save the form's unit as uFormVideo
and the whole project as VideoApp
. Drop TToolbar
on the form and then TCheckBox
onto it. Rename the checkbox as chkbxTorchLight
, change its Text
property to Torch Light
, and align it to the Right
.
Drop TCameraComponent
on the form. Not every device has a torch light, so first we want to check in the code if the torch light is present and enable or disable the checkbox. The natural place for such a check is in the OnCreate
event of the form.
Add the following...