Skip To Content

CameraDialog QML Type

(BETA) Allows use of native device camera apps. More...

Import Statement: import ArcGIS.AppFramework.Multimedia 1.0

Properties

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.

Be aware that there is no way to override the directory where the file will be saved; it will be saved to the system default location for that filetype. The orientation of the photo or video captured is based on system defaults.

The following code sample demonstrates the usage of CameraDialog, by providing a button to open the camera to capture a still image.

Item {
        Button {
                text: "Open Camera"
                onClicked: {
                        cameraDialog.open()
                }
        }

        CameraDialog {
                id: cameraDialog
                captureMode: CameraDialog.CameraCaptureModeStillImage

                onAccepted: {
                        console.log(fileUrl)
                }
        }
}

Enumerations

CameraCaptureMode enumeration

Enum describing the potential capture modes for the camera. Informs the captureMode property.

NameValue
CameraDialog.CameraCaptureModeStillImage0
CameraDialog.CameraCaptureModeVideo1

CameraError enumeration

Enum describing the potential error states for when the camera dialog fails to open the camera. Informs the rejected signal.

NameValue
CameraDialog.CameraErrorNo0
CameraDialog.CameraErrorCameraPermissionNotGranted1
CameraDialog.CameraErrorMicrophonePermissionNotGranted2
CameraDialog.CameraErrorStoragePermissionNotGranted3
CameraDialog.CameraErrorUnavailable4

Property Documentation

captureMode : int

Controls whether the camera will capture video or still images. Informed by the CameraCaptureMode enum.


Signal Documentation

accepted( url fileUrl)

Signal emitted when the camera dialog has been accepted, and the video or photo saved to the device.


rejected( int error)

Signal emitted when the camera dialog has either been rejected or the camera cannot be opened. Informed by the CameraError enum.


Method Documentation

object open()

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.