
- Introduction
Camera for iOS is a Firemonkey component, which support iOS platform only. It uses AVFoundation framework and supports native video preview. It also supports native barcode detection (EAN, QR Code, Data Matrix, Aztec, UPC-E, PDF417, ITF 14, etc.) and native face detection.
2. Components in the Demo and what they do

The Demo contains a TabControl which opens two screens (tabs). The Screen ‘Preview’ opens the camera in a format, set up in the ‘Settings’ screen. The Settings screen itself contains the main settings that the Camera component offers. The description of a certain settings is shown with TLabel and the Dropdown options are loaded in TComboBox. For example at the top you can choose between rear and front camera which respectively open one of the both camera on the phone. In the next code below you will see how this is handled:
1 2 3 4 5 6 7 8 |
if ComboBoxCamera.Selected <> nil then begin ICamera.Device := FindDevice(ComboBoxCamera.Selected.Text); if ICamera.Device <> nil then ICamera.RequestAccess; end; ComboBoxFormat.Items.Clear; ComboBoxFormat.Enabled := ICamera.Device <> nil; |
The function FindDevice goes through the camera devices of the phone and filters the chosen one by name, as it follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<strong>function</strong> <strong>TFormMain</strong>.FindDevice(<strong>const</strong> Name: <strong>string</strong>): AVCaptureDevice; var Devices: TArray<TICameraCaptureDevice>; I: Integer; begin Devices := ICamera.CaptureVideoDevices; for I := 0 to Length(Devices) - 1 do if Name = Devices[I].Name then begin Result := Devices[I].Device; Exit; end; Result := nil; end; |
Same structure and logic is used for the rest of the settings – Camera format, resolution, Flash, on or off, Torch on or off, etc.
There are also two timers – one for the face recognition and one for the barcode recognition. When started, they both hide the rectangles for the Face recognition or barcode recognition, depending on of has been caught by the Camera component.
1 2 3 4 5 6 7 8 9 10 11 |
procedure TFormMain.TimerFaceTimer(Sender: TObject); begin TimerFace.Enabled := False; RectangleFace.Visible := False; end; procedure TFormMain.TimerBarcodeTimer(Sender: TObject); begin TimerBarcode.Enabled := False; RectangleBarcode.Visible := False; end; |
In the short video below you can see the Demo in action:
You can downlaod the Demo from the link below:
https://winsoft.sk/icamera.htm
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition