new CameraManager()

Description

This class is used to manage the camera and the video stream.

Methods


<async> startVideo( [ deviceId [, facingMode ] ] ) → {Promise.<{status: boolean, error: string}>}

Description

Starts the video stream and returns a promise with the result.

Parameters
Name Type Attributes Default Description
deviceId string <optional>

The id of the media device to use, if null the default device will be used using the constraints { width: { min: 320, ideal: 640 }, height: { min: 240, ideal: 480 } }.

facingMode ConstrainDOMString <optional>

The facing mode of the camera, if null the browser default facing mode will be used. Possible facing mode values are "user" and "environment". Some examples values: { "exact": "environment" }, { "ideal": "user"}

Returns
  • A promise with the result of the operation.

<async> getImage() → {Promise.<string>}

Description

Returns a promise with the image data from the camera.

Returns
  • A promise with the base64 image data.
Throws

No media stream. Call startVideo to initialize the camera.


stopVideo() → {void}

Description

Stops the video stream if it was created by the SDK.

Returns