Device.openCamera
Functional API
openCameraYou can use the same feature with it as well.
Feature description
Returns the image captured by running the camera.
If you don't have camera permission OpenCameraPermissionErroroccurs. Device.openCamera.getPermission() / Device.openCamera.openPermissionDialog()you can check/request permission with
Type
Device.openCamera(options?: OpenCameraOptions): Promise<ImageResponse>;Params
type OpenCameraOptions = {
/** Whether to return the image as Base64. Default is false. */
base64?: boolean;
/** Maximum image width (px). Default is 1024. */
maxWidth?: number;
};Response
type ImageResponse = {
id: string;
dataUri: string;
};Error
The error is thrown as a class — error instanceof OpenCameraPermissionErroridentify it with. The class can @apps-in-toss/web-frameworkbe imported from
Error class
Description
OpenCameraPermissionError
This is when camera permission is denied. Device.openCamera.openPermissionDialog()You can request again with
Example code
Was this helpful?