未验证 提交 632f58e4 编写于 作者: O openharmony_ci 提交者: Gitee

!4095 翻译完成:3924 更正Camera API中的错误表述

Merge pull request !4095 from wusongqing/TR3924
# Camera<a name="EN-US_TOPIC_0000001149807881"></a> # Camera Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br/>
> 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. > 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 ## Modules to Import
...@@ -11,25 +11,22 @@ import camera from '@ohos.multimedia.camera'; ...@@ -11,25 +11,22 @@ import camera from '@ohos.multimedia.camera';
## Required Permissions ## Required Permissions
```
ohos.permission.CAMERA ohos.permission.CAMERA
```
## getCameraManager(context: Context, callback: AsyncCallback<CameraManager\>): void;
**System Capabilities:** ## camera.getCameraManager
SystemCapability.Multimedia.Camera.Core getCameraManager(context: Context, callback: AsyncCallback<CameraManager\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|-------------------------------|-----------|-----------------------------------------------------| | -------- | ----------------------------------------------- | ---- | ---------------------------------- |
| context | Context | Yes | Application context | | context | Context | Yes | Application context. |
| callback | AsyncCallback<CameraManager\> | Yes | Callback used to return the CameraManager instance | | callback | AsyncCallback<[CameraManager](#cameramanager)\> | Yes | Callback used to return the **CameraManager** instance.|
**Example** **Example**
...@@ -43,116 +40,105 @@ camera.getCameraManager(context, (err, cameraManager) => { ...@@ -43,116 +40,105 @@ camera.getCameraManager(context, (err, cameraManager) => {
}); });
``` ```
## getCameraManager(context: Context): Promise<CameraManager\>; ## camera.getCameraManager
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core getCameraManager(context: Context): Promise<CameraManager\>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|----------------------------| | ------- | ------- | ---- | ------------ |
| context | Context | Yes | Application context | | context | Context | Yes | Application context.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|-------------------------|--------------------------------------------------------| | ----------------------------------------- | ----------------------------------------- |
| Promise<CameraManager\> | Promise used to return the **CameraManager** instance | | Promise<[CameraManager](#cameramanager)\> | Promise used to return the **CameraManager** instance.|
**Example** **Example**
``` ```
camera.getCameraManager(context).then((cameraManger) => { camera.getCameraManager(context).then((cameraManager) => {
console.log('Promise returned with the CameraManager instance.'); console.log('Promise returned with the CameraManager instance.');
}) })
``` ```
## CameraStatus<a name="section_camera_status"></a> ## 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<a name="section_camera_position"></a>
Enumerates the camera positions. Enumerates the camera positions.
**System Capabilities:** **System capability**: SystemCapability.Multimedia.Camera.Core
SystemCapability.Multimedia.Camera.Core
| Name | Default value | Description | | Name | Default Value| Description |
|-----------------------------|---------------|-----------------------| | --------------------------- | ------ | ---------------- |
| CAMERA_POSITION_UNSPECIFIED | 0 | Unspecified position | | CAMERA_POSITION_UNSPECIFIED | 0 | Unspecified position.|
| CAMERA_POSITION_BACK | 1 | Rear camera | | CAMERA_POSITION_BACK | 1 | Rear camera. |
| CAMERA_POSITION_FRONT | 2 | Front camera | | CAMERA_POSITION_FRONT | 2 | Front camera. |
## CameraType<a name="section_camera_type"></a> ## CameraType
Enumerates the camera types. 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<a name="section_ConnectionType"></a> 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 | ## CameraManager
|------------------------------|---------------|----------------------------|
| CAMERA_CONNECTION_BUILT_IN | 0 | Built-in camera |
| CAMERA_CONNECTION_USB_PLUGIN | 1 | Camera connected using USB |
| CAMERA_CONNECTION_REMOTE | 2 | Remote camera |
## CameraManager<a name="section_CameraManager"></a> 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<Array<Camera\>\>): void; getCameras(callback: AsyncCallback<Array<Camera\>\>): 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 **System capability**: 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.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|--------------------------------|-----------|---------------------------------------------------------| | -------- | ----------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback<Array<Camera\>\> | Yes | Callback used to return the array of supported cameras. | | callback | AsyncCallback<Array<[Camera](#camera)\>\> | Yes | Callback used to return the array of supported cameras.|
**Example** **Example**
...@@ -166,21 +152,19 @@ cameraManager.getCameras((err, cameras) => { ...@@ -166,21 +152,19 @@ cameraManager.getCameras((err, cameras) => {
}) })
``` ```
### getCameras(): Promise<Array<Camera\>\>; ### getCameras
**System Capabilities:** getCameras(): Promise<Array<Camera\>\>
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 |
| ----------------------------------- | ----------------------------- |
| Type | Description | | Promise<Array<[Camera](#camera)\>\> | Promise used to return the array of supported cameras.|
|------------------------|--------------------------------------------------------|
| Promise<Array<Camera\>\> | Promise used to return an array of supported cameras |
**Example** **Example**
...@@ -191,22 +175,20 @@ cameraManager.getCameras().then((cameraArray) => { ...@@ -191,22 +175,20 @@ cameraManager.getCameras().then((cameraArray) => {
}) })
``` ```
### createCameraInput(cameraId: string, callback: AsyncCallback<CameraInput\>): void; ### createCameraInput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core createCameraInput(cameraId: string, callback: AsyncCallback<CameraInput\>): 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** **Parameters**
| Name | Default value | Mandatory | Description | | Name | Default Value | Mandatory| Description |
|----------|------------------------------|-----------|--------------------------------------------------| | -------- | ------------------------------------------- | ---- | ----------------------------------- |
| cameraId | string | Yes | Camera ID used to create the instance | | cameraId | string | Yes | Camera ID used to create the instance. |
| callback | AsyncCallback<CameraInput\> | Yes | Callback used to return the CameraInput instance | | callback | AsyncCallback<[CameraInput](#camerainput)\> | Yes | Callback used to return the **CameraInput** instance.|
**Example** **Example**
...@@ -220,27 +202,25 @@ cameraManager.createCameraInput(cameraId, (err, cameraInput) => { ...@@ -220,27 +202,25 @@ cameraManager.createCameraInput(cameraId, (err, cameraInput) => {
}) })
``` ```
### createCameraInput(cameraId: string): Promise<CameraInput\>; ### createCameraInput
**System Capabilities:** createCameraInput(cameraId: string): Promise<CameraInput\>
SystemCapability.Multimedia.Camera.Core Creates a **CameraInput** instance with the specified camera ID. This API uses a promise to return the instance.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Creates a **CameraInput** instance with the specified camera ID. This method uses a promise to return the instance.
**Parameters** **Parameters**
| Name | Default value | Mandatory | Description | | Name | Default Value| Mandatory| Description |
|----------|-----------------------------|-----------|------------------------------------------| | -------- | ------ | ---- | ------------ |
| cameraId | string | Yes | Camera ID used to create the instance | | cameraId | string | Yes | Camera ID used to create the instance.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|-------------------------|-------------------------------------------------| | ------------------------------------- | ---------------------------------------- |
| Promise<CameraInput\> | Promise used to return the CameraInput instance | | Promise<[CameraInput](#camerainput)\> | Promise used to return the **CameraInput** instance.|
**Example** **Example**
...@@ -250,23 +230,21 @@ cameraManager.createCameraInput(cameraId).then((cameraInput) => { ...@@ -250,23 +230,21 @@ cameraManager.createCameraInput(cameraId).then((cameraInput) => {
}) })
``` ```
### createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback<CameraInput\>): void; ### createCameraInput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback<CameraInput\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|-----------------------------|-----------|---------------------------------------------------| | -------- | ------------------------------------------- | ---- | ----------------------------------- |
| position | CameraPosition | Yes | Camera position | | position | [CameraPosition](#cameraposition) | Yes | Camera position. |
| type | CameraType | Yes | Camera type | | type | [CameraType](#cameratype) | Yes | Camera type. |
| callback | AsyncCallback<CameraInput\> | Yes | Callback used to return the CameraInput instance | | callback | AsyncCallback<[CameraInput](#camerainput)\> | Yes | Callback used to return the **CameraInput** instance.|
**Example** **Example**
...@@ -280,28 +258,26 @@ cameraManager.createCameraInput(cameraPosition, cameraType, (err, cameraInput) = ...@@ -280,28 +258,26 @@ cameraManager.createCameraInput(cameraPosition, cameraType, (err, cameraInput) =
}) })
``` ```
### createCameraInput(position: CameraPosition, type: CameraType): Promise<CameraInput\>; ### createCameraInput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core createCameraInput(position: CameraPosition, type: CameraType): Promise<CameraInput\>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------------|-----------|----------------------------------------| | -------- | --------------------------------- | ---- | ---------- |
| position | CameraPosition | Yes | Camera position | | position | [CameraPosition](#cameraposition) | Yes | Camera position.|
| type | CameraType | Yes | Camera type | | type | [CameraType](#cameratype) | Yes | Camera type.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|-------------------------|-------------------------------------------------| | ------------------------------------- | ---------------------------------------- |
| Promise<CameraInput\> | Promise used to return the CameraInput instance | | Promise<[CameraInput](#camerainput)\> | Promise used to return the **CameraInput** instance.|
**Example** **Example**
...@@ -311,22 +287,20 @@ cameraManager.createCameraInput(cameraPosition, cameraType).then((cameraInput) = ...@@ -311,22 +287,20 @@ cameraManager.createCameraInput(cameraPosition, cameraType).then((cameraInput) =
}) })
``` ```
### on(type: 'cameraStatus', callback: Callback<CameraStatusInfo\>): void; ### on('cameraStatus')
**System Capabilities:** on(type: 'cameraStatus', callback: AsyncCallback<CameraStatusInfo\>): void
SystemCapability.Multimedia.Camera.Core Listens for camera status changes. This API uses a callback to return the camera status changes.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Listens for camera status changes. This method uses a callback to get camera status changes.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :--------------------------------------------------- | | :------- | :---------------------------------------------------- | :--- | :--------------------------------------------------- |
| type | string | Yes | Camera status event. | | type | string | Yes | Type of event to listen for. The value is fixed at **cameraStatus**, indicating the camera status change event.|
| callback | Callback<CameraStatusInfo\> | Yes | Callback used to get the camera status change. | | callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | Yes | Callback used to return the camera status change. |
**Example** **Example**
...@@ -337,22 +311,20 @@ cameraManager.on('cameraStatus', (cameraStatusInfo) => { ...@@ -337,22 +311,20 @@ cameraManager.on('cameraStatus', (cameraStatusInfo) => {
}) })
``` ```
## Camera<a name="section_Camera"></a> ## 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*.
**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 | **Example**
|----------------|----------------|----------|------------------------|
| cameraId | string | readonly | Camera ID |
| cameraPosition | cameraPosition | readonly | Camera position |
| cameraType | cameraType | readonly | Camera type |
| connectionType | connectionType | readonly | Camera connection type |
``` ```
async function getCameraInfo() { async function getCameraInfo() {
...@@ -367,41 +339,37 @@ async function getCameraInfo() { ...@@ -367,41 +339,37 @@ async function getCameraInfo() {
``` ```
## CameraStatusInfo<a name="section_Camera"></a> ## 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
**Fields** Describes the camera status information.
| Name | Type | Description | **System capability**: SystemCapability.Multimedia.Camera.Core
|----------------|----------------|------------------|
| camera | Camera | Camera object |
| status | CameraStatus | Camera status |
| Name | Type | Description |
| ------ | ----------------------------- | ---------- |
| camera | [Camera](#camera) | Camera object.|
| status | [CameraStatus](#camerastatus) | Camera status.|
## CameraInput<a name="section_CameraInput"></a>
Implements a **CameraInput** instance. ## CameraInput
### getCameraId(callback: AsyncCallback<string\>\): 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<string\>\): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|------------------------|-----------|---------------------------------------| | -------- | ---------------------- | ---- | -------------------------- |
| callback | AsyncCallback<string\> | Yes | Callback used to return the camera ID | | callback | AsyncCallback<string\> | Yes | Callback used to return the camera ID.|
**Example**
``` ```
cameraInput.getCameraId((err, cameraId) => { cameraInput.getCameraId((err, cameraId) => {
...@@ -413,21 +381,19 @@ cameraInput.getCameraId((err, cameraId) => { ...@@ -413,21 +381,19 @@ cameraInput.getCameraId((err, cameraId) => {
}) })
``` ```
### getCameraId(): Promise<string\>; ### getCameraId
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core getCameraId(): Promise<string\>
**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 | | Type | Description |
|------------------------|--------------------------------------| | ---------------- | ----------------------------- |
| Promise<string\> | Promise used to return the camera ID | | Promise<string\> | Promise used to return the camera ID.|
**Example** **Example**
...@@ -437,21 +403,20 @@ cameraInput.getCameraId().then((cameraId) => { ...@@ -437,21 +403,20 @@ cameraInput.getCameraId().then((cameraId) => {
}) })
``` ```
### hasFlash(callback: AsyncCallback<boolean\>): void; <a name="sec_hasFlash"></a>
**System Capabilities:** ### hasFlash
SystemCapability.Multimedia.Camera.Core hasFlash(callback: AsyncCallback<boolean\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|-------------------------|-----------|----------------------------------------------------| | -------- | ----------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback<boolean\> | Yes | Callback used to return the flash light support status | | callback | AsyncCallback<boolean\> | Yes | Callback used to return the flash light support status. The value **true** means that the device has flash light.|
**Example** **Example**
...@@ -465,21 +430,19 @@ cameraInput.hasFlash((err, status) => { ...@@ -465,21 +430,19 @@ cameraInput.hasFlash((err, status) => {
}) })
``` ```
### hasFlash(): Promise<boolean\>; ### hasFlash
**System Capabilities:** hasFlash(): Promise<boolean\>
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 |
| ----------------- | ------------------------------------------------------- |
| Type | Description | | Promise<boolean\> | Promise used to return the flash light support status. The value **true** means that the device has flash light.|
|-----------------------|--------------------------------------------------------|
| Promise<boolean\> | Promise used to return the flash light support status |
**Example** **Example**
...@@ -489,22 +452,20 @@ cameraInput.hasFlash().then((status) => { ...@@ -489,22 +452,20 @@ cameraInput.hasFlash().then((status) => {
}) })
``` ```
### isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback<boolean\>): void; <a name="sec_isFlashModeSupported"></a> ### isFlashModeSupported
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback<boolean\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|------------------------|-----------|----------------------------------------------------| | --------- | ----------------------- | ---- | ---------------------------------------- |
| flashMode | <a href="#sec_FlashMode">FlashMode</a> | Yes | Flash mode | | flashMode | [FlashMode](#flashmode) | Yes | Flash mode. |
| callback | AsyncCallback<boolean\> | Yes | Callback used to return the device flash support status | | callback | AsyncCallback<boolean\> | Yes | Callback used to return the flash mode support status. The value **true** means that the specified flash mode is supported.|
**Example** **Example**
...@@ -518,27 +479,25 @@ cameraInput.isFlashModeSupported(flashMode, (err, status) => { ...@@ -518,27 +479,25 @@ cameraInput.isFlashModeSupported(flashMode, (err, status) => {
}) })
``` ```
### isFlashModeSupported(flashMode: FlashMode): Promise<boolean\>; ### isFlashModeSupported
**System Capabilities:** isFlashModeSupported(flashMode: FlashMode): Promise<boolean\>
SystemCapability.Multimedia.Camera.Core Checks whether a specified flash mode is supported. This API uses a promise to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Checks whether a specified flash mode is supported. This method uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|------------------------|-----------|----------------------------------------------------| | --------- | ----------------------- | ---- | ---------------- |
| flashMode | <a href="#sec_FlashMode">FlashMode</a> | Yes | Flash mode | | flashMode | [FlashMode](#flashmode) | Yes | Flash mode.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|-----------------------|---------------------------------------------------| | ----------------- | ------------------------------------------------------------ |
| Promise<boolean\> | Promise used to return flash mode support status. | | Promise<boolean\> | Promise used to return the flash mode support status. The value **true** means that the specified flash mode is supported.|
**Example** **Example**
...@@ -548,24 +507,25 @@ cameraInput.isFlashModeSupported(flashMode).then((status) => { ...@@ -548,24 +507,25 @@ cameraInput.isFlashModeSupported(flashMode).then((status) => {
}) })
``` ```
### setFlashMode(flashMode: FlashMode, callback: AsyncCallback<void\>): void; ### setFlashMode
**System Capabilities:** setFlashMode(flashMode: FlashMode, callback: AsyncCallback<void\>): 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 (<a href="#sec_hasFlash">hasFlash</a> method) and flash mode support (<a href="#sec_isFlashModeSupported">isFlashModeSupported</a> method); **System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|------------------------|-----------|----------------------------------------------------| | --------- | ----------------------- | ---- | ------------------------ |
| flashMode | <a href="#sec_FlashMode">FlashMode</a> | Yes | Flash mode | | flashMode | [FlashMode](#flashmode) | Yes | Flash mode. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -579,29 +539,30 @@ cameraInput.setFlashMode(flashMode, (err) => { ...@@ -579,29 +539,30 @@ cameraInput.setFlashMode(flashMode, (err) => {
}) })
``` ```
### setFlashMode(flashMode: FlashMode): Promise<void\>; ### setFlashMode
**System Capabilities:** setFlashMode(flashMode: FlashMode): Promise<void\>
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 (<a href="#sec_hasFlash">hasFlash</a> method) and flash mode support (<a href="#sec_isFlashModeSupported">isFlashModeSupported</a> method); **System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|------------------------|-----------|----------------------------------------------------| | --------- | ----------------------- | ---- | ---------------- |
| flashMode | <a href="#sec_FlashMode">FlashMode</a> | Yes | Flash mode | | flashMode | [FlashMode](#flashmode) | Yes | Flash mode.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|-----------------------|-----------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -611,21 +572,19 @@ cameraInput.setFlashMode(flashMode).then(() => { ...@@ -611,21 +572,19 @@ cameraInput.setFlashMode(flashMode).then(() => {
}) })
``` ```
### getFlashMode(callback: AsyncCallback<FlashMode\>): void; ### getFlashMode
**System Capabilities:** getFlashMode(callback: AsyncCallback<FlashMode\>): void
SystemCapability.Multimedia.Camera.Core Obtains the current flash mode. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Gets current flash mode. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|---------------------------|-----------|------------------------------------------------| | -------- | --------------------------------------- | ---- | ---------------------------------------- |
| callback | AsyncCallback<FlashMode\> | Yes | Callback used to return the current flash mode | | callback | AsyncCallback<[FlashMode](#flashmode)\> | Yes | Callback used to return the current flash mode.|
**Example** **Example**
...@@ -639,21 +598,19 @@ cameraInput.getFlashMode((err, flashMode) => { ...@@ -639,21 +598,19 @@ cameraInput.getFlashMode((err, flashMode) => {
}) })
``` ```
### getFlashMode(): Promise<FlashMode\>; ### getFlashMode
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core getFlashMode(): Promise<FlashMode\>
**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 | | Type | Description |
|-----------------------|---------------------------------------------------| | --------------------------------- | --------------------------------------- |
| Promise<FlashMode\> | Promise used to return the flash mode | | Promise<[FlashMode](#flashmode)\> | Promise used to return the current flash mode.|
**Example** **Example**
...@@ -663,22 +620,20 @@ cameraInput.getFlashMode().then((flashMode) => { ...@@ -663,22 +620,20 @@ cameraInput.getFlashMode().then((flashMode) => {
}) })
``` ```
### isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<boolean\>): void; <a name="sec_isFocusModeSupported"></a> ### isFocusModeSupported
**System Capabilities:** isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<boolean\>): void
SystemCapability.Multimedia.Camera.Core Checks whether a specified focus mode is supported. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Checks whether a specified focus mode is supported. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|------------------------|-----------|----------------------------------------------------| | -------- | ----------------------- | ---- | -------------------------------------- |
| afMode | <a href="#sec_FocusMode">FocusMode</a> | Yes | Focus mode | | afMode | [FocusMode](#focusmode) | Yes | Focus mode. |
| callback | AsyncCallback<boolean\> | Yes | Callback used to return the device focus support status | | callback | AsyncCallback<boolean\> | Yes | Callback used to return the focus mode support status. The value **true** means that the specified focus mode is supported.|
**Example** **Example**
...@@ -692,27 +647,25 @@ cameraInput.isFocusModeSupported(afMode, (err, status) => { ...@@ -692,27 +647,25 @@ cameraInput.isFocusModeSupported(afMode, (err, status) => {
}) })
``` ```
### isFocusModeSupported(afMode: FocusMode): Promise<boolean\>; ### isFocusModeSupported
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core isFocusModeSupported(afMode: FocusMode): Promise<boolean\>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|----------------------------------------|-----------|-------------| | ------ | ----------------------- | ---- | ---------------- |
| afMode | <a href="#sec_FocusMode">FocusMode</a> | Yes | Focus mode | | afMode | [FocusMode](#focusmode) | Yes | Focus mode.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|-----------------------|---------------------------------------------------| | ----------------- | ----------------------------------------------------------- |
| Promise<boolean\> | Promise used to return the focus mode support status. | | Promise<boolean\> | Promise used to return the flash mode support status. The value **true** means that the specified focus mode is supported.|
**Example** **Example**
...@@ -722,24 +675,22 @@ cameraInput.isFocusModeSupported(afMode).then((status) => { ...@@ -722,24 +675,22 @@ cameraInput.isFocusModeSupported(afMode).then((status) => {
}) })
``` ```
### setFocusMode(afMode: FocusMode, callback: AsyncCallback<void\>): void; ### setFocusMode
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core setFocusMode(afMode: FocusMode, callback: AsyncCallback<void\>): 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 (<a href="#sec_isFocusModeSupported">isFocusModeSupported</a> method); **System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|------------------------|-----------|------------------------------------| | -------- | ----------------------- | ---- | ------------------------ |
| afMode | <a href="#sec_FocusMode">FocusMode</a> | Yes | Focus mode | | afMode | [FocusMode](#focusmode) | Yes | Focus mode. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -753,29 +704,27 @@ cameraInput.setFocusMode(afMode, (err) => { ...@@ -753,29 +704,27 @@ cameraInput.setFocusMode(afMode, (err) => {
}) })
``` ```
### setFocusMode(afMode: FocusMode): Promise<void\>; ### setFocusMode
**System Capabilities:** setFocusMode(afMode: FocusMode): Promise<void\>
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. **System capability**: SystemCapability.Multimedia.Camera.Core
Note: Before setting the focus mode, check focus mode support (<a href="#sec_isFocusModeSupported">isFocusModeSupported</a> method);
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|-----------------------------------------|-----------|-------------| | ------ | ----------------------- | ---- | ---------------- |
| afMode | <a href="#sec_FocusMode">FocusMode</a> | Yes | Focus mode | | afMode | [FocusMode](#focusmode) | Yes | Focus mode.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|-----------------------|-----------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -785,21 +734,19 @@ cameraInput.setFocusMode(afMode).then(() => { ...@@ -785,21 +734,19 @@ cameraInput.setFocusMode(afMode).then(() => {
}) })
``` ```
### getFocusMode(callback: AsyncCallback<FocusMode\>): void; ### getFocusMode
**System Capabilities:** getFocusMode(callback: AsyncCallback<FocusMode\>): void
SystemCapability.Multimedia.Camera.Core Obtains the current focus mode. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Gets the current focus mode. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|---------------------------|-----------|------------------------------------------------| | -------- | --------------------------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback<FocusMode\> | Yes | Callback used to return the current focus mode | | callback | AsyncCallback<[FocusMode](#focusmode)\> | Yes | Callback used to return the current focus mode.|
**Example** **Example**
...@@ -813,21 +760,19 @@ cameraInput.getFocusMode((err, afMode) => { ...@@ -813,21 +760,19 @@ cameraInput.getFocusMode((err, afMode) => {
}) })
``` ```
### getFocusMode(): Promise<FocusMode\>; ### getFocusMode
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core getFocusMode(): Promise<FocusMode\>
**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 | | Type | Description |
|-----------------------|---------------------------------------------------| | ------------------- | ------------------------------------- |
| Promise<FocusMode\> | Promise used to return the focus mode | | Promise<FocusMode\> | Promise used to return the current focus mode.|
**Example** **Example**
...@@ -837,21 +782,19 @@ cameraInput.getFocusMode().then((afMode) => { ...@@ -837,21 +782,19 @@ cameraInput.getFocusMode().then((afMode) => {
}) })
``` ```
### getZoomRatioRange\(callback: AsyncCallback<Array<number\>\>\): void; ### getZoomRatioRange
**System Capabilities:** getZoomRatioRange\(callback: AsyncCallback<Array<number\>\>\): void
SystemCapability.Multimedia.Camera.Core Obtains the zoom ratio range. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Gets the zoom ratios of all zoom values. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|--------------------------------|-----------|-------------------------------------------------| | -------- | ------------------------------ | ---- | ------------------------ |
| callback | AsyncCallback<Array<number\>\> | Yes | Callback used to return the zoom ratio range | | callback | AsyncCallback<Array<number\>\> | Yes | Callback used to return the zoom ratio range.|
**Example** **Example**
...@@ -865,21 +808,19 @@ cameraInput.getZoomRatioRange((err, zoomRatioRange) => { ...@@ -865,21 +808,19 @@ cameraInput.getZoomRatioRange((err, zoomRatioRange) => {
}) })
``` ```
### getZoomRatioRange\(\): Promise<Array<number\>\>; ### getZoomRatioRange
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core getZoomRatioRange\(\): Promise<Array<number\>\>
**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 | | Type | Description |
|------------------------|---------------------------------------------| | ------------------------ | ------------------------------------------- |
| Promise<Array<number\>\> | Promise used to return the zoom ratio range | | Promise<Array<number\>\> | Promise used to return the zoom ratio range.|
**Example** **Example**
...@@ -889,22 +830,20 @@ cameraInput.getZoomRatioRange().then((zoomRatioRange) => { ...@@ -889,22 +830,20 @@ cameraInput.getZoomRatioRange().then((zoomRatioRange) => {
}) })
``` ```
### setZoomRatio(zoomRatio: number, callback: AsyncCallback<void\>): void; ### setZoomRatio
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core setZoomRatio(zoomRatio: number, callback: AsyncCallback<void\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|------------------------|-----------|------------------------------------| | --------- | -------------------- | ---- | ------------------------ |
| zoomRatio | number | Yes | Zoom ratio | | zoomRatio | number | Yes | Zoom ratio to set. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -918,27 +857,25 @@ cameraInput.setZoomRatio(zoomRatio, (err) => { ...@@ -918,27 +857,25 @@ cameraInput.setZoomRatio(zoomRatio, (err) => {
}) })
``` ```
### setZoomRatio(zoomRatio: number): Promise<void\>; ### setZoomRatio
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core setZoomRatio(zoomRatio: number): Promise<void\>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|----------|-----------|-------------| | --------- | ------ | ---- | ------------ |
| zoomRatio | number | Yes | zoom ratio | | zoomRatio | number | Yes | Zoom ratio to set.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|-----------------------|-----------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -948,21 +885,19 @@ cameraInput.setZoomRatio(zoomRatio).then(() => { ...@@ -948,21 +885,19 @@ cameraInput.setZoomRatio(zoomRatio).then(() => {
}) })
``` ```
### getZoomRatio(callback: AsyncCallback<number\>): void; ### getZoomRatio
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core getZoomRatio(callback: AsyncCallback<number\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-----------|---------------------------|-----------|------------------------------------------------------| | -------- | ---------------------- | ---- | ------------------------ |
| callback | AsyncCallback<number\> | Yes | Callback used to return the current zoom ratio value | | callback | AsyncCallback<number\> | Yes | Callback used to return the current zoom ratio.|
**Example** **Example**
...@@ -976,21 +911,19 @@ cameraInput.getZoomRatio((err, zoomRatio) => { ...@@ -976,21 +911,19 @@ cameraInput.getZoomRatio((err, zoomRatio) => {
}) })
``` ```
### getZoomRatio(): Promise<number\>; ### getZoomRatio
**System Capabilities:** getZoomRatio(): Promise<number\>
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 |
| ---------------- | --------------------------- |
| Type | Description | | Promise<number\> | Promise used to return the current zoom ratio.|
|-----------------------|---------------------------------------------------|
| Promise<number\> | Promise used to return the zoom ratio vaule |
**Example** **Example**
...@@ -1000,26 +933,24 @@ cameraInput.getZoomRatio().then((zoomRatio) => { ...@@ -1000,26 +933,24 @@ cameraInput.getZoomRatio().then((zoomRatio) => {
}) })
``` ```
### release\(callback: AsyncCallback<void\>\): void; ### release
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core release\(callback: AsyncCallback<void\>\): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
``` ```
cameraInput.release((err) => { camera.release((err) => {
if (err) { if (err) {
console.error('Failed to release the CameraInput instance ${err.message}'); console.error('Failed to release the CameraInput instance ${err.message}');
return; return;
...@@ -1028,21 +959,19 @@ cameraInput.release((err) => { ...@@ -1028,21 +959,19 @@ cameraInput.release((err) => {
}); });
``` ```
### release(): Promise<void\>; ### release
**System Capabilities:** release(): Promise<void\>
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 |
| -------------- | --------------------------- |
| Type | Description | | Promise<void\> | Promise used to return the result.|
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
**Example** **Example**
...@@ -1052,22 +981,20 @@ cameraInput.release().then(() => { ...@@ -1052,22 +981,20 @@ cameraInput.release().then(() => {
}) })
``` ```
### on(type: 'focusStateChange', callback: Callback<FocusState\>): void; ### on('focusStateChange')
**System Capabilities:** on(type: 'focusStateChange', callback: AsyncCallback<FocusState\>): void
SystemCapability.Multimedia.Camera.Core Listens for focus state changes. This API uses a callback to return the focus state changes.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Listens for focus state changes. This method uses a callback to get focus state changes.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------| | :------- | :---------------------------------------- | :--- | :------------------------------------------------------- |
| type | string | Yes | Name of the event to listen for. | | type | string | Yes | Type of event to listen for. The value is fixed at **focusStateChange**, indicating the focus state change event.|
| callback | Callback<FocusState\> | Yes | Callback used to get the focus state change. | | callback | AsyncCallback<[FocusState](#focusstate)\> | Yes | Callback used to return the focus state change. |
**Example** **Example**
...@@ -1077,22 +1004,20 @@ cameraInput.on('focusStateChange', (focusState) => { ...@@ -1077,22 +1004,20 @@ cameraInput.on('focusStateChange', (focusState) => {
}) })
``` ```
### on(type: 'error', callback: Callback<CameraInputError\>): void; ### on('error')
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core on(type: 'error', callback: ErrorCallback<CameraInputError\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------| | :------- | :------------------------------- | :--- | :---------------------------------------------- |
| type | string | Yes | Camera input error event. | | type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the camera input error event.|
| callback | Callback<CameraInputError\> | Yes | Callback used to get the camera input errors. | | callback | ErrorCallback<CameraInputError\> | Yes | Callback used to return the capture input errors. |
**Example** **Example**
...@@ -1102,57 +1027,64 @@ cameraInput.on('error', (cameraInputError) => { ...@@ -1102,57 +1027,64 @@ cameraInput.on('error', (cameraInputError) => {
}) })
``` ```
## FlashMode <a name="sec_FlashMode"></a>
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 | | Name | Default Value| Description |
|------------------------|---------------|------------------------| | ---------------------- | ------ | ------------ |
| FLASH_MODE_CLOSE | 0 | Flash mode close | | FLASH_MODE_CLOSE | 0 | The flash is off.|
| FLASH_MODE_OPEN | 1 | Flash mode open | | FLASH_MODE_OPEN | 1 | The flash is on.|
| FLASH_MODE_AUTO | 2 | Flash mode auto | | 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 | Flash mode always open | | FLASH_MODE_ALWAYS_OPEN | 3 | The flash is steady on.|
## FocusMode <a name="sec_FocusMode"></a> ## FocusMode
Enumerates the focus modes. 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 | Enumerates the focus states.
|----------------------------|---------------|----------------------------|
| 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 |
## createCaptureSession\(context: Context, callback: AsyncCallback<CaptureSession\>\): 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<CaptureSession\>\): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|--------------------------------|-----------|-----------------------------------------------------| | -------- | ------------------------------------------------- | ---- | -------------------------------------- |
| context | Context | Yes | Application context | | context | Context | Yes | Application context. |
| callback | AsyncCallback<CaptureSession\> | Yes | Callback used to return the CaptureSession instance | | callback | AsyncCallback<[CaptureSession](#capturesession)\> | Yes | Callback used to return the **CaptureSession** instance.|
**Example** **Example**
``` ```
captureSession.createCaptureSession((context), (err, captureSession) => { camera.createCaptureSession((context), (err, captureSession) => {
if (err) { if (err) {
console.error('Failed to create the CaptureSession instance. ${err.message}'); console.error('Failed to create the CaptureSession instance. ${err.message}');
return; return;
...@@ -1161,55 +1093,51 @@ captureSession.createCaptureSession((context), (err, captureSession) => { ...@@ -1161,55 +1093,51 @@ captureSession.createCaptureSession((context), (err, captureSession) => {
}); });
``` ```
## createCaptureSession(context: Context\): Promise<CaptureSession\>; ## camera.createCaptureSession
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core createCaptureSession(context: Context\): Promise<CaptureSession\>;
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|-------------------------------|-----------|-----------------------------------------------------| | ------- | ------- | ---- | ------------ |
| context | Context | Yes | Application context | | context | Context | Yes | Application context.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|---------------------------|---------------------------------------------------| | ------------------------------------------- | ----------------------------------------- |
| Promise<CaptureSession\> | Promise used to return the CaptureSession instance. | | Promise<[CaptureSession](#capturesession)\> | Promise used to return the **CaptureSession** instance.|
**Example** **Example**
``` ```
captureSession.createCaptureSession(context).then((captureSession) => { camera.createCaptureSession(context).then((captureSession) => {
console.log('Promise returned with the CaptureSession instance'); console.log('Promise returned with the CaptureSession instance');
}) })
``` ```
## CaptureSession<a name="sec_CaptureSession"></a> ## CaptureSession
Implements session capture. Implements session capture.
### beginConfig\(callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a> ### beginConfig
**System Capabilities:** beginConfig\(callback: AsyncCallback<void\>\): void
SystemCapability.Multimedia.Camera.Core Starts configuration for this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Starts configuration for this CaptureSession instance. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|----------------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -1223,21 +1151,19 @@ captureSession.beginConfig((err) => { ...@@ -1223,21 +1151,19 @@ captureSession.beginConfig((err) => {
}); });
``` ```
### beginConfig\(\): Promise<void\>; ### beginConfig
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core beginConfig\(\): Promise<void\>
**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 | | Type | Description |
|---------------|---------------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -1248,21 +1174,19 @@ captureSession.beginConfig().then(() => { ...@@ -1248,21 +1174,19 @@ captureSession.beginConfig().then(() => {
}) })
``` ```
### commitConfig\(callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a> ### commitConfig
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core commitConfig\(callback: AsyncCallback<void\>\): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|---------------------|-----------|----------------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -1276,21 +1200,19 @@ captureSession.commitConfig((err) => { ...@@ -1276,21 +1200,19 @@ captureSession.commitConfig((err) => {
}); });
``` ```
### commitConfig\(\): Promise<void\>;<a name="section189141826104616"></a> ### commitConfig
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core commitConfig\(\): Promise<void\>
**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 | | Type | Description |
|---------------|---------------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -1300,22 +1222,20 @@ captureSession.commitConfig().then(() => { ...@@ -1300,22 +1222,20 @@ captureSession.commitConfig().then(() => {
}) })
``` ```
### addInput\(cameraInput: CameraInput, callback: AsyncCallback<void\>\): void; ### addInput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core addInput\(cameraInput: CameraInput, callback: AsyncCallback<void\>\): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-------------|----------------------|-----------|---------------------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| cameraInput | CameraInput | Yes | CameraInput instance to add | | cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -1329,27 +1249,25 @@ captureSession.addInput(cameraInput, (err) => { ...@@ -1329,27 +1249,25 @@ captureSession.addInput(cameraInput, (err) => {
}); });
``` ```
### addInput\(cameraInput: CameraInput\): Promise<void\>;<a name="section189141826104616"></a> ### addInput
**System Capabilities:** addInput\(cameraInput: CameraInput\): Promise<void\>
SystemCapability.Multimedia.Camera.Core Adds a **CameraInput** instance to this **CaptureSession** instance. This API uses a promise to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Add a CameraInput instance to this CaptureSession instance. This method uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-------------|---------------------|-----------|-------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| cameraInput | CameraInput | Yes | CameraInput instance to add | | cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|----------------|------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -1359,22 +1277,20 @@ captureSession.addInput(cameraInput).then(() => { ...@@ -1359,22 +1277,20 @@ captureSession.addInput(cameraInput).then(() => {
}) })
``` ```
### addOutput\(previewOutput: PreviewOutput, callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a> ### addOutput
**System Capabilities:** addOutput\(previewOutput: PreviewOutput, callback: AsyncCallback<void\>\): void
SystemCapability.Multimedia.Camera.Core Adds a **PreviewOutput** instance to this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Add a PreviewOutput instance to this CaptureSession instance. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|----------------------|-----------|-------------------------------------| | ------------- | ------------------------------- | ---- | ----------------------------- |
| previewOutput | PreviewOutput | Yes | PreviewOutput instance to add | | previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to add.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -1388,27 +1304,25 @@ captureSession.addOutput(previewOutput, (err) => { ...@@ -1388,27 +1304,25 @@ captureSession.addOutput(previewOutput, (err) => {
}); });
``` ```
### addOutput\(previewOutput: PreviewOutput\): Promise<void\>;<a name="section189141826104616"></a> ### addOutput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core addOutput\(previewOutput: PreviewOutput\): Promise<void\>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|---------------------|-----------|--------------------------------| | ------------- | ------------------------------- | ---- | ----------------------------- |
| previewOutput | PreviewOutput | Yes | PreviewOutput instance to add | | previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to add.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|----------------|-----------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -1418,22 +1332,20 @@ captureSession.addOutput(previewOutput).then(() => { ...@@ -1418,22 +1332,20 @@ captureSession.addOutput(previewOutput).then(() => {
}) })
``` ```
### addOutput\(photoOutput: PhotoOutput, callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a> ### addOutput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core addOutput\(photoOutput: PhotoOutput, callback: AsyncCallback<void\>\): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|---------------------|-----------|-------------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| photoOutput | PhotoOutput | Yes | PhotoOutput instance to add | | photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to add.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -1447,27 +1359,25 @@ captureSession.addOutput(photoOutput, (err) => { ...@@ -1447,27 +1359,25 @@ captureSession.addOutput(photoOutput, (err) => {
}); });
``` ```
### addOutput\(photoOutput: PhotoOutput\): Promise<void\>;<a name="section189141826104616"></a> ### addOutput
**System Capabilities:** addOutput\(photoOutput: PhotoOutput\): Promise<void\>
SystemCapability.Multimedia.Camera.Core Adds a **PhotoOutput** instance to this **CaptureSession** instance. This API uses a promise to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Add a PhotoOutput instance to this CaptureSession instance. This method uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|---------------------|-----------|--------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| photoOutput | PhotoOutput | Yes | PhotoOutput instance to add | | photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to add.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|---------------|-----------------------------------| | -------------- | --------------------------- |
| Promise<void> | Promise used to return the result | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -1477,22 +1387,20 @@ captureSession.addOutput(photoOutput).then(() => { ...@@ -1477,22 +1387,20 @@ captureSession.addOutput(photoOutput).then(() => {
}) })
``` ```
### addOutput\(videoOutput: VideoOutput, callback: AsyncCallback<void\>\): void; ### addOutput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core addOutput\(videoOutput: VideoOutput, callback: AsyncCallback<void\>\): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|---------------------|-----------|-------------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| videoOutput | VideoOutput | Yes | VideoOutput instance to add | | videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to add.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -1506,27 +1414,25 @@ captureSession.addOutput(videoOutput, (err) => { ...@@ -1506,27 +1414,25 @@ captureSession.addOutput(videoOutput, (err) => {
}); });
``` ```
### addOutput\(videoOutput: VideoOutput\): Promise<void\>; ### addOutput
**System Capabilities:** addOutput\(videoOutput: VideoOutput\): Promise<void\>
SystemCapability.Multimedia.Camera.Core Adds a **VideoOutput** instance to this **CaptureSession** instance. This API uses a promise to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Add a VideoOutput instance to this CaptureSession instance. This method uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|---------------------|-----------|--------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| videoOutput | VideoOutput | Yes | VideoOutput instance to add | | videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to add.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|----------------|-----------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -1536,22 +1442,20 @@ captureSession.addOutput(videoOutput).then(() => { ...@@ -1536,22 +1442,20 @@ captureSession.addOutput(videoOutput).then(() => {
}) })
``` ```
### removeInput\(cameraInput: CameraInput, callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a> ### removeInput
**System Capabilities:** removeInput\(cameraInput: CameraInput, callback: AsyncCallback<void\>\): void
SystemCapability.Multimedia.Camera.Core Removes a **CameraInput** instance from this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Removes a **CameraInput** instance from this **CaptureSession** instance. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-------------|----------------------|-----------|------------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| cameraInput | CameraInput | Yes | CameraInput instance to remove | | cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to remove.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -1565,27 +1469,25 @@ captureSession.removeInput(cameraInput, (err) => { ...@@ -1565,27 +1469,25 @@ captureSession.removeInput(cameraInput, (err) => {
}); });
``` ```
### removeInput\(cameraInput: CameraInput\): Promise<void\>;<a name="section189141826104616"></a> ### removeInput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core removeInput\(cameraInput: CameraInput\): Promise<void\>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|-------------|---------------------|-----------|---------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| cameraInput | CameraInput | Yes | CameraInput instance to remove | | cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to remove.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|----------------|-----------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -1595,22 +1497,20 @@ captureSession.removeInput(cameraInput).then(() => { ...@@ -1595,22 +1497,20 @@ captureSession.removeInput(cameraInput).then(() => {
}) })
``` ```
### removeOutput\(previewOutput: PreviewOutput, callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a> ### removeOutput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core removeOutput\(previewOutput: PreviewOutput, callback: AsyncCallback<void\>\): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|----------------------|-----------|------------------------------------| | ------------- | ------------------------------- | ---- | ----------------------------- |
| previewOutput | PreviewOutput | Yes | PreviewOutput instance to remove | | previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to remove.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -1624,28 +1524,26 @@ captureSession.removeOutput(previewOutput, (err) => { ...@@ -1624,28 +1524,26 @@ captureSession.removeOutput(previewOutput, (err) => {
}); });
``` ```
### removeOutput(previewOutput: PreviewOutput): Promise<void\>; ### removeOutput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core removeOutput(previewOutput: PreviewOutput): Promise<void\>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|---------------------|-----------|-----------------------------------| | ------------- | ------------------------------- | ---- | ----------------------------- |
| previewOutput | PreviewOutput | Yes | PreviewOutput instance to remove | | previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to remove.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|---------------|---------------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -1656,22 +1554,20 @@ captureSession.removeOutput(previewOutput).then(() => { ...@@ -1656,22 +1554,20 @@ captureSession.removeOutput(previewOutput).then(() => {
}) })
``` ```
### removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback<void\>): void; ### removeOutput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback<void\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|----------------------|-----------|------------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| photoOutput | PhotoOutput | Yes | PhotoOutput instance to remove | | photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to remove.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -1685,28 +1581,26 @@ captureSession.removeOutput(photoOutput, (err) => { ...@@ -1685,28 +1581,26 @@ captureSession.removeOutput(photoOutput, (err) => {
}); });
``` ```
### removeOutput(photoOutput: PhotoOutput): Promise<void\>; ### removeOutput
**System Capabilities:** removeOutput(photoOutput: PhotoOutput): Promise<void\>
SystemCapability.Multimedia.Camera.Core Removes a **PhotoOutput** instance from this **CaptureSession** instance. This API uses a promise to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Removes a **PhotoOutput** instance from this **CaptureSession** instance. This method uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|---------------------|-----------|---------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| photoOutput | PhotoOutput | Yes | PhotoOutput instance to remove | | photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to remove.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|---------------|------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -1717,22 +1611,20 @@ captureSession.removeOutput(photoOutput).then(() => { ...@@ -1717,22 +1611,20 @@ captureSession.removeOutput(photoOutput).then(() => {
}) })
``` ```
### removeOutput(videoOutput: VideoOutput, callback: AsyncCallback<void\>): void; ### removeOutput
**System Capabilities:** removeOutput(videoOutput: VideoOutput, callback: AsyncCallback<void\>): void
SystemCapability.Multimedia.Camera.Core Removes a **VideoOutput** instance from this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Removes a **VideoOutput** instance from this **CaptureSession** instance. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|----------------------|-----------|------------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| videoOutput | VideoOutput | Yes | VideoOutput instance to remove | | videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to remove.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -1746,28 +1638,26 @@ captureSession.removeOutput(videoOutput, (err) => { ...@@ -1746,28 +1638,26 @@ captureSession.removeOutput(videoOutput, (err) => {
}); });
``` ```
### removeOutput(videoOutput: VideoOutput): Promise<void\>; ### removeOutput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core removeOutput(videoOutput: VideoOutput): Promise<void\>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|---------------|---------------------|-----------|---------------------------------| | ----------- | --------------------------- | ---- | --------------------------- |
| videoOutput | VideoOutput | Yes | VideoOutput instance to remove | | videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to remove.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|----------------|---------------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -1778,21 +1668,19 @@ captureSession.removeOutput(videoOutput).then(() => { ...@@ -1778,21 +1668,19 @@ captureSession.removeOutput(videoOutput).then(() => {
}) })
``` ```
### start\(callback: AsyncCallback<void\>\): void; ### start
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core start\(callback: AsyncCallback<void\>\): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|----------------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -1806,21 +1694,19 @@ captureSession.start((err) => { ...@@ -1806,21 +1694,19 @@ captureSession.start((err) => {
}); });
``` ```
### start\(\): Promise<void\>;<a name="section189141826104616"></a> ### start
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core start\(\): Promise<void\>
**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 | | Type | Description |
|----------------|-----------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -1830,22 +1716,20 @@ captureSession.start().then(() => { ...@@ -1830,22 +1716,20 @@ captureSession.start().then(() => {
}) })
``` ```
### stop\(callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a> ### stop
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core stop\(callback: AsyncCallback<void\>\): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -1859,21 +1743,19 @@ captureSession.stop((err) => { ...@@ -1859,21 +1743,19 @@ captureSession.stop((err) => {
}); });
``` ```
### stop(): Promise<void\>; ### stop
**System Capabilities:** stop(): Promise<void\>
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 |
| -------------- | --------------------------- |
| Type | Description | | Promise<void\> | Promise used to return the result.|
|----------------|-----------------------------------|
| Promise<void\> | Promise used to return the result |
**Example** **Example**
...@@ -1883,21 +1765,19 @@ captureSession.stop().then(() => { ...@@ -1883,21 +1765,19 @@ captureSession.stop().then(() => {
}) })
``` ```
### release\(callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a> ### release
**System Capabilities:** release\(callback: AsyncCallback<void\>\): void
SystemCapability.Multimedia.Camera.Core Releases this **CaptureSession** instance. This API uses an asynchronous callback to return the instance.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Releases this **CaptureSession** instance. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -1911,21 +1791,19 @@ captureSession.release((err) => { ...@@ -1911,21 +1791,19 @@ captureSession.release((err) => {
}); });
``` ```
### release(): Promise<void\>; ### release
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core release(): Promise<void\>
**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 | | Type | Description |
|----------------|---------------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -1935,22 +1813,20 @@ captureSession.release().then(() => { ...@@ -1935,22 +1813,20 @@ captureSession.release().then(() => {
}) })
``` ```
### on(type: 'error', callback: Callback<CaptureSessionError\>): void; ### on('error')
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core on(type: 'error', callback: ErrorCallback<CaptureSessionError\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------| | :------- | :---------------------------------- | :--- | :-------------------------------------------- |
| type | string | Yes | Capture session error event. | | type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the capture session error event.|
| callback | Callback<CaptureSessionError\> | Yes | Callback used to get the capture session errors. | | callback | ErrorCallback<CaptureSessionError\> | Yes | Callback used to return the capture session errors. |
**Example** **Example**
...@@ -1960,22 +1836,20 @@ captureSession.on('error', (captureSessionError) => { ...@@ -1960,22 +1836,20 @@ captureSession.on('error', (captureSessionError) => {
}) })
``` ```
## createPreviewOutput(surfaceId: string, callback: AsyncCallback<PreviewOutput\>): void; ## camera.createPreviewOutput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core createPreviewOutput(surfaceId: string, callback: AsyncCallback<PreviewOutput\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|------------|-------------------------------|-----------|----------------------------------------------------| | --------- | ----------------------------------------------- | ---- | ------------------------------------- |
| surfaceId | string | Yes | Surface ID received from XComponent view | | surfaceId | string | Yes | Surface ID received from **XComponent**. |
| callback | AsyncCallback<PreviewOutput\> | Yes | Callback used to return the PreviewOutput instance | | callback | AsyncCallback<[PreviewOutput](#previewoutput)\> | Yes | Callback used to return the **PreviewOutput** instance.|
**Example** **Example**
...@@ -1987,29 +1861,27 @@ camera.createPreviewOutput((surfaceId), (err, previewOutput) => { ...@@ -1987,29 +1861,27 @@ camera.createPreviewOutput((surfaceId), (err, previewOutput) => {
} }
console.log('Callback returned with previewOutput instance'); console.log('Callback returned with previewOutput instance');
}); });
``` ```
## createPreviewOutput(surfaceId: string): Promise<PreviewOutput>;
**System Capabilities:** ## camera.createPreviewOutput
SystemCapability.Multimedia.Camera.Core createPreviewOutput(surfaceId: string): Promise\<PreviewOutput>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|------------|-----------------|-----------|----------------------------------------------------| | --------- | ------ | ---- | ---------------------------------- |
| surfaceId | string | Yes | Surface ID received from XComponent view | | surfaceId | string | Yes | Surface ID received from **XComponent**.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|-------------------------|---------------------------------------------------| | ----------------------------------------- | --------------------------- |
| Promise<PreviewOutput\> | Promise used to return the PreviewOutput instance | | Promise<[PreviewOutput](#previewoutput)\> | Promise used to return the **PreviewOutput** instance.|
**Example** **Example**
...@@ -2023,21 +1895,19 @@ camera.createPreviewOutput(surfaceId).then((previewOutput) => { ...@@ -2023,21 +1895,19 @@ camera.createPreviewOutput(surfaceId).then((previewOutput) => {
Implements preview output. Implements preview output.
### release(callback: AsyncCallback<void\>): void; ### release
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core release(callback: AsyncCallback<void\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|----------------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -2051,21 +1921,19 @@ previewOutput.release((err) => { ...@@ -2051,21 +1921,19 @@ previewOutput.release((err) => {
}); });
``` ```
### release(): Promise<void\>; ### release
**System Capabilities:** release(): Promise<void\>
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 |
| -------------- | --------------------------- |
| Type | Description | | Promise<void\> | Promise used to return the result.|
|----------------|-----------------------------------|
| Promise<void\> | Promise used to return the result |
**Example** **Example**
...@@ -2076,22 +1944,20 @@ previewOutput.release().then(() => { ...@@ -2076,22 +1944,20 @@ previewOutput.release().then(() => {
}) })
``` ```
### on(type: 'frameStart', callback: Callback<number\>): void; ### on('frameStart')
**System Capabilities:** on(type: 'frameStart', callback: AsyncCallback<void\>): void
SystemCapability.Multimedia.Camera.Core Listens for preview frame start events. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Listens for preview frame start events. This method uses a callback to get the event information.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :---------------- | :-------- | :----------------------------------| | :------- | :------------------- | :--- | :------------------------------------------- |
| type | string | Yes | Name of the event to listen for. | | type | string | Yes | Type of event to listen for. The value is fixed at **frameStart**, indicating the preview frame start event.|
| callback | Callback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -2101,22 +1967,20 @@ previewOutput.on('frameStart', () => { ...@@ -2101,22 +1967,20 @@ previewOutput.on('frameStart', () => {
}) })
``` ```
### on(type: 'frameEnd', callback: Callback<number\>): void; ### on('frameEnd')
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core on(type: 'frameEnd', callback: AsyncCallback<void\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :---------------- | :-------- | :----------------------------------| | :------- | :------------------- | :--- | :----------------------------------------- |
| type | string | Yes | Name of the event to listen for. | | type | string | Yes | Type of event to listen for. The value is fixed at **frameEnd**, indicating the preview frame end event.|
| callback | Callback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -2126,22 +1990,20 @@ previewOutput.on('frameEnd', () => { ...@@ -2126,22 +1990,20 @@ previewOutput.on('frameEnd', () => {
}) })
``` ```
### on(type: 'error', callback: Callback<PreviewOutputError\>): void; ### on('error')
**System Capabilities:** on(type: 'error', callback: ErrorCallback<PreviewOutputError\>): void
SystemCapability.Multimedia.Camera.Core Listens for **PreviewOutput** errors. This API uses a callback to return the errors.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Listens for **PreviewOutput** errors. This method uses a callback to get errors.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------| | :------- | :--------------------------------- | :--- | :-------------------------------------------- |
| type | string | Yes | Preview output error event. | | type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the preview output error event.|
| callback | Callback<PreviewOutputError\> | Yes | Callback used to get the preview output errors. | | callback | ErrorCallback<PreviewOutputError\> | Yes | Callback used to return the preview output errors. |
**Example** **Example**
...@@ -2151,22 +2013,20 @@ previewOutput.on('error', (previewOutputError) => { ...@@ -2151,22 +2013,20 @@ previewOutput.on('error', (previewOutputError) => {
}) })
``` ```
## createPhotoOutput(surfaceId: string, callback: AsyncCallback<PhotoOutput\>): void; ## camera.createPhotoOutput
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core createPhotoOutput(surfaceId: string, callback: AsyncCallback<PhotoOutput\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|------------|-------------------------------|-----------|----------------------------------------------------| | --------- | ------------------------------------------- | ---- | ----------------------------------- |
| surfaceId | string | Yes | Surface ID received from ImageReceiver | | surfaceId | string | Yes | Surface ID received from **ImageReceiver**. |
| callback | AsyncCallback<PhotoOutput\> | Yes | Callback used to return the PhotoOutput instance | | callback | AsyncCallback<[PhotoOutput](#photooutput)\> | Yes | Callback used to return the **PhotoOutput** instance.|
**Example** **Example**
...@@ -2178,29 +2038,27 @@ camera.createPhotoOutput((surfaceId), (err, photoOutput) => { ...@@ -2178,29 +2038,27 @@ camera.createPhotoOutput((surfaceId), (err, photoOutput) => {
} }
console.log('Callback returned with the PhotoOutput instance.'); console.log('Callback returned with the PhotoOutput instance.');
}); });
``` ```
## createPhotoOutput(surfaceId: string): Promise<PhotoOutput\>;
**System Capabilities:** ## camera.createPhotoOutput
SystemCapability.Multimedia.Camera.Core createPhotoOutput(surfaceId: string): Promise<PhotoOutput\>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|------------|-----------------|-----------|----------------------------------------------------| | --------- | ------ | ---- | --------------------------------- |
| surfaceId | string | Yes | Surface ID received from ImageReceiver | | surfaceId | string | Yes | Surface ID received from **ImageReceiver**.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|-------------------------|--------------------------------------------------| | ------------------------------------- | -------------------------------------- |
| Promise<PhotoOutput\> | Promise used to return the PhotoOutput instance | | Promise<[PhotoOutput](#photooutput)\> | Promise used to return the **PhotoOutput** instance.|
**Example** **Example**
...@@ -2213,79 +2071,59 @@ camera.createPhotoOutput(surfaceId).then((photoOutput) => { ...@@ -2213,79 +2071,59 @@ camera.createPhotoOutput(surfaceId).then((photoOutput) => {
Enumerates the image rotation angles. Enumerates the image rotation angles.
**System Capabilities:** **System capability**: SystemCapability.Multimedia.Camera.Core
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 |
| 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 ## QualityLevel
Enumerates the image quality levels. Enumerates the image quality levels.
**System Capabilities:** **System capability**: SystemCapability.Multimedia.Camera.Core
SystemCapability.Multimedia.Camera.Core | Name | Default Value| Description |
| -------------------- | ------ | -------------- |
| Name | Default value | Description | | QUALITY_LEVEL_HIGH | 0 | High image quality. |
|----------------------|---------------|----------------------| | QUALITY_LEVEL_MEDIUM | 1 | Medium image quality.|
| QUALITY_LEVEL_HIGH | 0 | High image quality | | QUALITY_LEVEL_LOW | 2 | Low image quality. |
| QUALITY_LEVEL_MEDIUM | 1 | Medium image quality |
| QUALITY_LEVEL_LOW | 2 | Low image quality |
## PhotoCaptureSetting ## PhotoCaptureSetting
Defines the settings for image capture. Defines the settings for image capture.
**System Capabilities:** **System capability**: SystemCapability.Multimedia.Camera.Core
SystemCapability.Multimedia.Camera.Core
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|---------------|-----------|---------------------| | -------- | ------------------------------- | ---- | -------------- |
| quality | QualityLevel | Optional | Photo image quality | | quality | [QualityLevel](#qualitylevel) | No | Photo image quality. |
| rotation | ImageRotation | Optional | Photo rotation | | rotation | [ImageRotation](#imagerotation) | No | Photo rotation.|
## PhotoOutput ## PhotoOutput
Implements photo output. Implements photo output.
### capture(callback: AsyncCallback<void\>): void; ### capture
**System Capabilities:** capture(callback: AsyncCallback<void\>): void
SystemCapability.Multimedia.Camera.Core Captures a photo. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Captures a photo. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|---------------------|-----------|----------------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -2299,22 +2137,20 @@ photoOutput.capture((err) => { ...@@ -2299,22 +2137,20 @@ photoOutput.capture((err) => {
}); });
``` ```
### capture(setting: PhotoCaptureSetting, callback: AsyncCallback<void\>): void; ### capture
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core capture(setting: PhotoCaptureSetting, callback: AsyncCallback<void\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|----------------------------------------------| | -------- | ------------------------------------------- | ---- | ------------------------ |
| setting | PhotoCaptureSetting | Yes | Photo capture settings | | setting | [PhotoCaptureSetting](#photocapturesetting) | Yes | Photo capture settings. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -2328,27 +2164,25 @@ photoOutput.capture(settings, (err) => { ...@@ -2328,27 +2164,25 @@ photoOutput.capture(settings, (err) => {
}); });
``` ```
### capture(setting?: PhotoCaptureSetting): Promise<void\>; ### capture
**System Capabilities:** capture(setting?: PhotoCaptureSetting): Promise<void\>
SystemCapability.Multimedia.Camera.Core Captures a photo with the specified capture settings. This API uses a promise to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Captures a photo with the specified capture settings. This method uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|---------------------|-----------|----------------------------------------------| | ------- | ------------------------------------------- | ---- | ---------- |
| setting | PhotoCaptureSetting | No | Photo capture settings | | setting | [PhotoCaptureSetting](#photocapturesetting) | No | Photo capture settings.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|----------------|---------------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -2359,21 +2193,19 @@ photoOutput.capture().then(() => { ...@@ -2359,21 +2193,19 @@ photoOutput.capture().then(() => {
}) })
``` ```
### release(callback: AsyncCallback<void\>): void; ### release
**System Capabilities:** release(callback: AsyncCallback<void\>): void
SystemCapability.Multimedia.Camera.Core Releases this **PhotoOutput** instance. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Releases this **PhotoOutput** instance. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|----------------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -2387,21 +2219,19 @@ photoOutput.release((err) => { ...@@ -2387,21 +2219,19 @@ photoOutput.release((err) => {
}); });
``` ```
### release(): Promise<void\>; ### release
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core release(): Promise<void\>
**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 | | Type | Description |
|----------------|---------------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -2412,22 +2242,20 @@ photoOutput.release().then(() => { ...@@ -2412,22 +2242,20 @@ photoOutput.release().then(() => {
}) })
``` ```
### on(type: 'captureStart', callback: Callback<number\>): void; ### on('captureStart')
**System Capabilities:** on(type: 'captureStart', callback: AsyncCallback<number\>): void
SystemCapability.Multimedia.Camera.Core Listens for photo capture start events. This API uses a callback to return the event information.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Listens for photo capture start events. This method uses a callback to get the event information.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------| | :------- | :--------------------- | :--- | :----------------------------------------------- |
| type | string | Yes | Name of the event to listen for. | | type | string | Yes | Type of event to listen for. The value is fixed at **captureStart**, indicating the photo capture start event.|
| callback | Callback<number\> | Yes | Callback used to get the capture ID. | | callback | AsyncCallback<number\> | Yes | Callback used to return the capture ID. |
**Example** **Example**
...@@ -2437,22 +2265,20 @@ photoOutput.on('captureStart', (captureId) => { ...@@ -2437,22 +2265,20 @@ photoOutput.on('captureStart', (captureId) => {
}) })
``` ```
### on(type: 'frameShutter', callback: Callback<FrameShutterInfo\>): void; ### on('frameShutter')
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core on(type: 'frameShutter', callback: AsyncCallback<FrameShutterInfo\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------| | :------- | :------------------------------- | :--- | :--------------------------------------------- |
| type | string | Yes | Name of the event to listen for. | | type | string | Yes | Type of event to listen for. The value is fixed at **frameShutter**, indicating the frame shutter event.|
| callback | Callback<FrameShutterInfo\> | Yes | Callback used to get the frame shutter information.| | callback | AsyncCallback<FrameShutterInfo\> | Yes | Callback used to return the frame shutter information. |
**Example** **Example**
...@@ -2463,22 +2289,20 @@ photoOutput.on('frameShutter', (frameShutterInfo) => { ...@@ -2463,22 +2289,20 @@ photoOutput.on('frameShutter', (frameShutterInfo) => {
}) })
``` ```
### on(type: 'captureEnd', callback: Callback<CaptureEndInfo\>): void; ### on('captureEnd')
**System Capabilities:** on(type: 'captureEnd', callback: AsyncCallback<CaptureEndInfo\>): void
SystemCapability.Multimedia.Camera.Core Listens for photo capture end events. This API uses a callback to return the event information.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Listens for photo capture end events. This method uses a callback to get the event information.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :------------------------------------------------| | :------- | :----------------------------- | :--- | :--------------------------------------------- |
| type | string | Yes | Name of the event to listen for. | | type | string | Yes | Type of event to listen for. The value is fixed at **captureEnd**, indicating the photo capture end event.|
| callback | Callback<CaptureEndInfo\> | Yes | Callback used to get the capture end information | | callback | AsyncCallback<CaptureEndInfo\> | Yes | Callback used to return the photo capture end information. |
**Example** **Example**
...@@ -2489,22 +2313,20 @@ photoOutput.on('captureEnd', (captureEndInfo) => { ...@@ -2489,22 +2313,20 @@ photoOutput.on('captureEnd', (captureEndInfo) => {
}) })
``` ```
### on(type: 'error', callback: Callback<PhotoOutputError\>): void; ### on('error')
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core on(type: 'error', callback: ErrorCallback<PhotoOutputError\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------| | :------- | :------------------------------- | :--- | :---------------------------------------- |
| type | string | Yes | Photo output error event. | | type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the photo output error event.|
| callback | Callback<PhotoOutputError\> | Yes | Callback used to get the photo output errors. | | callback | ErrorCallback<PhotoOutputError\> | Yes | Callback used to return the photo output errors. |
**Example** **Example**
...@@ -2514,22 +2336,20 @@ photoOutput.on('error', (photoOutputError) => { ...@@ -2514,22 +2336,20 @@ photoOutput.on('error', (photoOutputError) => {
}) })
``` ```
## createVideoOutput(surfaceId: string, callback: AsyncCallback<VideoOutput\>): void; ## camera.createVideoOutput
**System Capabilities:** createVideoOutput(surfaceId: string, callback: AsyncCallback<VideoOutput\>): void
SystemCapability.Multimedia.Camera.Core Creates a **VideoOutput** instance. This API uses an asynchronous callback to return the instance.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Creates a **VideoOutput** instance. This method uses an asynchronous callback to return the instance.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|------------|-------------------------------|-----------|----------------------------------------------------| | --------- | ------------------------------------------- | ---- | ----------------------------------- |
| surfaceId | string | Yes | Surface ID received from VideoRecorder | | surfaceId | string | Yes | Surface ID received from **VideoRecorder**. |
| callback | AsyncCallback<VideoOutput\> | Yes | Callback used to return the VideoOutput instance | | callback | AsyncCallback<[VideoOutput](#videooutput)\> | Yes | Callback used to return the **VideoOutput** instance.|
**Example** **Example**
...@@ -2541,29 +2361,27 @@ camera.createVideoOutput((surfaceId), (err, videoOutput) => { ...@@ -2541,29 +2361,27 @@ camera.createVideoOutput((surfaceId), (err, videoOutput) => {
} }
console.log('Callback returned with the VideoOutput instance'); console.log('Callback returned with the VideoOutput instance');
}); });
``` ```
## createVideoOutput(surfaceId: string): Promise<VideoOutput\>;
**System Capabilities:** ## camera.createVideoOutput
SystemCapability.Multimedia.Camera.Core createVideoOutput(surfaceId: string): Promise<VideoOutput\>
**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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|------------|-----------------|-----------|----------------------------------------------------| | --------- | ------ | ---- | --------------------------------- |
| surfaceId | string | Yes | Surface ID received from VideoRecorder | | surfaceId | string | Yes | Surface ID received from **VideoRecorder**.|
**Return values** **Return value**
| Type | Description | | Type | Description |
|---------------------------------------|-------------------------------------------------| | ------------------------------------- | -------------------------------------- |
| Promise<[VideoOutput](#videooutput)\> | Promise used to return the VideoOutput instance | | Promise<[VideoOutput](#videooutput)\> | Promise used to return the **VideoOutput** instance.|
**Example** **Example**
...@@ -2572,25 +2390,24 @@ camera.createVideoOutput(surfaceId).then((videoOutput) => { ...@@ -2572,25 +2390,24 @@ camera.createVideoOutput(surfaceId).then((videoOutput) => {
console.log('Promise returned with the VideoOutput instance'); console.log('Promise returned with the VideoOutput instance');
}) })
``` ```
## VideoOutput ## VideoOutput
Implements video output. Implements video output.
### start(callback: AsyncCallback<void\>): void; ### start
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core start(callback: AsyncCallback<void\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|----------------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -2604,21 +2421,19 @@ videoOutput.start((err) => { ...@@ -2604,21 +2421,19 @@ videoOutput.start((err) => {
}); });
``` ```
### start(): Promise<void\>; ### start
**System Capabilities:** start(): Promise<void\>
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 |
| -------------- | --------------------------- |
| Type | Description | | Promise<void\> | Promise used to return the result.|
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
**Example** **Example**
...@@ -2629,21 +2444,19 @@ videoOutput.start().then(() => { ...@@ -2629,21 +2444,19 @@ videoOutput.start().then(() => {
}) })
``` ```
### stop(callback: AsyncCallback<void\>): void; ### stop
**System Capabilities:** stop(callback: AsyncCallback<void\>): void
SystemCapability.Multimedia.Camera.Core Stops the video output. This API uses an asynchronous callback to return the result.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Stops the video output. This method uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|----------------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -2657,21 +2470,19 @@ videoOutput.stop((err) => { ...@@ -2657,21 +2470,19 @@ videoOutput.stop((err) => {
}); });
``` ```
### stop(): Promise<void\>; ### stop
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core stop(): Promise<void\>
**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 | | Type | Description |
|----------------|---------------------------------------------| | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result | | Promise<void\> | Promise used to return the result.|
**Example** **Example**
...@@ -2681,21 +2492,19 @@ videoOutput.start().then(() => { ...@@ -2681,21 +2492,19 @@ videoOutput.start().then(() => {
}) })
``` ```
### release(callback: AsyncCallback<void\>): void; ### release
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core release(callback: AsyncCallback<void\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
|----------|----------------------|-----------|----------------------------------------------| | -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -2709,21 +2518,19 @@ videoOutput.release((err) => { ...@@ -2709,21 +2518,19 @@ videoOutput.release((err) => {
}); });
``` ```
### release(): Promise<void\>; ### release
**System Capabilities:** release(): Promise<void\>
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 |
| -------------- | --------------------------- |
| Type | Description | | Promise<void\> | Promise used to return the result.|
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
**Example** **Example**
...@@ -2734,22 +2541,20 @@ videoOutput.release().then(() => { ...@@ -2734,22 +2541,20 @@ videoOutput.release().then(() => {
}) })
``` ```
### on(type: 'frameStart', callback: Callback<number\>): void; ### on('frameStart')
**System Capabilities:** on(type: 'frameStart', callback: AsyncCallback<void\>): void
SystemCapability.Multimedia.Camera.Core Listens for video frame start events. This API uses a callback to return the event information.
**Description** **System capability**: SystemCapability.Multimedia.Camera.Core
Listens for video frame start events. This method uses a callback to get the event information.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :---------------- | :-------- | :----------------------------------| | :------- | :------------------- | :--- | :----------------------------------------------- |
| type | string | Yes | Name of the event to listen for. | | type | string | Yes | Type of event to listen for. The value is fixed at **frameStart**, indicating the video frame start event.|
| callback | Callback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -2759,16 +2564,20 @@ videoOutput.on('frameStart', () => { ...@@ -2759,16 +2564,20 @@ videoOutput.on('frameStart', () => {
}) })
``` ```
### on(type: 'frameEnd', callback: Callback<number\>): void; ### on('frameEnd')
on(type: 'frameEnd', callback: AsyncCallback<void\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :---------------- | :-------- | :----------------------------------| | :------- | :------------------- | :--- | :--------------------------------------------- |
| type | string | Yes | Name of the event to listen for. | | type | string | Yes | Type of event to listen for. The value is fixed at **frameEnd**, indicating the video frame end event.|
| callback | Callback<void\> | Yes | Callback used to return the result | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -2778,16 +2587,20 @@ videoOutput.on('frameEnd', () => { ...@@ -2778,16 +2587,20 @@ videoOutput.on('frameEnd', () => {
}) })
``` ```
### on(type: 'error', callback: Callback<VideoOutputError\>): void; ### on('error')
on(type: 'error', callback: ErrorCallback<VideoOutputError\>): 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------| | :------- | :-------------------------- | :--- | :-------------------------------------------- |
| type | string | Yes | Video output error event. | | type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the video output error event.|
| callback | Callback<VideoOutputError\> | Yes | Callback used to get the video output errors. | | callback | Callback<VideoOutputError\> | Yes | Callback used to return the video output errors. |
**Example** **Example**
...@@ -2795,4 +2608,4 @@ Listens for **VideoOutput** errors. This method uses a callback to get errors. ...@@ -2795,4 +2608,4 @@ Listens for **VideoOutput** errors. This method uses a callback to get errors.
videoOutput.on('error', (VideoOutputError) => { videoOutput.on('error', (VideoOutputError) => {
console.log('Video output error code: ' + VideoOutputError.code); console.log('Video output error code: ' + VideoOutputError.code);
}) })
``` ```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册