diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md index 6a51a41b6fba50c1c4f7a061d313482e1df57ad9..7229bf0f4c6b812c6ec52d26c0d6f289858725e9 100644 --- a/en/application-dev/reference/apis/js-apis-camera.md +++ b/en/application-dev/reference/apis/js-apis-camera.md @@ -1,6 +1,6 @@ -# Camera +# Camera Management -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -11,25 +11,22 @@ import camera from '@ohos.multimedia.camera'; ## Required Permissions -``` ohos.permission.CAMERA -``` -## getCameraManager(context: Context, callback: AsyncCallback): void; -**System Capabilities:** +## camera.getCameraManager -SystemCapability.Multimedia.Camera.Core +getCameraManager(context: Context, callback: AsyncCallback): void -**Description** +Obtains a **CameraManager** instance. This API uses an asynchronous callback to return the result. -Gets a **CameraManager** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|-------------------------------|-----------|-----------------------------------------------------| -| context | Context | Yes | Application context | -| callback | AsyncCallback | Yes | Callback used to return the CameraManager instance | +| Name | Type | Mandatory| Description | +| -------- | ----------------------------------------------- | ---- | ---------------------------------- | +| context | Context | Yes | Application context. | +| callback | AsyncCallback<[CameraManager](#cameramanager)\> | Yes | Callback used to return the **CameraManager** instance.| **Example** @@ -43,116 +40,105 @@ camera.getCameraManager(context, (err, cameraManager) => { }); ``` -## getCameraManager(context: Context): Promise; - -**System Capabilities:** +## camera.getCameraManager -SystemCapability.Multimedia.Camera.Core +getCameraManager(context: Context): Promise -**Description** +Obtains a **CameraManager** instance. This API uses a promise to return the result. -Gets a **CameraManager** instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|----------------------------| -| context | Context | Yes | Application context | +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | ------------ | +| context | Context | Yes | Application context.| -**Return values** +**Return value** -| Type | Description | -|-------------------------|--------------------------------------------------------| -| Promise | Promise used to return the **CameraManager** instance | +| Type | Description | +| ----------------------------------------- | ----------------------------------------- | +| Promise<[CameraManager](#cameramanager)\> | Promise used to return the **CameraManager** instance.| **Example** ``` -camera.getCameraManager(context).then((cameraManger) => { +camera.getCameraManager(context).then((cameraManager) => { console.log('Promise returned with the CameraManager instance.'); }) ``` -## CameraStatus +## CameraStatus -Enumerates camera status types. +Enumerates the camera statuses. -**System Capabilities:** +**System capability**: SystemCapability.Multimedia.Camera.Core -SystemCapability.Multimedia.Camera.Core +| Name | Default Value| Description | +| ------------------------- | ------ | ------------ | +| CAMERA_STATUS_APPEAR | 0 | The camera exists. | +| CAMERA_STATUS_DISAPPEAR | 1 | The camera does not exist.| +| CAMERA_STATUS_AVAILABLE | 2 | The camera is ready. | +| CAMERA_STATUS_UNAVAILABLE | 3 | The camera is not ready.| -| Name | Default Value | Description | -|---------------------------|---------------|--------------------| -| CAMERA_STATUS_APPEAR | 0 | Camera appear | -| CAMERA_STATUS_DISAPPEAR | 1 | Camera disappear | -| CAMERA_STATUS_AVAILABLE | 2 | Camera available | -| CAMERA_STATUS_UNAVAILABLE | 3 | Camera unavailable | - -## CameraPosition +## CameraPosition Enumerates the camera positions. -**System Capabilities:** - -SystemCapability.Multimedia.Camera.Core +**System capability**: SystemCapability.Multimedia.Camera.Core -| Name | Default value | Description | -|-----------------------------|---------------|-----------------------| -| CAMERA_POSITION_UNSPECIFIED | 0 | Unspecified position | -| CAMERA_POSITION_BACK | 1 | Rear camera | -| CAMERA_POSITION_FRONT | 2 | Front camera | +| Name | Default Value| Description | +| --------------------------- | ------ | ---------------- | +| CAMERA_POSITION_UNSPECIFIED | 0 | Unspecified position.| +| CAMERA_POSITION_BACK | 1 | Rear camera. | +| CAMERA_POSITION_FRONT | 2 | Front camera. | -## CameraType +## CameraType Enumerates the camera types. -**System Capabilities:** +**System capability**: SystemCapability.Multimedia.Camera.Core -SystemCapability.Multimedia.Camera.Core +| Name | Default Value| Description | +| ----------------------- | ------ | ---------------- | +| CAMERA_TYPE_UNSPECIFIED | 0 | Unspecified camera type.| +| CAMERA_TYPE_WIDE_ANGLE | 1 | Wide camera. | +| CAMERA_TYPE_ULTRA_WIDE | 2 | Ultra wide camera. | +| CAMERA_TYPE_TELEPHOTO | 3 | Telephoto camera. | +| CAMERA_TYPE_TRUE_DEPTH | 4 | True depth camera. | -| Name | Default value | Description | -|-------------------------|---------------|-------------------------| -| CAMERA_TYPE_UNSPECIFIED | 0 | Unspecified camera type | -| CAMERA_TYPE_WIDE_ANGLE | 1 | Wide camera | -| CAMERA_TYPE_ULTRA_WIDE | 2 | Ultra wide camera | -| CAMERA_TYPE_TELEPHOTO | 3 | Telephoto camera | -| CAMERA_TYPE_TRUE_DEPTH | 4 | True depth camera | +## ConnectionType -## ConnectionType +Enumerates the camera connection types. -Enumerates camera connection types. +**System capability**: SystemCapability.Multimedia.Camera.Core -**System Capabilities:** +| Name | Default Value| Description | +| ---------------------------- | ------ | ------------- | +| CAMERA_CONNECTION_BUILT_IN | 0 | Built-in camera. | +| CAMERA_CONNECTION_USB_PLUGIN | 1 | Camera connected using USB.| +| CAMERA_CONNECTION_REMOTE | 2 | Remote camera. | -SystemCapability.Multimedia.Camera.Core -| Name | Default value | Description | -|------------------------------|---------------|----------------------------| -| CAMERA_CONNECTION_BUILT_IN | 0 | Built-in camera | -| CAMERA_CONNECTION_USB_PLUGIN | 1 | Camera connected using USB | -| CAMERA_CONNECTION_REMOTE | 2 | Remote camera | +## CameraManager -## CameraManager +Implements camera management. Before calling any API in **CameraManager**, you must use **getCameraManager** to obtain a **CameraManager** instance. -Implements camera management, including getting supported cameras and creating **CameraInput** instances. +### getCameras -### getCameras(callback: AsyncCallback\>): void; +getCameras(callback: AsyncCallback\>): void -**System Capabilities:** +Obtains all cameras supported by the device. This API uses an asynchronous callback to return the array of supported cameras. -SystemCapability.Multimedia.Camera.Core - -**Description** - -Gets all cameras supported by the device. This method uses an asynchronous callback to return the array of supported cameras. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|--------------------------------|-----------|---------------------------------------------------------| -| callback | AsyncCallback\> | Yes | Callback used to return the array of supported cameras. | +| Name | Type | Mandatory| Description | +| -------- | ----------------------------------------- | ---- | ------------------------------------ | +| callback | AsyncCallback\> | Yes | Callback used to return the array of supported cameras.| **Example** @@ -166,21 +152,19 @@ cameraManager.getCameras((err, cameras) => { }) ``` -### getCameras(): Promise\>; +### getCameras -**System Capabilities:** +getCameras(): Promise\> -SystemCapability.Multimedia.Camera.Core +Obtains all cameras supported by the device. This API uses a promise to return the array of supported cameras. -**Description** +**System capability**: SystemCapability.Multimedia.Camera.Core -Gets all cameras supported by the device. This method uses a promise to return the array of supported cameras. +**Return value** -**Return values** - -| Type | Description | -|------------------------|--------------------------------------------------------| -| Promise\> | Promise used to return an array of supported cameras | +| Type | Description | +| ----------------------------------- | ----------------------------- | +| Promise\> | Promise used to return the array of supported cameras.| **Example** @@ -191,22 +175,20 @@ cameraManager.getCameras().then((cameraArray) => { }) ``` -### createCameraInput(cameraId: string, callback: AsyncCallback): void; - -**System Capabilities:** +### createCameraInput -SystemCapability.Multimedia.Camera.Core +createCameraInput(cameraId: string, callback: AsyncCallback): void -**Description** +Creates a **CameraInput** instance with the specified camera ID. This API uses an asynchronous callback to return the instance. -Creates a **CameraInput** instance with the specified camera ID. This method uses an asynchronous callback to return the instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Default value | Mandatory | Description | -|----------|------------------------------|-----------|--------------------------------------------------| -| cameraId | string | Yes | Camera ID used to create the instance | -| callback | AsyncCallback | Yes | Callback used to return the CameraInput instance | +| Name | Default Value | Mandatory| Description | +| -------- | ------------------------------------------- | ---- | ----------------------------------- | +| cameraId | string | Yes | Camera ID used to create the instance. | +| callback | AsyncCallback<[CameraInput](#camerainput)\> | Yes | Callback used to return the **CameraInput** instance.| **Example** @@ -220,27 +202,25 @@ cameraManager.createCameraInput(cameraId, (err, cameraInput) => { }) ``` -### createCameraInput(cameraId: string): Promise; +### createCameraInput -**System Capabilities:** +createCameraInput(cameraId: string): Promise -SystemCapability.Multimedia.Camera.Core +Creates a **CameraInput** instance with the specified camera ID. This API uses a promise to return the instance. -**Description** - -Creates a **CameraInput** instance with the specified camera ID. This method uses a promise to return the instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Default value | Mandatory | Description | -|----------|-----------------------------|-----------|------------------------------------------| -| cameraId | string | Yes | Camera ID used to create the instance | +| Name | Default Value| Mandatory| Description | +| -------- | ------ | ---- | ------------ | +| cameraId | string | Yes | Camera ID used to create the instance.| -**Return values** +**Return value** -| Type | Description | -|-------------------------|-------------------------------------------------| -| Promise | Promise used to return the CameraInput instance | +| Type | Description | +| ------------------------------------- | ---------------------------------------- | +| Promise<[CameraInput](#camerainput)\> | Promise used to return the **CameraInput** instance.| **Example** @@ -250,23 +230,21 @@ cameraManager.createCameraInput(cameraId).then((cameraInput) => { }) ``` -### createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void; - -**System Capabilities:** +### createCameraInput -SystemCapability.Multimedia.Camera.Core +createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void -**Description** +Creates a **CameraInput** instance with the specified camera position and camera type. This API uses an asynchronous callback to return the instance. -Creates a **CameraInput** instance with the specified camera position and camera type. This method uses an asynchronous callback to return the instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|-----------------------------|-----------|---------------------------------------------------| -| position | CameraPosition | Yes | Camera position | -| type | CameraType | Yes | Camera type | -| callback | AsyncCallback | Yes | Callback used to return the CameraInput instance | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------- | ---- | ----------------------------------- | +| position | [CameraPosition](#cameraposition) | Yes | Camera position. | +| type | [CameraType](#cameratype) | Yes | Camera type. | +| callback | AsyncCallback<[CameraInput](#camerainput)\> | Yes | Callback used to return the **CameraInput** instance.| **Example** @@ -280,28 +258,26 @@ cameraManager.createCameraInput(cameraPosition, cameraType, (err, cameraInput) = }) ``` -### createCameraInput(position: CameraPosition, type: CameraType): Promise; - -**System Capabilities:** +### createCameraInput -SystemCapability.Multimedia.Camera.Core +createCameraInput(position: CameraPosition, type: CameraType): Promise -**Description** +Creates a **CameraInput** instance with the specified camera position and camera type. This API uses a promise to return the instance. -Creates a **CameraInput** instance with the specified camera position and camera type. This method uses a promise to return the instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------------|-----------|----------------------------------------| -| position | CameraPosition | Yes | Camera position | -| type | CameraType | Yes | Camera type | +| Name | Type | Mandatory| Description | +| -------- | --------------------------------- | ---- | ---------- | +| position | [CameraPosition](#cameraposition) | Yes | Camera position.| +| type | [CameraType](#cameratype) | Yes | Camera type.| -**Return values** +**Return value** -| Type | Description | -|-------------------------|-------------------------------------------------| -| Promise | Promise used to return the CameraInput instance | +| Type | Description | +| ------------------------------------- | ---------------------------------------- | +| Promise<[CameraInput](#camerainput)\> | Promise used to return the **CameraInput** instance.| **Example** @@ -311,22 +287,20 @@ cameraManager.createCameraInput(cameraPosition, cameraType).then((cameraInput) = }) ``` -### on(type: 'cameraStatus', callback: Callback): void; +### on('cameraStatus') -**System Capabilities:** +on(type: 'cameraStatus', callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Listens for camera status changes. This API uses a callback to return the camera status changes. -**Description** - -Listens for camera status changes. This method uses a callback to get camera status changes. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :--------------------- | :-------- | :--------------------------------------------------- | -| type | string | Yes | Camera status event. | -| callback | Callback | Yes | Callback used to get the camera status change. | +| Name | Type | Mandatory| Description | +| :------- | :---------------------------------------------------- | :--- | :--------------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **cameraStatus**, indicating the camera status change event.| +| callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | Yes | Callback used to return the camera status change. | **Example** @@ -337,22 +311,20 @@ cameraManager.on('cameraStatus', (cameraStatusInfo) => { }) ``` -## Camera - -when we call *cameraManager.getCameras()* API, then it will return the **Camera** class which will have all camera-related metadata such as *cameraId, cameraPosition, cameraType & connectionType*. +## Camera -**System Capabilities:** +After **[camera.getCameraManager](#cameragetcameramanager)** is called, a camera instance is returned, including camera-related metadata such as **cameraId**, **cameraPosition**, **cameraType**, and **connectionType**. -SystemCapability.Multimedia.Camera.Core +**System capability**: SystemCapability.Multimedia.Camera.Core -**Fields** +| Name | Type | Read only| Description | +| -------------- | --------------------------------- | ---- | -------------- | +| cameraId | string | Yes | Camera ID. | +| cameraPosition | [CameraPosition](#cameraposition) | Yes | Camera position. | +| cameraType | [CameraType](#cameratype) | Yes | Camera type. | +| connectionType | [ConnectionType](#connectiontype) | Yes | Camera connection type.| -| Name | Type | Access | Description | -|----------------|----------------|----------|------------------------| -| cameraId | string | readonly | Camera ID | -| cameraPosition | cameraPosition | readonly | Camera position | -| cameraType | cameraType | readonly | Camera type | -| connectionType | connectionType | readonly | Camera connection type | +**Example** ``` async function getCameraInfo() { @@ -367,41 +339,37 @@ async function getCameraInfo() { ``` -## CameraStatusInfo - -This interface is a CameraManager callback API return. **CameraStatusInfo** will have *Camera* class & *CameraStatus* predefine constants.From *Camera* class, we can have all camera-related metadata & from *CameraStatus* constants, we will have information such as *APPEAR, DISAPPEAR, AVAILABLE & UNAVAILABLE*. - -**System Capabilities:** - -SystemCapability.Multimedia.Camera.Core +## CameraStatusInfo -**Fields** +Describes the camera status information. -| Name | Type | Description | -|----------------|----------------|------------------| -| camera | Camera | Camera object | -| status | CameraStatus | Camera status | +**System capability**: SystemCapability.Multimedia.Camera.Core +| Name | Type | Description | +| ------ | ----------------------------- | ---------- | +| camera | [Camera](#camera) | Camera object.| +| status | [CameraStatus](#camerastatus) | Camera status.| -## CameraInput -Implements a **CameraInput** instance. +## CameraInput -### getCameraId(callback: AsyncCallback\): void; +Implements a **CameraInput** instance. Before calling any API in **CameraInput**, you must create a **CameraInput** instance. -**System Capabilities:** +### getCameraId -SystemCapability.Multimedia.Camera.Core +getCameraId(callback: AsyncCallback\): void -**Description** +Obtains the camera ID based on which this **CameraInput** instance is created. This API uses an asynchronous callback to return the camera ID. -Gets the camera ID based on which this **CameraInput** instance is created. This method uses an asynchronous callback to return the camera ID. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|------------------------|-----------|---------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the camera ID | +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------------------------- | +| callback | AsyncCallback | Yes | Callback used to return the camera ID.| + +**Example** ``` cameraInput.getCameraId((err, cameraId) => { @@ -413,21 +381,19 @@ cameraInput.getCameraId((err, cameraId) => { }) ``` -### getCameraId(): Promise; - -**System Capabilities:** +### getCameraId -SystemCapability.Multimedia.Camera.Core +getCameraId(): Promise -**Description** +Obtains the camera ID based on which this **CameraInput** instance is created. This API uses a promise to return the camera ID. -Gets the camera ID based on which this **CameraInput** instance is created. This method uses a promise to return the camera ID. +**System capability**: SystemCapability.Multimedia.Camera.Core -**Return values** +**Return value** -| Type | Description | -|------------------------|--------------------------------------| -| Promise | Promise used to return the camera ID | +| Type | Description | +| ---------------- | ----------------------------- | +| Promise | Promise used to return the camera ID.| **Example** @@ -437,21 +403,20 @@ cameraInput.getCameraId().then((cameraId) => { }) ``` -### hasFlash(callback: AsyncCallback): void; -**System Capabilities:** +### hasFlash -SystemCapability.Multimedia.Camera.Core +hasFlash(callback: AsyncCallback): void -**Description** +Checks whether the device has flash light. This API uses an asynchronous callback to return the result. -Checks whether the device has flash light. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|-------------------------|-----------|----------------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the flash light support status | +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | -------------------------------------- | +| callback | AsyncCallback | Yes | Callback used to return the flash light support status. The value **true** means that the device has flash light.| **Example** @@ -465,21 +430,19 @@ cameraInput.hasFlash((err, status) => { }) ``` -### hasFlash(): Promise; +### hasFlash -**System Capabilities:** +hasFlash(): Promise -SystemCapability.Multimedia.Camera.Core +Checks whether the device has flash light. This API uses a promise to return the result. -**Description** +**System capability**: SystemCapability.Multimedia.Camera.Core -Checks whether the device has flash light. This method uses a promise to return the result. +**Return value** -**Return values** - -| Type | Description | -|-----------------------|--------------------------------------------------------| -| Promise | Promise used to return the flash light support status | +| Type | Description | +| ----------------- | ------------------------------------------------------- | +| Promise | Promise used to return the flash light support status. The value **true** means that the device has flash light.| **Example** @@ -489,22 +452,20 @@ cameraInput.hasFlash().then((status) => { }) ``` -### isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void; - -**System Capabilities:** +### isFlashModeSupported -SystemCapability.Multimedia.Camera.Core +isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void -**Description** +Checks whether a specified flash mode is supported. This API uses an asynchronous callback to return the result. -Checks whether a specified flash mode is supported. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|------------------------|-----------|----------------------------------------------------| -| flashMode | FlashMode | Yes | Flash mode | -| callback | AsyncCallback | Yes | Callback used to return the device flash support status | +| Name | Type | Mandatory| Description | +| --------- | ----------------------- | ---- | ---------------------------------------- | +| flashMode | [FlashMode](#flashmode) | Yes | Flash mode. | +| callback | AsyncCallback | Yes | Callback used to return the flash mode support status. The value **true** means that the specified flash mode is supported.| **Example** @@ -518,27 +479,25 @@ cameraInput.isFlashModeSupported(flashMode, (err, status) => { }) ``` -### isFlashModeSupported(flashMode: FlashMode): Promise; +### isFlashModeSupported -**System Capabilities:** +isFlashModeSupported(flashMode: FlashMode): Promise -SystemCapability.Multimedia.Camera.Core +Checks whether a specified flash mode is supported. This API uses a promise to return the result. -**Description** - -Checks whether a specified flash mode is supported. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|------------------------|-----------|----------------------------------------------------| -| flashMode | FlashMode | Yes | Flash mode | +| Name | Type | Mandatory| Description | +| --------- | ----------------------- | ---- | ---------------- | +| flashMode | [FlashMode](#flashmode) | Yes | Flash mode.| -**Return values** +**Return value** -| Type | Description | -|-----------------------|---------------------------------------------------| -| Promise | Promise used to return flash mode support status. | +| Type | Description | +| ----------------- | ------------------------------------------------------------ | +| Promise | Promise used to return the flash mode support status. The value **true** means that the specified flash mode is supported.| **Example** @@ -548,24 +507,25 @@ cameraInput.isFlashModeSupported(flashMode).then((status) => { }) ``` -### setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void; +### setFlashMode -**System Capabilities:** +setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Sets the flash mode. This API uses an asynchronous callback to return the result. -**Description** +Before setting the parameters, do the following checks: -Sets flash mode. This method uses an asynchronous callback to return the result. +1. Use [hasFlash](#hasflash) to check whether the device has flash light. +2. Use [isFlashModeSupported](#isflashmodesupported) to check whether the device supports a specified flash mode. -Note: Before setting the flash mode, check the support for the flash light (hasFlash method) and flash mode support (isFlashModeSupported method); +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|------------------------|-----------|----------------------------------------------------| -| flashMode | FlashMode | Yes | Flash mode | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| --------- | ----------------------- | ---- | ------------------------ | +| flashMode | [FlashMode](#flashmode) | Yes | Flash mode. | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -579,29 +539,30 @@ cameraInput.setFlashMode(flashMode, (err) => { }) ``` -### setFlashMode(flashMode: FlashMode): Promise; +### setFlashMode -**System Capabilities:** +setFlashMode(flashMode: FlashMode): Promise -SystemCapability.Multimedia.Camera.Core +Sets the flash mode. This API uses a promise to return the result. -**Description** +Before setting the parameters, do the following checks: -Sets flash mode. This method uses a promise to return the result. +1. Use [hasFlash](#hasflash) to check whether the device has flash light. +2. Use [isFlashModeSupported](#isflashmodesupported) to check whether the device supports a specified flash mode. -Note: Before setting the flash mode, check the support for the flash light (hasFlash method) and flash mode support (isFlashModeSupported method); +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|------------------------|-----------|----------------------------------------------------| -| flashMode | FlashMode | Yes | Flash mode | +| Name | Type | Mandatory| Description | +| --------- | ----------------------- | ---- | ---------------- | +| flashMode | [FlashMode](#flashmode) | Yes | Flash mode.| -**Return values** +**Return value** -| Type | Description | -|-----------------------|-----------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -611,21 +572,19 @@ cameraInput.setFlashMode(flashMode).then(() => { }) ``` -### getFlashMode(callback: AsyncCallback): void; +### getFlashMode -**System Capabilities:** +getFlashMode(callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Obtains the current flash mode. This API uses an asynchronous callback to return the result. -**Description** - -Gets current flash mode. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|---------------------------|-----------|------------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the current flash mode | +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------------------------------------- | +| callback | AsyncCallback<[FlashMode](#flashmode)\> | Yes | Callback used to return the current flash mode.| **Example** @@ -639,21 +598,19 @@ cameraInput.getFlashMode((err, flashMode) => { }) ``` -### getFlashMode(): Promise; - -**System Capabilities:** +### getFlashMode -SystemCapability.Multimedia.Camera.Core +getFlashMode(): Promise -**Description** +Obtains the current flash mode. This API uses a promise to return the result. -Gets current flash mode. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core -**Return values** +**Return value** -| Type | Description | -|-----------------------|---------------------------------------------------| -| Promise | Promise used to return the flash mode | +| Type | Description | +| --------------------------------- | --------------------------------------- | +| Promise<[FlashMode](#flashmode)\> | Promise used to return the current flash mode.| **Example** @@ -663,22 +620,20 @@ cameraInput.getFlashMode().then((flashMode) => { }) ``` -### isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void; +### isFocusModeSupported -**System Capabilities:** +isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Checks whether a specified focus mode is supported. This API uses an asynchronous callback to return the result. -**Description** - -Checks whether a specified focus mode is supported. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|------------------------|-----------|----------------------------------------------------| -| afMode | FocusMode | Yes | Focus mode | -| callback | AsyncCallback | Yes | Callback used to return the device focus support status | +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | -------------------------------------- | +| afMode | [FocusMode](#focusmode) | Yes | Focus mode. | +| callback | AsyncCallback | Yes | Callback used to return the focus mode support status. The value **true** means that the specified focus mode is supported.| **Example** @@ -692,27 +647,25 @@ cameraInput.isFocusModeSupported(afMode, (err, status) => { }) ``` -### isFocusModeSupported(afMode: FocusMode): Promise; - -**System Capabilities:** +### isFocusModeSupported -SystemCapability.Multimedia.Camera.Core +isFocusModeSupported(afMode: FocusMode): Promise -**Description** +Checks whether a specified focus mode is supported. This API uses a promise to return the result. -Checks whether a specified focus mode is supported. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|----------------------------------------|-----------|-------------| -| afMode | FocusMode | Yes | Focus mode | +| Name | Type | Mandatory| Description | +| ------ | ----------------------- | ---- | ---------------- | +| afMode | [FocusMode](#focusmode) | Yes | Focus mode.| -**Return values** +**Return value** -| Type | Description | -|-----------------------|---------------------------------------------------| -| Promise | Promise used to return the focus mode support status. | +| Type | Description | +| ----------------- | ----------------------------------------------------------- | +| Promise | Promise used to return the flash mode support status. The value **true** means that the specified focus mode is supported.| **Example** @@ -722,24 +675,22 @@ cameraInput.isFocusModeSupported(afMode).then((status) => { }) ``` -### setFocusMode(afMode: FocusMode, callback: AsyncCallback): void; - -**System Capabilities:** +### setFocusMode -SystemCapability.Multimedia.Camera.Core +setFocusMode(afMode: FocusMode, callback: AsyncCallback): void -**Description** +Sets the focus mode. This API uses an asynchronous callback to return the result. -Sets focus mode. This method uses an asynchronous callback to return the result. +Before setting the focus mode, use **[isFocusModeSupported](#isfocusmodesupported)** to check whether the focus mode is supported. -Note: Before setting the focus mode, check focus mode support (isFocusModeSupported method); +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|------------------------|-----------|------------------------------------| -| afMode | FocusMode | Yes | Focus mode | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | ------------------------ | +| afMode | [FocusMode](#focusmode) | Yes | Focus mode. | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -753,29 +704,27 @@ cameraInput.setFocusMode(afMode, (err) => { }) ``` -### setFocusMode(afMode: FocusMode): Promise; +### setFocusMode -**System Capabilities:** +setFocusMode(afMode: FocusMode): Promise -SystemCapability.Multimedia.Camera.Core +Sets the focus mode. This API uses a promise to return the result. -**Description** +Before setting the focus mode, use **[isFocusModeSupported](#isfocusmodesupported)** to check whether the focus mode is supported. -Sets focus mode. This method uses a promise to return the result. - -Note: Before setting the focus mode, check focus mode support (isFocusModeSupported method); +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|-----------------------------------------|-----------|-------------| -| afMode | FocusMode | Yes | Focus mode | +| Name | Type | Mandatory| Description | +| ------ | ----------------------- | ---- | ---------------- | +| afMode | [FocusMode](#focusmode) | Yes | Focus mode.| -**Return values** +**Return value** -| Type | Description | -|-----------------------|-----------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -785,21 +734,19 @@ cameraInput.setFocusMode(afMode).then(() => { }) ``` -### getFocusMode(callback: AsyncCallback): void; +### getFocusMode -**System Capabilities:** +getFocusMode(callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Obtains the current focus mode. This API uses an asynchronous callback to return the result. -**Description** - -Gets the current focus mode. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|---------------------------|-----------|------------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the current focus mode | +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | -------------------------------------- | +| callback | AsyncCallback<[FocusMode](#focusmode)\> | Yes | Callback used to return the current focus mode.| **Example** @@ -813,21 +760,19 @@ cameraInput.getFocusMode((err, afMode) => { }) ``` -### getFocusMode(): Promise; - -**System Capabilities:** +### getFocusMode -SystemCapability.Multimedia.Camera.Core +getFocusMode(): Promise -**Description** +Obtains the current focus mode. This API uses a promise to return the result. -Gets the current focus mode. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core -**Return values** +**Return value** -| Type | Description | -|-----------------------|---------------------------------------------------| -| Promise | Promise used to return the focus mode | +| Type | Description | +| ------------------- | ------------------------------------- | +| Promise | Promise used to return the current focus mode.| **Example** @@ -837,21 +782,19 @@ cameraInput.getFocusMode().then((afMode) => { }) ``` -### getZoomRatioRange\(callback: AsyncCallback\>\): void; +### getZoomRatioRange -**System Capabilities:** +getZoomRatioRange\(callback: AsyncCallback\>\): void -SystemCapability.Multimedia.Camera.Core +Obtains the zoom ratio range. This API uses an asynchronous callback to return the result. -**Description** - -Gets the zoom ratios of all zoom values. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|--------------------------------|-----------|-------------------------------------------------| -| callback | AsyncCallback\> | Yes | Callback used to return the zoom ratio range | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------ | ---- | ------------------------ | +| callback | AsyncCallback\> | Yes | Callback used to return the zoom ratio range.| **Example** @@ -865,21 +808,19 @@ cameraInput.getZoomRatioRange((err, zoomRatioRange) => { }) ``` -### getZoomRatioRange\(\): Promise\>; - -**System Capabilities:** +### getZoomRatioRange -SystemCapability.Multimedia.Camera.Core +getZoomRatioRange\(\): Promise\> -**Description** +Obtains the zoom ratio range. This API uses a promise to return the result. -Gets the zoom ratios of all zoom values. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core -**Return values** +**Return value** -| Type | Description | -|------------------------|---------------------------------------------| -| Promise\> | Promise used to return the zoom ratio range | +| Type | Description | +| ------------------------ | ------------------------------------------- | +| Promise\> | Promise used to return the zoom ratio range.| **Example** @@ -889,22 +830,20 @@ cameraInput.getZoomRatioRange().then((zoomRatioRange) => { }) ``` -### setZoomRatio(zoomRatio: number, callback: AsyncCallback): void; - -**System Capabilities:** +### setZoomRatio -SystemCapability.Multimedia.Camera.Core +setZoomRatio(zoomRatio: number, callback: AsyncCallback): void -**Description** +Sets a zoom ratio. This API uses an asynchronous callback to return the result. -Sets a zoom ratio. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|------------------------|-----------|------------------------------------| -| zoomRatio | number | Yes | Zoom ratio | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| --------- | -------------------- | ---- | ------------------------ | +| zoomRatio | number | Yes | Zoom ratio to set. | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -918,27 +857,25 @@ cameraInput.setZoomRatio(zoomRatio, (err) => { }) ``` -### setZoomRatio(zoomRatio: number): Promise; - -**System Capabilities:** +### setZoomRatio -SystemCapability.Multimedia.Camera.Core +setZoomRatio(zoomRatio: number): Promise -**Description** +Sets a zoom ratio. This API uses a promise to return the result. -Sets a zoom ratio. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|----------|-----------|-------------| -| zoomRatio | number | Yes | zoom ratio | +| Name | Type | Mandatory| Description | +| --------- | ------ | ---- | ------------ | +| zoomRatio | number | Yes | Zoom ratio to set.| -**Return values** +**Return value** -| Type | Description | -|-----------------------|-----------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -948,21 +885,19 @@ cameraInput.setZoomRatio(zoomRatio).then(() => { }) ``` -### getZoomRatio(callback: AsyncCallback): void; - -**System Capabilities:** +### getZoomRatio -SystemCapability.Multimedia.Camera.Core +getZoomRatio(callback: AsyncCallback): void -**Description** +Obtains the current zoom ratio. This API uses an asynchronous callback to return the result. -Gets current zoom ratio value. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-----------|---------------------------|-----------|------------------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the current zoom ratio value | +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the current zoom ratio.| **Example** @@ -976,21 +911,19 @@ cameraInput.getZoomRatio((err, zoomRatio) => { }) ``` -### getZoomRatio(): Promise; +### getZoomRatio -**System Capabilities:** +getZoomRatio(): Promise -SystemCapability.Multimedia.Camera.Core +Obtains the current zoom ratio. This API uses a promise to return the result. -**Description** +**System capability**: SystemCapability.Multimedia.Camera.Core -Gets current zoom ratio value. This method uses a promise to return the result. +**Return value** -**Return values** - -| Type | Description | -|-----------------------|---------------------------------------------------| -| Promise | Promise used to return the zoom ratio vaule | +| Type | Description | +| ---------------- | --------------------------- | +| Promise | Promise used to return the current zoom ratio.| **Example** @@ -1000,26 +933,24 @@ cameraInput.getZoomRatio().then((zoomRatio) => { }) ``` -### release\(callback: AsyncCallback\): void; - -**System Capabilities:** +### release -SystemCapability.Multimedia.Camera.Core +release\(callback: AsyncCallback\): void -**Description** +Releases this **CameraInput** instance. This API uses an asynchronous callback to return the result. -Releases this **CameraInput** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** ``` -cameraInput.release((err) => { +camera.release((err) => { if (err) { console.error('Failed to release the CameraInput instance ${err.message}'); return; @@ -1028,21 +959,19 @@ cameraInput.release((err) => { }); ``` -### release(): Promise; +### release -**System Capabilities:** +release(): Promise -SystemCapability.Multimedia.Camera.Core +Releases this **CameraInput** instance. This API uses a promise to return the result. -**Description** +**System capability**: SystemCapability.Multimedia.Camera.Core -Releases this **CameraInput** instance. This method uses a promise to return the result. +**Return value** -**Return values** - -| Type | Description | -|----------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1052,22 +981,20 @@ cameraInput.release().then(() => { }) ``` -### on(type: 'focusStateChange', callback: Callback): void; +### on('focusStateChange') -**System Capabilities:** +on(type: 'focusStateChange', callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Listens for focus state changes. This API uses a callback to return the focus state changes. -**Description** - -Listens for focus state changes. This method uses a callback to get focus state changes. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :--------------------- | :-------- | :-----------------------------------------------| -| type | string | Yes | Name of the event to listen for. | -| callback | Callback | Yes | Callback used to get the focus state change. | +| Name | Type | Mandatory| Description | +| :------- | :---------------------------------------- | :--- | :------------------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **focusStateChange**, indicating the focus state change event.| +| callback | AsyncCallback<[FocusState](#focusstate)\> | Yes | Callback used to return the focus state change. | **Example** @@ -1077,22 +1004,20 @@ cameraInput.on('focusStateChange', (focusState) => { }) ``` -### on(type: 'error', callback: Callback): void; - -**System Capabilities:** +### on('error') -SystemCapability.Multimedia.Camera.Core +on(type: 'error', callback: ErrorCallback): void -**Description** +Listens for **CameraInput** errors. This API uses a callback to return the errors. -Listens for **CameraInput** errors. This method uses a callback to get errors. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :--------------------- | :-------- | :-----------------------------------------------| -| type | string | Yes | Camera input error event. | -| callback | Callback | Yes | Callback used to get the camera input errors. | +| Name | Type | Mandatory| Description | +| :------- | :------------------------------- | :--- | :---------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the camera input error event.| +| callback | ErrorCallback | Yes | Callback used to return the capture input errors. | **Example** @@ -1102,57 +1027,64 @@ cameraInput.on('error', (cameraInputError) => { }) ``` -## FlashMode -Enumerates the flash modes. +## FlashMode -**System Capabilities:** +Enumerates the flash modes. -SystemCapability.Multimedia.Camera.Core +**System capability**: SystemCapability.Multimedia.Camera.Core -| Name | Default value | Description | -|------------------------|---------------|------------------------| -| FLASH_MODE_CLOSE | 0 | Flash mode close | -| FLASH_MODE_OPEN | 1 | Flash mode open | -| FLASH_MODE_AUTO | 2 | Flash mode auto | -| FLASH_MODE_ALWAYS_OPEN | 3 | Flash mode always open | +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| FLASH_MODE_CLOSE | 0 | The flash is off.| +| FLASH_MODE_OPEN | 1 | The flash is on.| +| FLASH_MODE_AUTO | 2 | The flash mode is auto, indicating that the flash fires automatically depending on the shooting conditions.| +| FLASH_MODE_ALWAYS_OPEN | 3 | The flash is steady on.| -## FocusMode +## FocusMode Enumerates the focus modes. -**System Capabilities:** +**System capability**: SystemCapability.Multimedia.Camera.Core + +| Name | Default Value| Description | +| -------------------------- | ------ | ------------------ | +| FOCUS_MODE_MANUAL | 0 | Manual focus. | +| FOCUS_MODE_CONTINUOUS_AUTO | 1 | Continuous auto focus.| +| FOCUS_MODE_AUTO | 2 | Auto focus. | +| FOCUS_MODE_LOCKED | 3 | Locked focus. | -SystemCapability.Multimedia.Camera.Core +## FocusState -| Name | Default value | Description | -|----------------------------|---------------|----------------------------| -| FOCUS_MODE_MANUAL | 0 | Focus mode manual | -| FOCUS_MODE_CONTINUOUS_AUTO | 1 | Focus mode continuous auto | -| FOCUS_MODE_AUTO | 2 | Focus mode auto | -| FOCUS_MODE_LOCKED | 3 | Focus mode locked | +Enumerates the focus states. -## createCaptureSession\(context: Context, callback: AsyncCallback\): void; +**System capability**: SystemCapability.Multimedia.Camera.Core -**System Capabilities:** +| Name | Default Value| Description | +| --------------------- | ------ | ------------ | +| FOCUS_STATE_SCAN | 0 | Scanning. | +| FOCUS_STATE_FOCUSED | 1 | Focused.| +| FOCUS_STATE_UNFOCUSED | 2 | Unfocused.| -SystemCapability.Multimedia.Camera.Core +## camera.createCaptureSession -**Description** +createCaptureSession\(context: Context, callback: AsyncCallback\): void -Creates a **CaptureSession** instance. This method uses an asynchronous callback to return the instance. +Creates a **CaptureSession** instance. This API uses an asynchronous callback to return the instance. + +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|--------------------------------|-----------|-----------------------------------------------------| -| context | Context | Yes | Application context | -| callback | AsyncCallback | Yes | Callback used to return the CaptureSession instance | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------- | ---- | -------------------------------------- | +| context | Context | Yes | Application context. | +| callback | AsyncCallback<[CaptureSession](#capturesession)\> | Yes | Callback used to return the **CaptureSession** instance.| **Example** ``` -captureSession.createCaptureSession((context), (err, captureSession) => { +camera.createCaptureSession((context), (err, captureSession) => { if (err) { console.error('Failed to create the CaptureSession instance. ${err.message}'); return; @@ -1161,55 +1093,51 @@ captureSession.createCaptureSession((context), (err, captureSession) => { }); ``` -## createCaptureSession(context: Context\): Promise; - -**System Capabilities:** +## camera.createCaptureSession -SystemCapability.Multimedia.Camera.Core +createCaptureSession(context: Context\): Promise; -**Description** +Creates a **CaptureSession** instance. This API uses a promise to return the instance. -Creates a **CaptureSession** instance. This method uses a promise to return the instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|-------------------------------|-----------|-----------------------------------------------------| -| context | Context | Yes | Application context | +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | ------------ | +| context | Context | Yes | Application context.| -**Return values** +**Return value** -| Type | Description | -|---------------------------|---------------------------------------------------| -| Promise | Promise used to return the CaptureSession instance. | +| Type | Description | +| ------------------------------------------- | ----------------------------------------- | +| Promise<[CaptureSession](#capturesession)\> | Promise used to return the **CaptureSession** instance.| **Example** ``` -captureSession.createCaptureSession(context).then((captureSession) => { +camera.createCaptureSession(context).then((captureSession) => { console.log('Promise returned with the CaptureSession instance'); }) ``` -## CaptureSession +## CaptureSession Implements session capture. -### beginConfig\(callback: AsyncCallback\): void; +### beginConfig -**System Capabilities:** +beginConfig\(callback: AsyncCallback\): void -SystemCapability.Multimedia.Camera.Core +Starts configuration for this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -**Description** - -Starts configuration for this CaptureSession instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|----------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -1223,21 +1151,19 @@ captureSession.beginConfig((err) => { }); ``` -### beginConfig\(\): Promise; - -**System Capabilities:** +### beginConfig -SystemCapability.Multimedia.Camera.Core +beginConfig\(\): Promise -**Description** +Starts configuration for this **CaptureSession** instance. This API uses a promise to return the result. -Starts configuration for this CaptureSession instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core -**Return values** +**Return value** -| Type | Description | -|---------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1248,21 +1174,19 @@ captureSession.beginConfig().then(() => { }) ``` -### commitConfig\(callback: AsyncCallback\): void; - -**System Capabilities:** +### commitConfig -SystemCapability.Multimedia.Camera.Core +commitConfig\(callback: AsyncCallback\): void -**Description** +Commits the configuration for this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -Commits the configuration for this CaptureSession instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|---------------------|-----------|----------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -1276,21 +1200,19 @@ captureSession.commitConfig((err) => { }); ``` -### commitConfig\(\): Promise; - -**System Capabilities:** +### commitConfig -SystemCapability.Multimedia.Camera.Core +commitConfig\(\): Promise -**Description** +Commits the configuration for this **CaptureSession** instance. This API uses a promise to return the result. -Commits the configuration for this CaptureSession instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core -**Return values** +**Return value** -| Type | Description | -|---------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1300,22 +1222,20 @@ captureSession.commitConfig().then(() => { }) ``` -### addInput\(cameraInput: CameraInput, callback: AsyncCallback\): void; - -**System Capabilities:** +### addInput -SystemCapability.Multimedia.Camera.Core +addInput\(cameraInput: CameraInput, callback: AsyncCallback\): void -**Description** +Adds a **CameraInput** instance to this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -Add a CameraInput instance to this CaptureSession instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-------------|----------------------|-----------|---------------------------------------------| -| cameraInput | CameraInput | Yes | CameraInput instance to add | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -1329,27 +1249,25 @@ captureSession.addInput(cameraInput, (err) => { }); ``` -### addInput\(cameraInput: CameraInput\): Promise; +### addInput -**System Capabilities:** +addInput\(cameraInput: CameraInput\): Promise -SystemCapability.Multimedia.Camera.Core +Adds a **CameraInput** instance to this **CaptureSession** instance. This API uses a promise to return the result. -**Description** - -Add a CameraInput instance to this CaptureSession instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-------------|---------------------|-----------|-------------------------------| -| cameraInput | CameraInput | Yes | CameraInput instance to add | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.| -**Return values** +**Return value** -| Type | Description | -|----------------|------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1359,22 +1277,20 @@ captureSession.addInput(cameraInput).then(() => { }) ``` -### addOutput\(previewOutput: PreviewOutput, callback: AsyncCallback\): void; +### addOutput -**System Capabilities:** +addOutput\(previewOutput: PreviewOutput, callback: AsyncCallback\): void -SystemCapability.Multimedia.Camera.Core +Adds a **PreviewOutput** instance to this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -**Description** - -Add a PreviewOutput instance to this CaptureSession instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|----------------------|-----------|-------------------------------------| -| previewOutput | PreviewOutput | Yes | PreviewOutput instance to add | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| ------------- | ------------------------------- | ---- | ----------------------------- | +| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to add.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -1388,27 +1304,25 @@ captureSession.addOutput(previewOutput, (err) => { }); ``` -### addOutput\(previewOutput: PreviewOutput\): Promise; - -**System Capabilities:** +### addOutput -SystemCapability.Multimedia.Camera.Core +addOutput\(previewOutput: PreviewOutput\): Promise -**Description** +Adds a **PreviewOutput** instance to this **CaptureSession** instance. This API uses a promise to return the result. -Add a PreviewOutput instance to this CaptureSession instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|---------------------|-----------|--------------------------------| -| previewOutput | PreviewOutput | Yes | PreviewOutput instance to add | +| Name | Type | Mandatory| Description | +| ------------- | ------------------------------- | ---- | ----------------------------- | +| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to add.| -**Return values** +**Return value** -| Type | Description | -|----------------|-----------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1418,22 +1332,20 @@ captureSession.addOutput(previewOutput).then(() => { }) ``` -### addOutput\(photoOutput: PhotoOutput, callback: AsyncCallback\): void; - -**System Capabilities:** +### addOutput -SystemCapability.Multimedia.Camera.Core +addOutput\(photoOutput: PhotoOutput, callback: AsyncCallback\): void -**Description** +Adds a **PhotoOutput** instance to this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -Add a PhotoOutput instance to this CaptureSession instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|---------------------|-----------|-------------------------------------| -| photoOutput | PhotoOutput | Yes | PhotoOutput instance to add | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to add.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -1447,27 +1359,25 @@ captureSession.addOutput(photoOutput, (err) => { }); ``` -### addOutput\(photoOutput: PhotoOutput\): Promise; +### addOutput -**System Capabilities:** +addOutput\(photoOutput: PhotoOutput\): Promise -SystemCapability.Multimedia.Camera.Core +Adds a **PhotoOutput** instance to this **CaptureSession** instance. This API uses a promise to return the result. -**Description** - -Add a PhotoOutput instance to this CaptureSession instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|---------------------|-----------|--------------------------------| -| photoOutput | PhotoOutput | Yes | PhotoOutput instance to add | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to add.| -**Return values** +**Return value** | Type | Description | -|---------------|-----------------------------------| -| Promise | Promise used to return the result | +| -------------- | --------------------------- | +| Promise\ | Promise used to return the result.| **Example** @@ -1477,22 +1387,20 @@ captureSession.addOutput(photoOutput).then(() => { }) ``` -### addOutput\(videoOutput: VideoOutput, callback: AsyncCallback\): void; - -**System Capabilities:** +### addOutput -SystemCapability.Multimedia.Camera.Core +addOutput\(videoOutput: VideoOutput, callback: AsyncCallback\): void -**Description** +Adds a **VideoOutput** instance to this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -Add a VideoOutput instance to this CaptureSession instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|---------------------|-----------|-------------------------------------| -| videoOutput | VideoOutput | Yes | VideoOutput instance to add | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to add.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -1506,27 +1414,25 @@ captureSession.addOutput(videoOutput, (err) => { }); ``` -### addOutput\(videoOutput: VideoOutput\): Promise; +### addOutput -**System Capabilities:** +addOutput\(videoOutput: VideoOutput\): Promise -SystemCapability.Multimedia.Camera.Core +Adds a **VideoOutput** instance to this **CaptureSession** instance. This API uses a promise to return the result. -**Description** - -Add a VideoOutput instance to this CaptureSession instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|---------------------|-----------|--------------------------------| -| videoOutput | VideoOutput | Yes | VideoOutput instance to add | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to add.| -**Return values** +**Return value** -| Type | Description | -|----------------|-----------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise\ | Promise used to return the result.| **Example** @@ -1536,22 +1442,20 @@ captureSession.addOutput(videoOutput).then(() => { }) ``` -### removeInput\(cameraInput: CameraInput, callback: AsyncCallback\): void; +### removeInput -**System Capabilities:** +removeInput\(cameraInput: CameraInput, callback: AsyncCallback\): void -SystemCapability.Multimedia.Camera.Core +Removes a **CameraInput** instance from this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -**Description** - -Removes a **CameraInput** instance from this **CaptureSession** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-------------|----------------------|-----------|------------------------------------| -| cameraInput | CameraInput | Yes | CameraInput instance to remove | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to remove.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -1565,27 +1469,25 @@ captureSession.removeInput(cameraInput, (err) => { }); ``` -### removeInput\(cameraInput: CameraInput\): Promise; - -**System Capabilities:** +### removeInput -SystemCapability.Multimedia.Camera.Core +removeInput\(cameraInput: CameraInput\): Promise -**Description** +Removes a **CameraInput** instance from this **CaptureSession** instance. This API uses a promise to return the result. -Removes a **CameraInput** instance from this **CaptureSession** instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|-------------|---------------------|-----------|---------------------------------| -| cameraInput | CameraInput | Yes | CameraInput instance to remove | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to remove.| -**Return values** +**Return value** -| Type | Description | -|----------------|-----------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise\ | Promise used to return the result.| **Example** @@ -1595,22 +1497,20 @@ captureSession.removeInput(cameraInput).then(() => { }) ``` -### removeOutput\(previewOutput: PreviewOutput, callback: AsyncCallback\): void; - -**System Capabilities:** +### removeOutput -SystemCapability.Multimedia.Camera.Core +removeOutput\(previewOutput: PreviewOutput, callback: AsyncCallback\): void -**Description** +Removes a **PreviewOutput** instance from this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -Removes a **PreviewOutput** instance from this **CaptureSession** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|----------------------|-----------|------------------------------------| -| previewOutput | PreviewOutput | Yes | PreviewOutput instance to remove | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| ------------- | ------------------------------- | ---- | ----------------------------- | +| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to remove.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -1624,28 +1524,26 @@ captureSession.removeOutput(previewOutput, (err) => { }); ``` -### removeOutput(previewOutput: PreviewOutput): Promise; - -**System Capabilities:** +### removeOutput -SystemCapability.Multimedia.Camera.Core +removeOutput(previewOutput: PreviewOutput): Promise -**Description** +Removes a **PreviewOutput** instance from this **CaptureSession** instance. This API uses a promise to return the result. -Removes a **PreviewOutput** instance from this **CaptureSession** instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|---------------------|-----------|-----------------------------------| -| previewOutput | PreviewOutput | Yes | PreviewOutput instance to remove | +| Name | Type | Mandatory| Description | +| ------------- | ------------------------------- | ---- | ----------------------------- | +| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to remove.| -**Return values** +**Return value** -| Type | Description | -|---------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1656,22 +1554,20 @@ captureSession.removeOutput(previewOutput).then(() => { }) ``` -### removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void; - -**System Capabilities:** +### removeOutput -SystemCapability.Multimedia.Camera.Core +removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void -**Description** +Removes a **PhotoOutput** instance from this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -Removes a **PhotoOutput** instance from this **CaptureSession** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|----------------------|-----------|------------------------------------| -| photoOutput | PhotoOutput | Yes | PhotoOutput instance to remove | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to remove.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -1685,28 +1581,26 @@ captureSession.removeOutput(photoOutput, (err) => { }); ``` -### removeOutput(photoOutput: PhotoOutput): Promise; +### removeOutput -**System Capabilities:** +removeOutput(photoOutput: PhotoOutput): Promise -SystemCapability.Multimedia.Camera.Core +Removes a **PhotoOutput** instance from this **CaptureSession** instance. This API uses a promise to return the result. -**Description** - -Removes a **PhotoOutput** instance from this **CaptureSession** instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|---------------------|-----------|---------------------------------| -| photoOutput | PhotoOutput | Yes | PhotoOutput instance to remove | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to remove.| -**Return values** +**Return value** -| Type | Description | -|---------------|------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1717,22 +1611,20 @@ captureSession.removeOutput(photoOutput).then(() => { }) ``` -### removeOutput(videoOutput: VideoOutput, callback: AsyncCallback): void; +### removeOutput -**System Capabilities:** +removeOutput(videoOutput: VideoOutput, callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Removes a **VideoOutput** instance from this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -**Description** - -Removes a **VideoOutput** instance from this **CaptureSession** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|----------------------|-----------|------------------------------------| -| videoOutput | VideoOutput | Yes | VideoOutput instance to remove | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to remove.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -1746,28 +1638,26 @@ captureSession.removeOutput(videoOutput, (err) => { }); ``` -### removeOutput(videoOutput: VideoOutput): Promise; - -**System Capabilities:** +### removeOutput -SystemCapability.Multimedia.Camera.Core +removeOutput(videoOutput: VideoOutput): Promise -**Description** +Removes a **VideoOutput** instance from this **CaptureSession** instance. This API uses a promise to return the result. -Removes a **VideoOutput** instance from this **CaptureSession** instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|---------------|---------------------|-----------|---------------------------------| -| videoOutput | VideoOutput | Yes | VideoOutput instance to remove | +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | --------------------------- | +| videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to remove.| -**Return values** +**Return value** -| Type | Description | -|----------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1778,21 +1668,19 @@ captureSession.removeOutput(videoOutput).then(() => { }) ``` -### start\(callback: AsyncCallback\): void; - -**System Capabilities:** +### start -SystemCapability.Multimedia.Camera.Core +start\(callback: AsyncCallback\): void -**Description** +Starts this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -Starts this **CaptureSession** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|----------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -1806,21 +1694,19 @@ captureSession.start((err) => { }); ``` -### start\(\): Promise; - -**System Capabilities:** +### start -SystemCapability.Multimedia.Camera.Core +start\(\): Promise -**Description** +Starts this **CaptureSession** instance. This API uses a promise to return the result. -Starts this **CaptureSession** instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core -**Return values** +**Return value** -| Type | Description | -|----------------|-----------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1830,22 +1716,20 @@ captureSession.start().then(() => { }) ``` -### stop\(callback: AsyncCallback\): void; - -**System Capabilities:** +### stop -SystemCapability.Multimedia.Camera.Core +stop\(callback: AsyncCallback\): void -**Description** +Stops this **CaptureSession** instance. This API uses an asynchronous callback to return the result. -Stops this **CaptureSession** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -1859,21 +1743,19 @@ captureSession.stop((err) => { }); ``` -### stop(): Promise; +### stop -**System Capabilities:** +stop(): Promise -SystemCapability.Multimedia.Camera.Core +Stops this **CaptureSession** instance. This API uses a promise to return the result. -**Description** +**System capability**: SystemCapability.Multimedia.Camera.Core -Stops this **CaptureSession** instance. This method uses a promise to return the result. +**Return value** -**Return values** - -| Type | Description | -|----------------|-----------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1883,21 +1765,19 @@ captureSession.stop().then(() => { }) ``` -### release\(callback: AsyncCallback\): void; +### release -**System Capabilities:** +release\(callback: AsyncCallback\): void -SystemCapability.Multimedia.Camera.Core +Releases this **CaptureSession** instance. This API uses an asynchronous callback to return the instance. -**Description** - -Releases this **CaptureSession** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -1911,21 +1791,19 @@ captureSession.release((err) => { }); ``` -### release(): Promise; - -**System Capabilities:** +### release -SystemCapability.Multimedia.Camera.Core +release(): Promise -**Description** +Releases this **CaptureSession** instance. This API uses a promise to return the result. -Releases this **CaptureSession** instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core -**Return values** +**Return value** -| Type | Description | -|----------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -1935,22 +1813,20 @@ captureSession.release().then(() => { }) ``` -### on(type: 'error', callback: Callback): void; - -**System Capabilities:** +### on('error') -SystemCapability.Multimedia.Camera.Core +on(type: 'error', callback: ErrorCallback): void -**Description** +Listens for **CaptureSession** errors. This API uses a callback to return the errors. -Listens for **CaptureSession** errors. This method uses a callback to get errors. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :--------------------- | :-------- | :-----------------------------------------------| -| type | string | Yes | Capture session error event. | -| callback | Callback | Yes | Callback used to get the capture session errors. | +| Name | Type | Mandatory| Description | +| :------- | :---------------------------------- | :--- | :-------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the capture session error event.| +| callback | ErrorCallback | Yes | Callback used to return the capture session errors. | **Example** @@ -1960,22 +1836,20 @@ captureSession.on('error', (captureSessionError) => { }) ``` -## createPreviewOutput(surfaceId: string, callback: AsyncCallback): void; - -**System Capabilities:** +## camera.createPreviewOutput -SystemCapability.Multimedia.Camera.Core +createPreviewOutput(surfaceId: string, callback: AsyncCallback): void -**Description** +Creates a **PreviewOutput** instance. This API uses an asynchronous callback to return the instance. -Creates a **PreviewOutput** instance. This method uses an asynchronous callback to return the instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|------------|-------------------------------|-----------|----------------------------------------------------| -| surfaceId | string | Yes | Surface ID received from XComponent view | -| callback | AsyncCallback | Yes | Callback used to return the PreviewOutput instance | +| Name | Type | Mandatory| Description | +| --------- | ----------------------------------------------- | ---- | ------------------------------------- | +| surfaceId | string | Yes | Surface ID received from **XComponent**. | +| callback | AsyncCallback<[PreviewOutput](#previewoutput)\> | Yes | Callback used to return the **PreviewOutput** instance.| **Example** @@ -1987,29 +1861,27 @@ camera.createPreviewOutput((surfaceId), (err, previewOutput) => { } console.log('Callback returned with previewOutput instance'); }); -``` - -## createPreviewOutput(surfaceId: string): Promise; +``` -**System Capabilities:** +## camera.createPreviewOutput -SystemCapability.Multimedia.Camera.Core +createPreviewOutput(surfaceId: string): Promise\ -**Description** +Creates a **PreviewOutput** instance. This API uses a promise to return the instance. -Creates a **PreviewOutput** instance. This method uses a promise to return the instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|------------|-----------------|-----------|----------------------------------------------------| -| surfaceId | string | Yes | Surface ID received from XComponent view | +| Name | Type | Mandatory| Description | +| --------- | ------ | ---- | ---------------------------------- | +| surfaceId | string | Yes | Surface ID received from **XComponent**.| -**Return values** +**Return value** -| Type | Description | -|-------------------------|---------------------------------------------------| -| Promise | Promise used to return the PreviewOutput instance | +| Type | Description | +| ----------------------------------------- | --------------------------- | +| Promise<[PreviewOutput](#previewoutput)\> | Promise used to return the **PreviewOutput** instance.| **Example** @@ -2023,21 +1895,19 @@ camera.createPreviewOutput(surfaceId).then((previewOutput) => { Implements preview output. -### release(callback: AsyncCallback): void; - -**System Capabilities:** +### release -SystemCapability.Multimedia.Camera.Core +release(callback: AsyncCallback): void -**Description** +Releases this **PreviewOutput** instance. This API uses an asynchronous callback to return the result. -Releases this **PreviewOutput** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|----------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -2051,21 +1921,19 @@ previewOutput.release((err) => { }); ``` -### release(): Promise; +### release -**System Capabilities:** +release(): Promise -SystemCapability.Multimedia.Camera.Core +Releases this **PreviewOutput** instance. This API uses a promise to return the result. -**Description** +**System capability**: SystemCapability.Multimedia.Camera.Core -Releases this **PreviewOutput** instance. This method uses a promise to return the result. +**Return value** -**Return values** - -| Type | Description | -|----------------|-----------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -2076,22 +1944,20 @@ previewOutput.release().then(() => { }) ``` -### on(type: 'frameStart', callback: Callback): void; +### on('frameStart') -**System Capabilities:** +on(type: 'frameStart', callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Listens for preview frame start events. This API uses an asynchronous callback to return the result. -**Description** - -Listens for preview frame start events. This method uses a callback to get the event information. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :---------------- | :-------- | :----------------------------------| -| type | string | Yes | Name of the event to listen for. | -| callback | Callback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| :------- | :------------------- | :--- | :------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **frameStart**, indicating the preview frame start event.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -2101,22 +1967,20 @@ previewOutput.on('frameStart', () => { }) ``` -### on(type: 'frameEnd', callback: Callback): void; - -**System Capabilities:** +### on('frameEnd') -SystemCapability.Multimedia.Camera.Core +on(type: 'frameEnd', callback: AsyncCallback): void -**Description** +Listens for preview frame end events. This API uses an asynchronous callback to return the result. -Listens for preview frame end event. This method uses a callback to get the event information. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :---------------- | :-------- | :----------------------------------| -| type | string | Yes | Name of the event to listen for. | -| callback | Callback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| :------- | :------------------- | :--- | :----------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **frameEnd**, indicating the preview frame end event.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -2126,22 +1990,20 @@ previewOutput.on('frameEnd', () => { }) ``` -### on(type: 'error', callback: Callback): void; +### on('error') -**System Capabilities:** +on(type: 'error', callback: ErrorCallback): void -SystemCapability.Multimedia.Camera.Core +Listens for **PreviewOutput** errors. This API uses a callback to return the errors. -**Description** - -Listens for **PreviewOutput** errors. This method uses a callback to get errors. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :--------------------- | :-------- | :-----------------------------------------------| -| type | string | Yes | Preview output error event. | -| callback | Callback | Yes | Callback used to get the preview output errors. | +| Name | Type | Mandatory| Description | +| :------- | :--------------------------------- | :--- | :-------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the preview output error event.| +| callback | ErrorCallback | Yes | Callback used to return the preview output errors. | **Example** @@ -2151,22 +2013,20 @@ previewOutput.on('error', (previewOutputError) => { }) ``` -## createPhotoOutput(surfaceId: string, callback: AsyncCallback): void; - -**System Capabilities:** +## camera.createPhotoOutput -SystemCapability.Multimedia.Camera.Core +createPhotoOutput(surfaceId: string, callback: AsyncCallback): void -**Description** +Creates a **PhotoOutput** instance. This API uses an asynchronous callback to return the instance. -Creates a **PhotoOutput** instance. This method uses an asynchronous callback to return the instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|------------|-------------------------------|-----------|----------------------------------------------------| -| surfaceId | string | Yes | Surface ID received from ImageReceiver | -| callback | AsyncCallback | Yes | Callback used to return the PhotoOutput instance | +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------- | ---- | ----------------------------------- | +| surfaceId | string | Yes | Surface ID received from **ImageReceiver**. | +| callback | AsyncCallback<[PhotoOutput](#photooutput)\> | Yes | Callback used to return the **PhotoOutput** instance.| **Example** @@ -2178,29 +2038,27 @@ camera.createPhotoOutput((surfaceId), (err, photoOutput) => { } console.log('Callback returned with the PhotoOutput instance.'); }); -``` - -## createPhotoOutput(surfaceId: string): Promise; +``` -**System Capabilities:** +## camera.createPhotoOutput -SystemCapability.Multimedia.Camera.Core +createPhotoOutput(surfaceId: string): Promise -**Description** +Creates a **PhotoOutput** instance. This API uses a promise to return the instance. -Creates a **PhotoOutput** instance. This method uses a promise to return the PhotoOutput instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|------------|-----------------|-----------|----------------------------------------------------| -| surfaceId | string | Yes | Surface ID received from ImageReceiver | +| Name | Type | Mandatory| Description | +| --------- | ------ | ---- | --------------------------------- | +| surfaceId | string | Yes | Surface ID received from **ImageReceiver**.| -**Return values** +**Return value** -| Type | Description | -|-------------------------|--------------------------------------------------| -| Promise | Promise used to return the PhotoOutput instance | +| Type | Description | +| ------------------------------------- | -------------------------------------- | +| Promise<[PhotoOutput](#photooutput)\> | Promise used to return the **PhotoOutput** instance.| **Example** @@ -2213,79 +2071,59 @@ camera.createPhotoOutput(surfaceId).then((photoOutput) => { Enumerates the image rotation angles. -**System Capabilities:** - -SystemCapability.Multimedia.Camera.Core - -| Name | Default Value | Description | -|--------------|---------------|----------------------------------------| -| ROTATION_0 | 0 | The capture image rotates 0 degrees | -| ROTATION_90 | 90 | The capture image rotates 90 degrees | -| ROTATION_180 | 180 | The capture image rotates 180 degrees | -| ROTATION_270 | 270 | The capture image rotates 270 degrees | +**System capability**: SystemCapability.Multimedia.Camera.Core +| Name | Default Value| Description | +| ------------ | ------ | --------------- | +| ROTATION_0 | 0 | The image rotates 0 degrees. | +| ROTATION_90 | 90 | The image rotates 90 degrees. | +| ROTATION_180 | 180 | The image rotates 180 degrees.| +| ROTATION_270 | 270 | The image rotates 270 degrees.| -## Location -Defines the location of a captured image. - -**System Capabilities:** - -SystemCapability.Multimedia.Camera.Core - -| Name | Type | Access | Description | -|-----------|--------|--------------|-------------| -| latitude | number | read / write | Latitude | -| longitude | number | read / write | Longitude | ## QualityLevel Enumerates the image quality levels. -**System Capabilities:** +**System capability**: SystemCapability.Multimedia.Camera.Core -SystemCapability.Multimedia.Camera.Core - -| Name | Default value | Description | -|----------------------|---------------|----------------------| -| QUALITY_LEVEL_HIGH | 0 | High image quality | -| QUALITY_LEVEL_MEDIUM | 1 | Medium image quality | -| QUALITY_LEVEL_LOW | 2 | Low image quality | +| Name | Default Value| Description | +| -------------------- | ------ | -------------- | +| QUALITY_LEVEL_HIGH | 0 | High image quality. | +| QUALITY_LEVEL_MEDIUM | 1 | Medium image quality.| +| QUALITY_LEVEL_LOW | 2 | Low image quality. | ## PhotoCaptureSetting Defines the settings for image capture. -**System Capabilities:** - -SystemCapability.Multimedia.Camera.Core +**System capability**: SystemCapability.Multimedia.Camera.Core -| Name | Type | Mandatory | Description | -|----------|---------------|-----------|---------------------| -| quality | QualityLevel | Optional | Photo image quality | -| rotation | ImageRotation | Optional | Photo rotation | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------- | ---- | -------------- | +| quality | [QualityLevel](#qualitylevel) | No | Photo image quality. | +| rotation | [ImageRotation](#imagerotation) | No | Photo rotation.| ## PhotoOutput Implements photo output. -### capture(callback: AsyncCallback): void; +### capture -**System Capabilities:** +capture(callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Captures a photo. This API uses an asynchronous callback to return the result. -**Description** - -Captures a photo. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|---------------------|-----------|----------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -2299,22 +2137,20 @@ photoOutput.capture((err) => { }); ``` -### capture(setting: PhotoCaptureSetting, callback: AsyncCallback): void; - -**System Capabilities:** +### capture -SystemCapability.Multimedia.Camera.Core +capture(setting: PhotoCaptureSetting, callback: AsyncCallback): void -**Description** +Captures a photo with the specified capture settings. This API uses an asynchronous callback to return the result. -Captures a photo with the specified capture settings. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|----------------------------------------------| -| setting | PhotoCaptureSetting | Yes | Photo capture settings | -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------- | ---- | ------------------------ | +| setting | [PhotoCaptureSetting](#photocapturesetting) | Yes | Photo capture settings. | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -2328,27 +2164,25 @@ photoOutput.capture(settings, (err) => { }); ``` -### capture(setting?: PhotoCaptureSetting): Promise; +### capture -**System Capabilities:** +capture(setting?: PhotoCaptureSetting): Promise -SystemCapability.Multimedia.Camera.Core +Captures a photo with the specified capture settings. This API uses a promise to return the result. -**Description** - -Captures a photo with the specified capture settings. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|---------------------|-----------|----------------------------------------------| -| setting | PhotoCaptureSetting | No | Photo capture settings | +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------- | ---- | ---------- | +| setting | [PhotoCaptureSetting](#photocapturesetting) | No | Photo capture settings.| -**Return values** +**Return value** -| Type | Description | -|----------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -2359,21 +2193,19 @@ photoOutput.capture().then(() => { }) ``` -### release(callback: AsyncCallback): void; +### release -**System Capabilities:** +release(callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Releases this **PhotoOutput** instance. This API uses an asynchronous callback to return the result. -**Description** - -Releases this **PhotoOutput** instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|----------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -2387,21 +2219,19 @@ photoOutput.release((err) => { }); ``` -### release(): Promise; - -**System Capabilities:** +### release -SystemCapability.Multimedia.Camera.Core +release(): Promise -**Description** +Releases this **PhotoOutput** instance. This API uses a promise to return the result. -Releases this **PhotoOutput** instance. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core -**Return values** +**Return value** -| Type | Description | -|----------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -2412,22 +2242,20 @@ photoOutput.release().then(() => { }) ``` -### on(type: 'captureStart', callback: Callback): void; +### on('captureStart') -**System Capabilities:** +on(type: 'captureStart', callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Listens for photo capture start events. This API uses a callback to return the event information. -**Description** - -Listens for photo capture start events. This method uses a callback to get the event information. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :--------------------- | :-------- | :-----------------------------------------------| -| type | string | Yes | Name of the event to listen for. | -| callback | Callback | Yes | Callback used to get the capture ID. | +| Name | Type | Mandatory| Description | +| :------- | :--------------------- | :--- | :----------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **captureStart**, indicating the photo capture start event.| +| callback | AsyncCallback | Yes | Callback used to return the capture ID. | **Example** @@ -2437,22 +2265,20 @@ photoOutput.on('captureStart', (captureId) => { }) ``` -### on(type: 'frameShutter', callback: Callback): void; - -**System Capabilities:** +### on('frameShutter') -SystemCapability.Multimedia.Camera.Core +on(type: 'frameShutter', callback: AsyncCallback): void -**Description** +Listens for frame shutter events. This API uses a callback to return the event information. -Listens for frame shutter events. This method uses a callback to get the event information. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :--------------------- | :-------- | :-----------------------------------------------| -| type | string | Yes | Name of the event to listen for. | -| callback | Callback | Yes | Callback used to get the frame shutter information.| +| Name | Type | Mandatory| Description | +| :------- | :------------------------------- | :--- | :--------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **frameShutter**, indicating the frame shutter event.| +| callback | AsyncCallback | Yes | Callback used to return the frame shutter information. | **Example** @@ -2463,22 +2289,20 @@ photoOutput.on('frameShutter', (frameShutterInfo) => { }) ``` -### on(type: 'captureEnd', callback: Callback): void; +### on('captureEnd') -**System Capabilities:** +on(type: 'captureEnd', callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Listens for photo capture end events. This API uses a callback to return the event information. -**Description** - -Listens for photo capture end events. This method uses a callback to get the event information. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :--------------------- | :-------- | :------------------------------------------------| -| type | string | Yes | Name of the event to listen for. | -| callback | Callback | Yes | Callback used to get the capture end information | +| Name | Type | Mandatory| Description | +| :------- | :----------------------------- | :--- | :--------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **captureEnd**, indicating the photo capture end event.| +| callback | AsyncCallback | Yes | Callback used to return the photo capture end information. | **Example** @@ -2489,22 +2313,20 @@ photoOutput.on('captureEnd', (captureEndInfo) => { }) ``` -### on(type: 'error', callback: Callback): void; - -**System Capabilities:** +### on('error') -SystemCapability.Multimedia.Camera.Core +on(type: 'error', callback: ErrorCallback): void -**Description** +Listens for **PhotoOutput** errors. This API uses a callback to return the errors. -Listens for **PhotoOutput** errors. This method uses a callback to get errors. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :--------------------- | :-------- | :-----------------------------------------------| -| type | string | Yes | Photo output error event. | -| callback | Callback | Yes | Callback used to get the photo output errors. | +| Name | Type | Mandatory| Description | +| :------- | :------------------------------- | :--- | :---------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the photo output error event.| +| callback | ErrorCallback | Yes | Callback used to return the photo output errors. | **Example** @@ -2514,22 +2336,20 @@ photoOutput.on('error', (photoOutputError) => { }) ``` -## createVideoOutput(surfaceId: string, callback: AsyncCallback): void; +## camera.createVideoOutput -**System Capabilities:** +createVideoOutput(surfaceId: string, callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Creates a **VideoOutput** instance. This API uses an asynchronous callback to return the instance. -**Description** - -Creates a **VideoOutput** instance. This method uses an asynchronous callback to return the instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|------------|-------------------------------|-----------|----------------------------------------------------| -| surfaceId | string | Yes | Surface ID received from VideoRecorder | -| callback | AsyncCallback | Yes | Callback used to return the VideoOutput instance | +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------- | ---- | ----------------------------------- | +| surfaceId | string | Yes | Surface ID received from **VideoRecorder**. | +| callback | AsyncCallback<[VideoOutput](#videooutput)\> | Yes | Callback used to return the **VideoOutput** instance.| **Example** @@ -2541,29 +2361,27 @@ camera.createVideoOutput((surfaceId), (err, videoOutput) => { } console.log('Callback returned with the VideoOutput instance'); }); -``` - -## createVideoOutput(surfaceId: string): Promise; +``` -**System Capabilities:** +## camera.createVideoOutput -SystemCapability.Multimedia.Camera.Core +createVideoOutput(surfaceId: string): Promise -**Description** +Creates a **VideoOutput** instance. This API uses a promise to return the instance. -Creates a **VideoOutput** instance. This method uses a promise to return the VideoOutput instance. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|------------|-----------------|-----------|----------------------------------------------------| -| surfaceId | string | Yes | Surface ID received from VideoRecorder | +| Name | Type | Mandatory| Description | +| --------- | ------ | ---- | --------------------------------- | +| surfaceId | string | Yes | Surface ID received from **VideoRecorder**.| -**Return values** +**Return value** -| Type | Description | -|---------------------------------------|-------------------------------------------------| -| Promise<[VideoOutput](#videooutput)\> | Promise used to return the VideoOutput instance | +| Type | Description | +| ------------------------------------- | -------------------------------------- | +| Promise<[VideoOutput](#videooutput)\> | Promise used to return the **VideoOutput** instance.| **Example** @@ -2572,25 +2390,24 @@ camera.createVideoOutput(surfaceId).then((videoOutput) => { console.log('Promise returned with the VideoOutput instance'); }) ``` + ## VideoOutput Implements video output. -### start(callback: AsyncCallback): void; - -**System Capabilities:** +### start -SystemCapability.Multimedia.Camera.Core +start(callback: AsyncCallback): void -**Description** +Starts the video output. This API uses an asynchronous callback to return the result. -Starts the video output. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|----------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -2604,21 +2421,19 @@ videoOutput.start((err) => { }); ``` -### start(): Promise; +### start -**System Capabilities:** +start(): Promise -SystemCapability.Multimedia.Camera.Core +Starts the video output. This API uses a promise to return the result. -**Description** +**System capability**: SystemCapability.Multimedia.Camera.Core -Starts the video output. This method uses a promise to return the result. +**Return value** -**Return values** - -| Type | Description | -|----------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -2629,21 +2444,19 @@ videoOutput.start().then(() => { }) ``` -### stop(callback: AsyncCallback): void; +### stop -**System Capabilities:** +stop(callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Stops the video output. This API uses an asynchronous callback to return the result. -**Description** - -Stops the video output. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|----------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -2657,21 +2470,19 @@ videoOutput.stop((err) => { }); ``` -### stop(): Promise; - -**System Capabilities:** +### stop -SystemCapability.Multimedia.Camera.Core +stop(): Promise -**Description** +Stops the video output. This API uses a promise to return the result. -Stops the video output. This method uses a promise to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core -**Return values** +**Return value** -| Type | Description | -|----------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -2681,21 +2492,19 @@ videoOutput.start().then(() => { }) ``` -### release(callback: AsyncCallback): void; - -**System Capabilities:** +### release -SystemCapability.Multimedia.Camera.Core +release(callback: AsyncCallback): void -**Description** +Releases this **VideoOutput** instance. This API uses an asynchronous callback to return the result. -Releases this VideoOutput instance. This method uses an asynchronous callback to return the result. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -|----------|----------------------|-----------|----------------------------------------------| -| callback | AsyncCallback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------------ | +| callback | AsyncCallback | Yes | Callback used to return the result.| **Example** @@ -2709,21 +2518,19 @@ videoOutput.release((err) => { }); ``` -### release(): Promise; +### release -**System Capabilities:** +release(): Promise -SystemCapability.Multimedia.Camera.Core +Releases this **VideoOutput** instance. This API uses a promise to return the result. -**Description** +**System capability**: SystemCapability.Multimedia.Camera.Core -Releases this VideoOutput instance. This method uses a promise to return the result. +**Return value** -**Return values** - -| Type | Description | -|----------------|---------------------------------------------| -| Promise | Promise used to return the result | +| Type | Description | +| -------------- | --------------------------- | +| Promise | Promise used to return the result.| **Example** @@ -2734,22 +2541,20 @@ videoOutput.release().then(() => { }) ``` -### on(type: 'frameStart', callback: Callback): void; +### on('frameStart') -**System Capabilities:** +on(type: 'frameStart', callback: AsyncCallback): void -SystemCapability.Multimedia.Camera.Core +Listens for video frame start events. This API uses a callback to return the event information. -**Description** - -Listens for video frame start events. This method uses a callback to get the event information. +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :---------------- | :-------- | :----------------------------------| -| type | string | Yes | Name of the event to listen for. | -| callback | Callback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| :------- | :------------------- | :--- | :----------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **frameStart**, indicating the video frame start event.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -2759,16 +2564,20 @@ videoOutput.on('frameStart', () => { }) ``` -### on(type: 'frameEnd', callback: Callback): void; +### on('frameEnd') + +on(type: 'frameEnd', callback: AsyncCallback): void -Listens for video frame end events. This method uses a callback to get the event information. +Listens for video frame end events. This API uses a callback to return the event information. + +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :---------------- | :-------- | :----------------------------------| -| type | string | Yes | Name of the event to listen for. | -| callback | Callback | Yes | Callback used to return the result | +| Name | Type | Mandatory| Description | +| :------- | :------------------- | :--- | :--------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **frameEnd**, indicating the video frame end event.| +| callback | AsyncCallback | Yes | Callback used to return the result. | **Example** @@ -2778,16 +2587,20 @@ videoOutput.on('frameEnd', () => { }) ``` -### on(type: 'error', callback: Callback): void; +### on('error') + +on(type: 'error', callback: ErrorCallback): void -Listens for **VideoOutput** errors. This method uses a callback to get errors. +Listens for **VideoOutput** errors. This API uses a callback to return the errors. + +**System capability**: SystemCapability.Multimedia.Camera.Core **Parameters** -| Name | Type | Mandatory | Description | -| :------- | :--------------------- | :-------- | :-----------------------------------------------| -| type | string | Yes | Video output error event. | -| callback | Callback | Yes | Callback used to get the video output errors. | +| Name | Type | Mandatory| Description | +| :------- | :-------------------------- | :--- | :-------------------------------------------- | +| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the video output error event.| +| callback | Callback | Yes | Callback used to return the video output errors. | **Example** @@ -2795,4 +2608,4 @@ Listens for **VideoOutput** errors. This method uses a callback to get errors. videoOutput.on('error', (VideoOutputError) => { console.log('Video output error code: ' + VideoOutputError.code); }) -``` \ No newline at end of file +```