(BETA) Allows use of native device camera apps. More...
Import Statement: | import ArcGIS.AppFramework.Multimedia 1.0 |
Properties
- cameraInfo : object
- captureFlags : int
- captureMode : int
- captureToLocation : url
- error : object
- fileUrl : url
- title : string
Signals
Methods
Detailed Description
The CameraDialog component provides access to the system's capera to take photos and movies, using the best resolution supported by the system. For iOS and Android, it will open the device's native camera app. For other platforms (macOS, Windows and Linux) this component will instead open a custom camera app. After the capture is complete, you can play back recorded video or view captured photos before saving the file on your device.
To use this component, the camera, microphone, audio, and external storage capabilities all need to be enabled in the Capabilities tab of the Settings tool.
The following code sample demonstrates the usage of CameraDialog, using it to open the camera and capture a still image.
Item { Button { text: "Open Camera" onClicked: { cameraDialog.open() } } CameraDialog { id: cameraDialog captureMode: CameraDialog.CameraCaptureModeStillImage captureFlags: CameraDialog.CameraCaptureFlagCameraRoll title: "CameraDialog Test" onCaptureToLocationChanged: { console.log("captureToLocation: " + captureToLocation); } onAccepted: { console.log("Captured image: " + fileUrl); } onRejected: { console.log("capture cancelled"); } onErrorChanged: { console.log("Error: " + error.errorMessage); } } }
Enumerations
CameraCaptureFlag enumeration
Name | Value |
---|---|
CameraDialog.CameraCaptureFlagNone | 0 |
CameraDialog.CameraCaptureFlagCameraRoll | 1 |
CameraCaptureMode enumeration
Enum describing the potential capture modes for the camera. Informs the captureMode property.
Name | Value |
---|---|
CameraDialog.CameraCaptureModeStillImage | 0 |
CameraDialog.CameraCaptureModeVideo | 1 |
Property Documentation
This property by default returns the state of the camera, such as flash. If this property is set, the camera object will honor if the platform supports it and it is retained throughout the app. If this property is set to null, then it will return to the default values.
Supply a flag such as CameraRoll, in order to add the captured media to the camera roll asset.
Controls whether the camera will capture video or still images. Informed by the CameraCaptureMode enum.
If a valid file URL is supplied for image or video on appropriate mode, the captured media will save to this location. Make sure the path is a valid file URL before supplying the location.
On Android, you can only provide the app sandbox location.
A CameraDialogError object that provides details of the last error encountered, such as errorCode and errorMessage.
The URL of file of the previously captured image or video. This is usually set after the onAccepted signal is emitted.
If set, the supported platforms will display this title when the camera dialog opens.
Signal Documentation
Signal emitted when the camera dialog has been accepted, and the video or photo saved to the device.
Note: The corresponding handler is onAccepted
.
Signal emitted when the camera dialog has either been rejected or the camera cannot be opened. Informed by the CameraError enum.
Note: The corresponding handler is onRejected
.
Method Documentation
On iOS and Android, opens the device's default camera app to capture an image or video. On Windows, macOS and Linux, opens a custom camera control to capture an image or video.
Be aware that currently, it is not possible to record a video on Windows using this component.