Get CameraInfo

Returns a promise that resolves to an object containing information about the camera state. The object will always contain the current FlashMode, CaptureMode and CameraFacing.

This promise does not resolve until the camera is fully loaded. When the camera is loaded this promise resolves immediatley.

<CameraView ux:Name="Camera" />
<JavaScript>
    Camera.getCameraInfo()
        .then(function(info) {
            console.log(info[Camera.INFO_FLASH_MODE]);
            console.log(info[Camera.INFO_CAPTURE_MODE]);
            console.log(info[Camera.INFO_CAMERA_FACING]);
            console.log(info[Camera.INFO_SUPPORTED_FLASH_MODES].join());
        })
        .catch(function(error) { });
</JavaScript>

On Android the user should set the output resolution for photos, while on iOS you cannot set a specific resolution. In this abstraction we try to pick a sensible resolution based on the max width and height of OpenGL textures and the aspect of the camera preview. However you might want to configure this yourself. Due to this platform difference getCameraInfo will return additional information on Android, an array of available photo resolutions:

<CameraView ux:Name="Camera" />
<JavaScript>
    Camera.getCameraInfo()
        .then(function(info) {
            // check if INFO_PHOTO_RESOLUTIONS exists. It will not on iOS
            if (Camera.INFO_PHOTO_RESOLUTIONS in info) {
                info[Camera.INFO_PHOTO_RESOLUTIONS].forEach(function(e) {
                    console.log(e.width + "x" + e.height);
                });
            }
        })
        .catch(function(error) { });
</JavaScript>

Location

Namespace
Fuse.Controls
Package
Fuse.Controls.CameraView 2.9.1