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.

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

NameValue
CameraDialog.CameraCaptureFlagNone0
CameraDialog.CameraCaptureFlagCameraRoll1

CameraCaptureMode enumeration

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

NameValue
CameraDialog.CameraCaptureModeStillImage0
CameraDialog.CameraCaptureModeVideo1

Property Documentation

cameraInfo : object

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.


captureFlags : int

Supply a flag such as CameraRoll, in order to add the captured media to the camera roll asset.


captureMode : int

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


captureToLocation : url

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.


error : object

A CameraDialogError object that provides details of the last error encountered, such as errorCode and errorMessage.


fileUrl : url

The URL of file of the previously captured image or video. This is usually set after the onAccepted signal is emitted.


title : string

If set, the supported platforms will display this title when the camera dialog opens.


Signal Documentation

accepted()

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

Note: The corresponding handler is onAccepted.


rejected()

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

object close()


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.


Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.