TTMSFNCWXCamera is a component to access and show a stream of the selected camera.
macOS requires internet connection.
The minimum required
iOS version is
Control the camera
macOS an internet connection is required as the camera file needs to be loaded from an online
source. So as a first step, set the public
FileLocation property to
The camera stream needs to be started manually:
The camera feed can be paused or stopped by calling
List of available camera devices
TTMSFNCWXCamera picks a default camera automatically. It’s possible to change this behaviour
by requesting a list of available camera devices, but keep in mind this functionality requires
internet connection in native applications. For
WEB it’s expected that the application will be hosted
in a secure context.
TTMSFNCWXCamera.CameraType property to
wctSelected to enable camera device
selection. After that, call
TTMSFNCWXCamera.RequestDevices to request a list of the available
devices. This list of devices can be accessed once the
OnCameraDevicesInitialized event is
procedure TForm2.FormCreate(Sender: TObject); begin TMSFNCWXCamera1.CameraType := wctSelected; TMSFNCWXCamera1.RequestDevices; end; procedure TForm2.TMSFNCWXCamera1CameraDevicesInitialized(Sender: TObject); begin if TMSFNCWXCamera1.Devices.Count > 0 then begin TMSFNCWXCamera1.SelectDevice(TMSFNCWXCamera1.Devices.Items); TMSFNCWXCamera1.Start; end; end;
Take a snapshot
Taking a snapshot of the current camera feed is as simple as calling
TTMSFNCWXCamera.TakeSnapshot and implementing the
TakeSnapshot method has an
AFormat parameter which will determine if the snapshould should
be created as PNG or JPEG. By default it is created as PNG.