未验证 提交 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.
## Modules to Import
......@@ -11,25 +11,22 @@ import camera from '@ohos.multimedia.camera';
## Required Permissions
```
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**
| Name | Type | Mandatory | Description |
|----------|-------------------------------|-----------|-----------------------------------------------------|
| context | Context | Yes | Application context |
| callback | AsyncCallback<CameraManager\> | Yes | Callback used to return the CameraManager instance |
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------- | ---- | ---------------------------------- |
| context | Context | Yes | Application context. |
| callback | AsyncCallback<[CameraManager](#cameramanager)\> | Yes | Callback used to return the **CameraManager** instance.|
**Example**
......@@ -43,116 +40,105 @@ camera.getCameraManager(context, (err, cameraManager) => {
});
```
## getCameraManager(context: Context): Promise<CameraManager\>;
**System Capabilities:**
## camera.getCameraManager
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**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|----------------------------|
| context | Context | Yes | Application context |
| Name | Type | Mandatory| Description |
| ------- | ------- | ---- | ------------ |
| context | Context | Yes | Application context.|
**Return values**
**Return value**
| Type | Description |
|-------------------------|--------------------------------------------------------|
| Promise<CameraManager\> | Promise used to return the **CameraManager** instance |
| Type | Description |
| ----------------------------------------- | ----------------------------------------- |
| Promise<[CameraManager](#cameramanager)\> | Promise used to return the **CameraManager** instance.|
**Example**
```
camera.getCameraManager(context).then((cameraManger) => {
camera.getCameraManager(context).then((cameraManager) => {
console.log('Promise returned with the CameraManager instance.');
})
```
## CameraStatus<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<a name="section_camera_position"></a>
## CameraPosition
Enumerates the camera positions.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**System capability**: SystemCapability.Multimedia.Camera.Core
| Name | Default value | Description |
|-----------------------------|---------------|-----------------------|
| CAMERA_POSITION_UNSPECIFIED | 0 | Unspecified position |
| CAMERA_POSITION_BACK | 1 | Rear camera |
| CAMERA_POSITION_FRONT | 2 | Front camera |
| Name | Default Value| Description |
| --------------------------- | ------ | ---------------- |
| CAMERA_POSITION_UNSPECIFIED | 0 | Unspecified position.|
| CAMERA_POSITION_BACK | 1 | Rear camera. |
| CAMERA_POSITION_FRONT | 2 | Front camera. |
## CameraType<a name="section_camera_type"></a>
## CameraType
Enumerates the camera types.
**System Capabilities:**
**System capability**: SystemCapability.Multimedia.Camera.Core
SystemCapability.Multimedia.Camera.Core
| Name | Default Value| Description |
| ----------------------- | ------ | ---------------- |
| CAMERA_TYPE_UNSPECIFIED | 0 | Unspecified camera type.|
| CAMERA_TYPE_WIDE_ANGLE | 1 | Wide camera. |
| CAMERA_TYPE_ULTRA_WIDE | 2 | Ultra wide camera. |
| CAMERA_TYPE_TELEPHOTO | 3 | Telephoto camera. |
| CAMERA_TYPE_TRUE_DEPTH | 4 | True depth camera. |
| Name | Default value | Description |
|-------------------------|---------------|-------------------------|
| CAMERA_TYPE_UNSPECIFIED | 0 | Unspecified camera type |
| CAMERA_TYPE_WIDE_ANGLE | 1 | Wide camera |
| CAMERA_TYPE_ULTRA_WIDE | 2 | Ultra wide camera |
| CAMERA_TYPE_TELEPHOTO | 3 | Telephoto camera |
| CAMERA_TYPE_TRUE_DEPTH | 4 | True depth camera |
## ConnectionType
## ConnectionType<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 |
|------------------------------|---------------|----------------------------|
| CAMERA_CONNECTION_BUILT_IN | 0 | Built-in camera |
| CAMERA_CONNECTION_USB_PLUGIN | 1 | Camera connected using USB |
| CAMERA_CONNECTION_REMOTE | 2 | Remote camera |
## CameraManager
## CameraManager<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
**Description**
Gets all cameras supported by the device. This method uses an asynchronous callback to return the array of supported cameras.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|----------|--------------------------------|-----------|---------------------------------------------------------|
| callback | AsyncCallback<Array<Camera\>\> | Yes | Callback used to return the array of supported cameras. |
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback<Array<[Camera](#camera)\>\> | Yes | Callback used to return the array of supported cameras.|
**Example**
......@@ -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 |
|------------------------|--------------------------------------------------------|
| Promise<Array<Camera\>\> | Promise used to return an array of supported cameras |
| Type | Description |
| ----------------------------------- | ----------------------------- |
| Promise<Array<[Camera](#camera)\>\> | Promise used to return the array of supported cameras.|
**Example**
......@@ -191,22 +175,20 @@ cameraManager.getCameras().then((cameraArray) => {
})
```
### createCameraInput(cameraId: string, callback: AsyncCallback<CameraInput\>): void;
**System Capabilities:**
### createCameraInput
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**
| Name | Default value | Mandatory | Description |
|----------|------------------------------|-----------|--------------------------------------------------|
| cameraId | string | Yes | Camera ID used to create the instance |
| callback | AsyncCallback<CameraInput\> | Yes | Callback used to return the CameraInput instance |
| Name | Default Value | Mandatory| Description |
| -------- | ------------------------------------------- | ---- | ----------------------------------- |
| cameraId | string | Yes | Camera ID used to create the instance. |
| callback | AsyncCallback<[CameraInput](#camerainput)\> | Yes | Callback used to return the **CameraInput** instance.|
**Example**
......@@ -220,27 +202,25 @@ cameraManager.createCameraInput(cameraId, (err, cameraInput) => {
})
```
### createCameraInput(cameraId: string): Promise<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**
Creates a **CameraInput** instance with the specified camera ID. This method uses a promise to return the instance.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Default value | Mandatory | Description |
|----------|-----------------------------|-----------|------------------------------------------|
| cameraId | string | Yes | Camera ID used to create the instance |
| Name | Default Value| Mandatory| Description |
| -------- | ------ | ---- | ------------ |
| cameraId | string | Yes | Camera ID used to create the instance.|
**Return values**
**Return value**
| Type | Description |
|-------------------------|-------------------------------------------------|
| Promise<CameraInput\> | Promise used to return the CameraInput instance |
| Type | Description |
| ------------------------------------- | ---------------------------------------- |
| Promise<[CameraInput](#camerainput)\> | Promise used to return the **CameraInput** instance.|
**Example**
......@@ -250,23 +230,21 @@ cameraManager.createCameraInput(cameraId).then((cameraInput) => {
})
```
### createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback<CameraInput\>): void;
**System Capabilities:**
### createCameraInput
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**
| Name | Type | Mandatory | Description |
|----------|-----------------------------|-----------|---------------------------------------------------|
| position | CameraPosition | Yes | Camera position |
| type | CameraType | Yes | Camera type |
| callback | AsyncCallback<CameraInput\> | Yes | Callback used to return the CameraInput instance |
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------- | ---- | ----------------------------------- |
| position | [CameraPosition](#cameraposition) | Yes | Camera position. |
| type | [CameraType](#cameratype) | Yes | Camera type. |
| callback | AsyncCallback<[CameraInput](#camerainput)\> | Yes | Callback used to return the **CameraInput** instance.|
**Example**
......@@ -280,28 +258,26 @@ cameraManager.createCameraInput(cameraPosition, cameraType, (err, cameraInput) =
})
```
### createCameraInput(position: CameraPosition, type: CameraType): Promise<CameraInput\>;
**System Capabilities:**
### createCameraInput
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**
| Name | Type | Mandatory | Description |
|----------|----------------------------|-----------|----------------------------------------|
| position | CameraPosition | Yes | Camera position |
| type | CameraType | Yes | Camera type |
| Name | Type | Mandatory| Description |
| -------- | --------------------------------- | ---- | ---------- |
| position | [CameraPosition](#cameraposition) | Yes | Camera position.|
| type | [CameraType](#cameratype) | Yes | Camera type.|
**Return values**
**Return value**
| Type | Description |
|-------------------------|-------------------------------------------------|
| Promise<CameraInput\> | Promise used to return the CameraInput instance |
| Type | Description |
| ------------------------------------- | ---------------------------------------- |
| Promise<[CameraInput](#camerainput)\> | Promise used to return the **CameraInput** instance.|
**Example**
......@@ -311,22 +287,20 @@ cameraManager.createCameraInput(cameraPosition, cameraType).then((cameraInput) =
})
```
### on(type: 'cameraStatus', callback: Callback<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**
Listens for camera status changes. This method uses a callback to get camera status changes.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :--------------------------------------------------- |
| type | string | Yes | Camera status event. |
| callback | Callback<CameraStatusInfo\> | Yes | Callback used to get the camera status change. |
| Name | Type | Mandatory| Description |
| :------- | :---------------------------------------------------- | :--- | :--------------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **cameraStatus**, indicating the camera status change event.|
| callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | Yes | Callback used to return the camera status change. |
**Example**
......@@ -337,22 +311,20 @@ cameraManager.on('cameraStatus', (cameraStatusInfo) => {
})
```
## Camera<a name="section_Camera"></a>
when we call *cameraManager.getCameras()* API, then it will return the **Camera** class which will have all camera-related metadata such as *cameraId, cameraPosition, cameraType & connectionType*.
## Camera
**System Capabilities:**
After **[camera.getCameraManager](#cameragetcameramanager)** is called, a camera instance is returned, including camera-related metadata such as **cameraId**, **cameraPosition**, **cameraType**, and **connectionType**.
SystemCapability.Multimedia.Camera.Core
**System capability**: SystemCapability.Multimedia.Camera.Core
**Fields**
| Name | Type | Read only| Description |
| -------------- | --------------------------------- | ---- | -------------- |
| cameraId | string | Yes | Camera ID. |
| cameraPosition | [CameraPosition](#cameraposition) | Yes | Camera position. |
| cameraType | [CameraType](#cameratype) | Yes | Camera type. |
| connectionType | [ConnectionType](#connectiontype) | Yes | Camera connection type.|
| Name | Type | Access | Description |
|----------------|----------------|----------|------------------------|
| cameraId | string | readonly | Camera ID |
| cameraPosition | cameraPosition | readonly | Camera position |
| cameraType | cameraType | readonly | Camera type |
| connectionType | connectionType | readonly | Camera connection type |
**Example**
```
async function getCameraInfo() {
......@@ -367,41 +339,37 @@ async function getCameraInfo() {
```
## CameraStatusInfo<a name="section_Camera"></a>
This interface is a CameraManager callback API return. **CameraStatusInfo** will have *Camera* class & *CameraStatus* predefine constants.From *Camera* class, we can have all camera-related metadata & from *CameraStatus* constants, we will have information such as *APPEAR, DISAPPEAR, AVAILABLE & UNAVAILABLE*.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
## CameraStatusInfo
**Fields**
Describes the camera status information.
| Name | Type | Description |
|----------------|----------------|------------------|
| camera | Camera | Camera object |
| status | CameraStatus | Camera status |
**System capability**: SystemCapability.Multimedia.Camera.Core
| Name | Type | Description |
| ------ | ----------------------------- | ---------- |
| camera | [Camera](#camera) | Camera object.|
| status | [CameraStatus](#camerastatus) | Camera status.|
## CameraInput<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**
| Name | Type | Mandatory | Description |
|----------|------------------------|-----------|---------------------------------------|
| callback | AsyncCallback<string\> | Yes | Callback used to return the camera ID |
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------------- |
| callback | AsyncCallback<string\> | Yes | Callback used to return the camera ID.|
**Example**
```
cameraInput.getCameraId((err, cameraId) => {
......@@ -413,21 +381,19 @@ cameraInput.getCameraId((err, cameraId) => {
})
```
### getCameraId(): Promise<string\>;
**System Capabilities:**
### getCameraId
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 |
|------------------------|--------------------------------------|
| Promise<string\> | Promise used to return the camera ID |
| Type | Description |
| ---------------- | ----------------------------- |
| Promise<string\> | Promise used to return the camera ID.|
**Example**
......@@ -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**
| Name | Type | Mandatory | Description |
|----------|-------------------------|-----------|----------------------------------------------------|
| callback | AsyncCallback<boolean\> | Yes | Callback used to return the flash light support status |
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback<boolean\> | Yes | Callback used to return the flash light support status. The value **true** means that the device has flash light.|
**Example**
......@@ -465,21 +430,19 @@ cameraInput.hasFlash((err, status) => {
})
```
### hasFlash(): Promise<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 |
|-----------------------|--------------------------------------------------------|
| Promise<boolean\> | Promise used to return the flash light support status |
| Type | Description |
| ----------------- | ------------------------------------------------------- |
| Promise<boolean\> | Promise used to return the flash light support status. The value **true** means that the device has flash light.|
**Example**
......@@ -489,22 +452,20 @@ cameraInput.hasFlash().then((status) => {
})
```
### isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback<boolean\>): void; <a name="sec_isFlashModeSupported"></a>
**System Capabilities:**
### isFlashModeSupported
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**
| Name | Type | Mandatory | Description |
|-----------|------------------------|-----------|----------------------------------------------------|
| flashMode | <a href="#sec_FlashMode">FlashMode</a> | Yes | Flash mode |
| callback | AsyncCallback<boolean\> | Yes | Callback used to return the device flash support status |
| Name | Type | Mandatory| Description |
| --------- | ----------------------- | ---- | ---------------------------------------- |
| flashMode | [FlashMode](#flashmode) | Yes | Flash mode. |
| 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**
......@@ -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**
Checks whether a specified flash mode is supported. This method uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|-----------|------------------------|-----------|----------------------------------------------------|
| flashMode | <a href="#sec_FlashMode">FlashMode</a> | Yes | Flash mode |
| Name | Type | Mandatory| Description |
| --------- | ----------------------- | ---- | ---------------- |
| flashMode | [FlashMode](#flashmode) | Yes | Flash mode.|
**Return values**
**Return value**
| Type | Description |
|-----------------------|---------------------------------------------------|
| Promise<boolean\> | Promise used to return flash mode support status. |
| Type | Description |
| ----------------- | ------------------------------------------------------------ |
| Promise<boolean\> | Promise used to return the flash mode support status. The value **true** means that the specified flash mode is supported.|
**Example**
......@@ -548,24 +507,25 @@ cameraInput.isFlashModeSupported(flashMode).then((status) => {
})
```
### setFlashMode(flashMode: FlashMode, callback: AsyncCallback<void\>): 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**
| Name | Type | Mandatory | Description |
|-----------|------------------------|-----------|----------------------------------------------------|
| flashMode | <a href="#sec_FlashMode">FlashMode</a> | Yes | Flash mode |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| --------- | ----------------------- | ---- | ------------------------ |
| flashMode | [FlashMode](#flashmode) | Yes | Flash mode. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -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**
| Name | Type | Mandatory | Description |
|-----------|------------------------|-----------|----------------------------------------------------|
| flashMode | <a href="#sec_FlashMode">FlashMode</a> | Yes | Flash mode |
| Name | Type | Mandatory| Description |
| --------- | ----------------------- | ---- | ---------------- |
| flashMode | [FlashMode](#flashmode) | Yes | Flash mode.|
**Return values**
**Return value**
| Type | Description |
|-----------------------|-----------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Gets current flash mode. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|-----------|---------------------------|-----------|------------------------------------------------|
| callback | AsyncCallback<FlashMode\> | Yes | Callback used to return the current flash mode |
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------------------------------------- |
| callback | AsyncCallback<[FlashMode](#flashmode)\> | Yes | Callback used to return the current flash mode.|
**Example**
......@@ -639,21 +598,19 @@ cameraInput.getFlashMode((err, flashMode) => {
})
```
### getFlashMode(): Promise<FlashMode\>;
**System Capabilities:**
### getFlashMode
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 |
|-----------------------|---------------------------------------------------|
| Promise<FlashMode\> | Promise used to return the flash mode |
| Type | Description |
| --------------------------------- | --------------------------------------- |
| Promise<[FlashMode](#flashmode)\> | Promise used to return the current flash mode.|
**Example**
......@@ -663,22 +620,20 @@ cameraInput.getFlashMode().then((flashMode) => {
})
```
### isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<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**
Checks whether a specified focus mode is supported. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|-----------|------------------------|-----------|----------------------------------------------------|
| afMode | <a href="#sec_FocusMode">FocusMode</a> | Yes | Focus mode |
| callback | AsyncCallback<boolean\> | Yes | Callback used to return the device focus support status |
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| afMode | [FocusMode](#focusmode) | Yes | Focus mode. |
| 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**
......@@ -692,27 +647,25 @@ cameraInput.isFocusModeSupported(afMode, (err, status) => {
})
```
### isFocusModeSupported(afMode: FocusMode): Promise<boolean\>;
**System Capabilities:**
### isFocusModeSupported
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**
| Name | Type | Mandatory | Description |
|-----------|----------------------------------------|-----------|-------------|
| afMode | <a href="#sec_FocusMode">FocusMode</a> | Yes | Focus mode |
| Name | Type | Mandatory| Description |
| ------ | ----------------------- | ---- | ---------------- |
| afMode | [FocusMode](#focusmode) | Yes | Focus mode.|
**Return values**
**Return value**
| Type | Description |
|-----------------------|---------------------------------------------------|
| Promise<boolean\> | Promise used to return the focus mode support status. |
| Type | Description |
| ----------------- | ----------------------------------------------------------- |
| Promise<boolean\> | Promise used to return the flash mode support status. The value **true** means that the specified focus mode is supported.|
**Example**
......@@ -722,24 +675,22 @@ cameraInput.isFocusModeSupported(afMode).then((status) => {
})
```
### setFocusMode(afMode: FocusMode, callback: AsyncCallback<void\>): void;
**System Capabilities:**
### setFocusMode
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**
| Name | Type | Mandatory | Description |
|-----------|------------------------|-----------|------------------------------------|
| afMode | <a href="#sec_FocusMode">FocusMode</a> | Yes | Focus mode |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ------------------------ |
| afMode | [FocusMode](#focusmode) | Yes | Focus mode. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -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.
Note: Before setting the focus mode, check focus mode support (<a href="#sec_isFocusModeSupported">isFocusModeSupported</a> method);
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|-----------|-----------------------------------------|-----------|-------------|
| afMode | <a href="#sec_FocusMode">FocusMode</a> | Yes | Focus mode |
| Name | Type | Mandatory| Description |
| ------ | ----------------------- | ---- | ---------------- |
| afMode | [FocusMode](#focusmode) | Yes | Focus mode.|
**Return values**
**Return value**
| Type | Description |
|-----------------------|-----------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Gets the current focus mode. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|-----------|---------------------------|-----------|------------------------------------------------|
| callback | AsyncCallback<FocusMode\> | Yes | Callback used to return the current focus mode |
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback<[FocusMode](#focusmode)\> | Yes | Callback used to return the current focus mode.|
**Example**
......@@ -813,21 +760,19 @@ cameraInput.getFocusMode((err, afMode) => {
})
```
### getFocusMode(): Promise<FocusMode\>;
**System Capabilities:**
### getFocusMode
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 |
|-----------------------|---------------------------------------------------|
| Promise<FocusMode\> | Promise used to return the focus mode |
| Type | Description |
| ------------------- | ------------------------------------- |
| Promise<FocusMode\> | Promise used to return the current focus mode.|
**Example**
......@@ -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**
Gets the zoom ratios of all zoom values. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|----------|--------------------------------|-----------|-------------------------------------------------|
| callback | AsyncCallback<Array<number\>\> | Yes | Callback used to return the zoom ratio range |
| Name | Type | Mandatory| Description |
| -------- | ------------------------------ | ---- | ------------------------ |
| callback | AsyncCallback<Array<number\>\> | Yes | Callback used to return the zoom ratio range.|
**Example**
......@@ -865,21 +808,19 @@ cameraInput.getZoomRatioRange((err, zoomRatioRange) => {
})
```
### getZoomRatioRange\(\): Promise<Array<number\>\>;
**System Capabilities:**
### getZoomRatioRange
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 |
|------------------------|---------------------------------------------|
| Promise<Array<number\>\> | Promise used to return the zoom ratio range |
| Type | Description |
| ------------------------ | ------------------------------------------- |
| Promise<Array<number\>\> | Promise used to return the zoom ratio range.|
**Example**
......@@ -889,22 +830,20 @@ cameraInput.getZoomRatioRange().then((zoomRatioRange) => {
})
```
### setZoomRatio(zoomRatio: number, callback: AsyncCallback<void\>): void;
**System Capabilities:**
### setZoomRatio
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**
| Name | Type | Mandatory | Description |
|-----------|------------------------|-----------|------------------------------------|
| zoomRatio | number | Yes | Zoom ratio |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| --------- | -------------------- | ---- | ------------------------ |
| zoomRatio | number | Yes | Zoom ratio to set. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -918,27 +857,25 @@ cameraInput.setZoomRatio(zoomRatio, (err) => {
})
```
### setZoomRatio(zoomRatio: number): Promise<void\>;
**System Capabilities:**
### setZoomRatio
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**
| Name | Type | Mandatory | Description |
|-----------|----------|-----------|-------------|
| zoomRatio | number | Yes | zoom ratio |
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | ------------ |
| zoomRatio | number | Yes | Zoom ratio to set.|
**Return values**
**Return value**
| Type | Description |
|-----------------------|-----------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -948,21 +885,19 @@ cameraInput.setZoomRatio(zoomRatio).then(() => {
})
```
### getZoomRatio(callback: AsyncCallback<number\>): void;
**System Capabilities:**
### getZoomRatio
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**
| Name | Type | Mandatory | Description |
|-----------|---------------------------|-----------|------------------------------------------------------|
| callback | AsyncCallback<number\> | Yes | Callback used to return the current zoom ratio value |
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------ |
| callback | AsyncCallback<number\> | Yes | Callback used to return the current zoom ratio.|
**Example**
......@@ -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 |
|-----------------------|---------------------------------------------------|
| Promise<number\> | Promise used to return the zoom ratio vaule |
| Type | Description |
| ---------------- | --------------------------- |
| Promise<number\> | Promise used to return the current zoom ratio.|
**Example**
......@@ -1000,26 +933,24 @@ cameraInput.getZoomRatio().then((zoomRatio) => {
})
```
### release\(callback: AsyncCallback<void\>\): void;
**System Capabilities:**
### release
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**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
```
cameraInput.release((err) => {
camera.release((err) => {
if (err) {
console.error('Failed to release the CameraInput instance ${err.message}');
return;
......@@ -1028,21 +959,19 @@ cameraInput.release((err) => {
});
```
### release(): Promise<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 |
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Listens for focus state changes. This method uses a callback to get focus state changes.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------|
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<FocusState\> | Yes | Callback used to get the focus state change. |
| Name | Type | Mandatory| Description |
| :------- | :---------------------------------------- | :--- | :------------------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **focusStateChange**, indicating the focus state change event.|
| callback | AsyncCallback<[FocusState](#focusstate)\> | Yes | Callback used to return the focus state change. |
**Example**
......@@ -1077,22 +1004,20 @@ cameraInput.on('focusStateChange', (focusState) => {
})
```
### on(type: 'error', callback: Callback<CameraInputError\>): void;
**System Capabilities:**
### on('error')
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**
| Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------|
| type | string | Yes | Camera input error event. |
| callback | Callback<CameraInputError\> | Yes | Callback used to get the camera input errors. |
| Name | Type | Mandatory| Description |
| :------- | :------------------------------- | :--- | :---------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the camera input error event.|
| callback | ErrorCallback<CameraInputError\> | Yes | Callback used to return the capture input errors. |
**Example**
......@@ -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 |
|------------------------|---------------|------------------------|
| FLASH_MODE_CLOSE | 0 | Flash mode close |
| FLASH_MODE_OPEN | 1 | Flash mode open |
| FLASH_MODE_AUTO | 2 | Flash mode auto |
| FLASH_MODE_ALWAYS_OPEN | 3 | Flash mode always open |
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| FLASH_MODE_CLOSE | 0 | The flash is off.|
| FLASH_MODE_OPEN | 1 | The flash is on.|
| FLASH_MODE_AUTO | 2 | The flash mode is auto, indicating that the flash fires automatically depending on the shooting conditions.|
| FLASH_MODE_ALWAYS_OPEN | 3 | The flash is steady on.|
## FocusMode <a name="sec_FocusMode"></a>
## FocusMode
Enumerates the focus modes.
**System Capabilities:**
**System capability**: SystemCapability.Multimedia.Camera.Core
| Name | Default Value| Description |
| -------------------------- | ------ | ------------------ |
| FOCUS_MODE_MANUAL | 0 | Manual focus. |
| FOCUS_MODE_CONTINUOUS_AUTO | 1 | Continuous auto focus.|
| FOCUS_MODE_AUTO | 2 | Auto focus. |
| FOCUS_MODE_LOCKED | 3 | Locked focus. |
SystemCapability.Multimedia.Camera.Core
## FocusState
| Name | Default value | Description |
|----------------------------|---------------|----------------------------|
| FOCUS_MODE_MANUAL | 0 | Focus mode manual |
| FOCUS_MODE_CONTINUOUS_AUTO | 1 | Focus mode continuous auto |
| FOCUS_MODE_AUTO | 2 | Focus mode auto |
| FOCUS_MODE_LOCKED | 3 | Focus mode locked |
Enumerates the focus states.
## createCaptureSession\(context: Context, callback: AsyncCallback<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**
| Name | Type | Mandatory | Description |
|----------|--------------------------------|-----------|-----------------------------------------------------|
| context | Context | Yes | Application context |
| callback | AsyncCallback<CaptureSession\> | Yes | Callback used to return the CaptureSession instance |
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------- | ---- | -------------------------------------- |
| context | Context | Yes | Application context. |
| callback | AsyncCallback<[CaptureSession](#capturesession)\> | Yes | Callback used to return the **CaptureSession** instance.|
**Example**
```
captureSession.createCaptureSession((context), (err, captureSession) => {
camera.createCaptureSession((context), (err, captureSession) => {
if (err) {
console.error('Failed to create the CaptureSession instance. ${err.message}');
return;
......@@ -1161,55 +1093,51 @@ captureSession.createCaptureSession((context), (err, captureSession) => {
});
```
## createCaptureSession(context: Context\): Promise<CaptureSession\>;
**System Capabilities:**
## camera.createCaptureSession
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**
| Name | Type | Mandatory | Description |
|----------|-------------------------------|-----------|-----------------------------------------------------|
| context | Context | Yes | Application context |
| Name | Type | Mandatory| Description |
| ------- | ------- | ---- | ------------ |
| context | Context | Yes | Application context.|
**Return values**
**Return value**
| Type | Description |
|---------------------------|---------------------------------------------------|
| Promise<CaptureSession\> | Promise used to return the CaptureSession instance. |
| Type | Description |
| ------------------------------------------- | ----------------------------------------- |
| Promise<[CaptureSession](#capturesession)\> | Promise used to return the **CaptureSession** instance.|
**Example**
```
captureSession.createCaptureSession(context).then((captureSession) => {
camera.createCaptureSession(context).then((captureSession) => {
console.log('Promise returned with the CaptureSession instance');
})
```
## CaptureSession<a name="sec_CaptureSession"></a>
## CaptureSession
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**
Starts configuration for this CaptureSession instance. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -1223,21 +1151,19 @@ captureSession.beginConfig((err) => {
});
```
### beginConfig\(\): Promise<void\>;
**System Capabilities:**
### beginConfig
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 |
|---------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -1248,21 +1174,19 @@ captureSession.beginConfig().then(() => {
})
```
### commitConfig\(callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a>
**System Capabilities:**
### commitConfig
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**
| Name | Type | Mandatory | Description |
|----------|---------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -1276,21 +1200,19 @@ captureSession.commitConfig((err) => {
});
```
### commitConfig\(\): Promise<void\>;<a name="section189141826104616"></a>
**System Capabilities:**
### commitConfig
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 |
|---------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -1300,22 +1222,20 @@ captureSession.commitConfig().then(() => {
})
```
### addInput\(cameraInput: CameraInput, callback: AsyncCallback<void\>\): void;
**System Capabilities:**
### addInput
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**
| Name | Type | Mandatory | Description |
|-------------|----------------------|-----------|---------------------------------------------|
| cameraInput | CameraInput | Yes | CameraInput instance to add |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -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**
Add a CameraInput instance to this CaptureSession instance. This method uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|-------------|---------------------|-----------|-------------------------------|
| cameraInput | CameraInput | Yes | CameraInput instance to add |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.|
**Return values**
**Return value**
| Type | Description |
|----------------|------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Add a PreviewOutput instance to this CaptureSession instance. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|---------------|----------------------|-----------|-------------------------------------|
| previewOutput | PreviewOutput | Yes | PreviewOutput instance to add |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| ------------- | ------------------------------- | ---- | ----------------------------- |
| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to add.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -1388,27 +1304,25 @@ captureSession.addOutput(previewOutput, (err) => {
});
```
### addOutput\(previewOutput: PreviewOutput\): Promise<void\>;<a name="section189141826104616"></a>
**System Capabilities:**
### addOutput
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**
| Name | Type | Mandatory | Description |
|---------------|---------------------|-----------|--------------------------------|
| previewOutput | PreviewOutput | Yes | PreviewOutput instance to add |
| Name | Type | Mandatory| Description |
| ------------- | ------------------------------- | ---- | ----------------------------- |
| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to add.|
**Return values**
**Return value**
| Type | Description |
|----------------|-----------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -1418,22 +1332,20 @@ captureSession.addOutput(previewOutput).then(() => {
})
```
### addOutput\(photoOutput: PhotoOutput, callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a>
**System Capabilities:**
### addOutput
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**
| Name | Type | Mandatory | Description |
|---------------|---------------------|-----------|-------------------------------------|
| photoOutput | PhotoOutput | Yes | PhotoOutput instance to add |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to add.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -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**
Add a PhotoOutput instance to this CaptureSession instance. This method uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|---------------|---------------------|-----------|--------------------------------|
| photoOutput | PhotoOutput | Yes | PhotoOutput instance to add |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to add.|
**Return values**
**Return value**
| Type | Description |
|---------------|-----------------------------------|
| Promise<void> | Promise used to return the result |
| -------------- | --------------------------- |
| Promise\<void> | Promise used to return the result.|
**Example**
......@@ -1477,22 +1387,20 @@ captureSession.addOutput(photoOutput).then(() => {
})
```
### addOutput\(videoOutput: VideoOutput, callback: AsyncCallback<void\>\): void;
**System Capabilities:**
### addOutput
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**
| Name | Type | Mandatory | Description |
|---------------|---------------------|-----------|-------------------------------------|
| videoOutput | VideoOutput | Yes | VideoOutput instance to add |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to add.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -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**
Add a VideoOutput instance to this CaptureSession instance. This method uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|---------------|---------------------|-----------|--------------------------------|
| videoOutput | VideoOutput | Yes | VideoOutput instance to add |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to add.|
**Return values**
**Return value**
| Type | Description |
|----------------|-----------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise\<void> | Promise used to return the result.|
**Example**
......@@ -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**
Removes a **CameraInput** instance from this **CaptureSession** instance. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|-------------|----------------------|-----------|------------------------------------|
| cameraInput | CameraInput | Yes | CameraInput instance to remove |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to remove.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -1565,27 +1469,25 @@ captureSession.removeInput(cameraInput, (err) => {
});
```
### removeInput\(cameraInput: CameraInput\): Promise<void\>;<a name="section189141826104616"></a>
**System Capabilities:**
### removeInput
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**
| Name | Type | Mandatory | Description |
|-------------|---------------------|-----------|---------------------------------|
| cameraInput | CameraInput | Yes | CameraInput instance to remove |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to remove.|
**Return values**
**Return value**
| Type | Description |
|----------------|-----------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise\<void> | Promise used to return the result.|
**Example**
......@@ -1595,22 +1497,20 @@ captureSession.removeInput(cameraInput).then(() => {
})
```
### removeOutput\(previewOutput: PreviewOutput, callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a>
**System Capabilities:**
### removeOutput
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**
| Name | Type | Mandatory | Description |
|---------------|----------------------|-----------|------------------------------------|
| previewOutput | PreviewOutput | Yes | PreviewOutput instance to remove |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| ------------- | ------------------------------- | ---- | ----------------------------- |
| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to remove.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -1624,28 +1524,26 @@ captureSession.removeOutput(previewOutput, (err) => {
});
```
### removeOutput(previewOutput: PreviewOutput): Promise<void\>;
**System Capabilities:**
### removeOutput
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**
| Name | Type | Mandatory | Description |
|---------------|---------------------|-----------|-----------------------------------|
| previewOutput | PreviewOutput | Yes | PreviewOutput instance to remove |
| Name | Type | Mandatory| Description |
| ------------- | ------------------------------- | ---- | ----------------------------- |
| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to remove.|
**Return values**
**Return value**
| Type | Description |
|---------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -1656,22 +1554,20 @@ captureSession.removeOutput(previewOutput).then(() => {
})
```
### removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback<void\>): void;
**System Capabilities:**
### removeOutput
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**
| Name | Type | Mandatory | Description |
|---------------|----------------------|-----------|------------------------------------|
| photoOutput | PhotoOutput | Yes | PhotoOutput instance to remove |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to remove.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -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**
Removes a **PhotoOutput** instance from this **CaptureSession** instance. This method uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|---------------|---------------------|-----------|---------------------------------|
| photoOutput | PhotoOutput | Yes | PhotoOutput instance to remove |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to remove.|
**Return values**
**Return value**
| Type | Description |
|---------------|------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Removes a **VideoOutput** instance from this **CaptureSession** instance. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|---------------|----------------------|-----------|------------------------------------|
| videoOutput | VideoOutput | Yes | VideoOutput instance to remove |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to remove.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -1746,28 +1638,26 @@ captureSession.removeOutput(videoOutput, (err) => {
});
```
### removeOutput(videoOutput: VideoOutput): Promise<void\>;
**System Capabilities:**
### removeOutput
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**
| Name | Type | Mandatory | Description |
|---------------|---------------------|-----------|---------------------------------|
| videoOutput | VideoOutput | Yes | VideoOutput instance to remove |
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
| videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to remove.|
**Return values**
**Return value**
| Type | Description |
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -1778,21 +1668,19 @@ captureSession.removeOutput(videoOutput).then(() => {
})
```
### start\(callback: AsyncCallback<void\>\): void;
**System Capabilities:**
### start
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**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -1806,21 +1694,19 @@ captureSession.start((err) => {
});
```
### start\(\): Promise<void\>;<a name="section189141826104616"></a>
**System Capabilities:**
### start
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 |
|----------------|-----------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -1830,22 +1716,20 @@ captureSession.start().then(() => {
})
```
### stop\(callback: AsyncCallback<void\>\): void;<a name="section84581011418"></a>
**System Capabilities:**
### stop
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**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -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 |
|----------------|-----------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Releases this **CaptureSession** instance. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -1911,21 +1791,19 @@ captureSession.release((err) => {
});
```
### release(): Promise<void\>;
**System Capabilities:**
### release
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 |
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -1935,22 +1813,20 @@ captureSession.release().then(() => {
})
```
### on(type: 'error', callback: Callback<CaptureSessionError\>): void;
**System Capabilities:**
### on('error')
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**
| Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------|
| type | string | Yes | Capture session error event. |
| callback | Callback<CaptureSessionError\> | Yes | Callback used to get the capture session errors. |
| Name | Type | Mandatory| Description |
| :------- | :---------------------------------- | :--- | :-------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the capture session error event.|
| callback | ErrorCallback<CaptureSessionError\> | Yes | Callback used to return the capture session errors. |
**Example**
......@@ -1960,22 +1836,20 @@ captureSession.on('error', (captureSessionError) => {
})
```
## createPreviewOutput(surfaceId: string, callback: AsyncCallback<PreviewOutput\>): void;
**System Capabilities:**
## camera.createPreviewOutput
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**
| Name | Type | Mandatory | Description |
|------------|-------------------------------|-----------|----------------------------------------------------|
| surfaceId | string | Yes | Surface ID received from XComponent view |
| callback | AsyncCallback<PreviewOutput\> | Yes | Callback used to return the PreviewOutput instance |
| Name | Type | Mandatory| Description |
| --------- | ----------------------------------------------- | ---- | ------------------------------------- |
| surfaceId | string | Yes | Surface ID received from **XComponent**. |
| callback | AsyncCallback<[PreviewOutput](#previewoutput)\> | Yes | Callback used to return the **PreviewOutput** instance.|
**Example**
......@@ -1987,29 +1861,27 @@ camera.createPreviewOutput((surfaceId), (err, previewOutput) => {
}
console.log('Callback returned with previewOutput instance');
});
```
## createPreviewOutput(surfaceId: string): Promise<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**
| Name | Type | Mandatory | Description |
|------------|-----------------|-----------|----------------------------------------------------|
| surfaceId | string | Yes | Surface ID received from XComponent view |
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | ---------------------------------- |
| surfaceId | string | Yes | Surface ID received from **XComponent**.|
**Return values**
**Return value**
| Type | Description |
|-------------------------|---------------------------------------------------|
| Promise<PreviewOutput\> | Promise used to return the PreviewOutput instance |
| Type | Description |
| ----------------------------------------- | --------------------------- |
| Promise<[PreviewOutput](#previewoutput)\> | Promise used to return the **PreviewOutput** instance.|
**Example**
......@@ -2023,21 +1895,19 @@ camera.createPreviewOutput(surfaceId).then((previewOutput) => {
Implements preview output.
### release(callback: AsyncCallback<void\>): void;
**System Capabilities:**
### release
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**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -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 |
|----------------|-----------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Listens for preview frame start events. This method uses a callback to get the event information.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
| :------- | :---------------- | :-------- | :----------------------------------|
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| :------- | :------------------- | :--- | :------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **frameStart**, indicating the preview frame start event.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -2101,22 +1967,20 @@ previewOutput.on('frameStart', () => {
})
```
### on(type: 'frameEnd', callback: Callback<number\>): void;
**System Capabilities:**
### on('frameEnd')
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**
| Name | Type | Mandatory | Description |
| :------- | :---------------- | :-------- | :----------------------------------|
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| :------- | :------------------- | :--- | :----------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **frameEnd**, indicating the preview frame end event.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -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**
Listens for **PreviewOutput** errors. This method uses a callback to get errors.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------|
| type | string | Yes | Preview output error event. |
| callback | Callback<PreviewOutputError\> | Yes | Callback used to get the preview output errors. |
| Name | Type | Mandatory| Description |
| :------- | :--------------------------------- | :--- | :-------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the preview output error event.|
| callback | ErrorCallback<PreviewOutputError\> | Yes | Callback used to return the preview output errors. |
**Example**
......@@ -2151,22 +2013,20 @@ previewOutput.on('error', (previewOutputError) => {
})
```
## createPhotoOutput(surfaceId: string, callback: AsyncCallback<PhotoOutput\>): void;
**System Capabilities:**
## camera.createPhotoOutput
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**
| Name | Type | Mandatory | Description |
|------------|-------------------------------|-----------|----------------------------------------------------|
| surfaceId | string | Yes | Surface ID received from ImageReceiver |
| callback | AsyncCallback<PhotoOutput\> | Yes | Callback used to return the PhotoOutput instance |
| Name | Type | Mandatory| Description |
| --------- | ------------------------------------------- | ---- | ----------------------------------- |
| surfaceId | string | Yes | Surface ID received from **ImageReceiver**. |
| callback | AsyncCallback<[PhotoOutput](#photooutput)\> | Yes | Callback used to return the **PhotoOutput** instance.|
**Example**
......@@ -2178,29 +2038,27 @@ camera.createPhotoOutput((surfaceId), (err, photoOutput) => {
}
console.log('Callback returned with the PhotoOutput instance.');
});
```
## createPhotoOutput(surfaceId: string): Promise<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**
| Name | Type | Mandatory | Description |
|------------|-----------------|-----------|----------------------------------------------------|
| surfaceId | string | Yes | Surface ID received from ImageReceiver |
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | --------------------------------- |
| surfaceId | string | Yes | Surface ID received from **ImageReceiver**.|
**Return values**
**Return value**
| Type | Description |
|-------------------------|--------------------------------------------------|
| Promise<PhotoOutput\> | Promise used to return the PhotoOutput instance |
| Type | Description |
| ------------------------------------- | -------------------------------------- |
| Promise<[PhotoOutput](#photooutput)\> | Promise used to return the **PhotoOutput** instance.|
**Example**
......@@ -2213,79 +2071,59 @@ camera.createPhotoOutput(surfaceId).then((photoOutput) => {
Enumerates the image rotation angles.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Default Value | Description |
|--------------|---------------|----------------------------------------|
| ROTATION_0 | 0 | The capture image rotates 0 degrees |
| ROTATION_90 | 90 | The capture image rotates 90 degrees |
| ROTATION_180 | 180 | The capture image rotates 180 degrees |
| ROTATION_270 | 270 | The capture image rotates 270 degrees |
**System capability**: SystemCapability.Multimedia.Camera.Core
| Name | Default Value| Description |
| ------------ | ------ | --------------- |
| ROTATION_0 | 0 | The image rotates 0 degrees. |
| ROTATION_90 | 90 | The image rotates 90 degrees. |
| ROTATION_180 | 180 | The image rotates 180 degrees.|
| ROTATION_270 | 270 | The image rotates 270 degrees.|
## Location
Defines the location of a captured image.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
| Name | Type | Access | Description |
|-----------|--------|--------------|-------------|
| latitude | number | read / write | Latitude |
| longitude | number | read / write | Longitude |
## QualityLevel
Enumerates the image quality levels.
**System Capabilities:**
**System capability**: SystemCapability.Multimedia.Camera.Core
SystemCapability.Multimedia.Camera.Core
| Name | Default value | Description |
|----------------------|---------------|----------------------|
| QUALITY_LEVEL_HIGH | 0 | High image quality |
| QUALITY_LEVEL_MEDIUM | 1 | Medium image quality |
| QUALITY_LEVEL_LOW | 2 | Low image quality |
| Name | Default Value| Description |
| -------------------- | ------ | -------------- |
| QUALITY_LEVEL_HIGH | 0 | High image quality. |
| QUALITY_LEVEL_MEDIUM | 1 | Medium image quality.|
| QUALITY_LEVEL_LOW | 2 | Low image quality. |
## PhotoCaptureSetting
Defines the settings for image capture.
**System Capabilities:**
SystemCapability.Multimedia.Camera.Core
**System capability**: SystemCapability.Multimedia.Camera.Core
| Name | Type | Mandatory | Description |
|----------|---------------|-----------|---------------------|
| quality | QualityLevel | Optional | Photo image quality |
| rotation | ImageRotation | Optional | Photo rotation |
| Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | -------------- |
| quality | [QualityLevel](#qualitylevel) | No | Photo image quality. |
| rotation | [ImageRotation](#imagerotation) | No | Photo rotation.|
## PhotoOutput
Implements photo output.
### capture(callback: AsyncCallback<void\>): 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**
Captures a photo. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|----------|---------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -2299,22 +2137,20 @@ photoOutput.capture((err) => {
});
```
### capture(setting: PhotoCaptureSetting, callback: AsyncCallback<void\>): void;
**System Capabilities:**
### capture
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**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|----------------------------------------------|
| setting | PhotoCaptureSetting | Yes | Photo capture settings |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------- | ---- | ------------------------ |
| setting | [PhotoCaptureSetting](#photocapturesetting) | Yes | Photo capture settings. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -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**
Captures a photo with the specified capture settings. This method uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|----------|---------------------|-----------|----------------------------------------------|
| setting | PhotoCaptureSetting | No | Photo capture settings |
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------- | ---- | ---------- |
| setting | [PhotoCaptureSetting](#photocapturesetting) | No | Photo capture settings.|
**Return values**
**Return value**
| Type | Description |
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Releases this **PhotoOutput** instance. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -2387,21 +2219,19 @@ photoOutput.release((err) => {
});
```
### release(): Promise<void\>;
**System Capabilities:**
### release
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 |
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Listens for photo capture start events. This method uses a callback to get the event information.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------|
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<number\> | Yes | Callback used to get the capture ID. |
| Name | Type | Mandatory| Description |
| :------- | :--------------------- | :--- | :----------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **captureStart**, indicating the photo capture start event.|
| callback | AsyncCallback<number\> | Yes | Callback used to return the capture ID. |
**Example**
......@@ -2437,22 +2265,20 @@ photoOutput.on('captureStart', (captureId) => {
})
```
### on(type: 'frameShutter', callback: Callback<FrameShutterInfo\>): void;
**System Capabilities:**
### on('frameShutter')
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**
| Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------|
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<FrameShutterInfo\> | Yes | Callback used to get the frame shutter information.|
| Name | Type | Mandatory| Description |
| :------- | :------------------------------- | :--- | :--------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **frameShutter**, indicating the frame shutter event.|
| callback | AsyncCallback<FrameShutterInfo\> | Yes | Callback used to return the frame shutter information. |
**Example**
......@@ -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**
Listens for photo capture end events. This method uses a callback to get the event information.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :------------------------------------------------|
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<CaptureEndInfo\> | Yes | Callback used to get the capture end information |
| Name | Type | Mandatory| Description |
| :------- | :----------------------------- | :--- | :--------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **captureEnd**, indicating the photo capture end event.|
| callback | AsyncCallback<CaptureEndInfo\> | Yes | Callback used to return the photo capture end information. |
**Example**
......@@ -2489,22 +2313,20 @@ photoOutput.on('captureEnd', (captureEndInfo) => {
})
```
### on(type: 'error', callback: Callback<PhotoOutputError\>): void;
**System Capabilities:**
### on('error')
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**
| Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------|
| type | string | Yes | Photo output error event. |
| callback | Callback<PhotoOutputError\> | Yes | Callback used to get the photo output errors. |
| Name | Type | Mandatory| Description |
| :------- | :------------------------------- | :--- | :---------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the photo output error event.|
| callback | ErrorCallback<PhotoOutputError\> | Yes | Callback used to return the photo output errors. |
**Example**
......@@ -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**
Creates a **VideoOutput** instance. This method uses an asynchronous callback to return the instance.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|------------|-------------------------------|-----------|----------------------------------------------------|
| surfaceId | string | Yes | Surface ID received from VideoRecorder |
| callback | AsyncCallback<VideoOutput\> | Yes | Callback used to return the VideoOutput instance |
| Name | Type | Mandatory| Description |
| --------- | ------------------------------------------- | ---- | ----------------------------------- |
| surfaceId | string | Yes | Surface ID received from **VideoRecorder**. |
| callback | AsyncCallback<[VideoOutput](#videooutput)\> | Yes | Callback used to return the **VideoOutput** instance.|
**Example**
......@@ -2541,29 +2361,27 @@ camera.createVideoOutput((surfaceId), (err, videoOutput) => {
}
console.log('Callback returned with the VideoOutput instance');
});
```
## createVideoOutput(surfaceId: string): Promise<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**
| Name | Type | Mandatory | Description |
|------------|-----------------|-----------|----------------------------------------------------|
| surfaceId | string | Yes | Surface ID received from VideoRecorder |
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | --------------------------------- |
| surfaceId | string | Yes | Surface ID received from **VideoRecorder**.|
**Return values**
**Return value**
| Type | Description |
|---------------------------------------|-------------------------------------------------|
| Promise<[VideoOutput](#videooutput)\> | Promise used to return the VideoOutput instance |
| Type | Description |
| ------------------------------------- | -------------------------------------- |
| Promise<[VideoOutput](#videooutput)\> | Promise used to return the **VideoOutput** instance.|
**Example**
......@@ -2572,25 +2390,24 @@ camera.createVideoOutput(surfaceId).then((videoOutput) => {
console.log('Promise returned with the VideoOutput instance');
})
```
## VideoOutput
Implements video output.
### start(callback: AsyncCallback<void\>): void;
**System Capabilities:**
### start
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**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -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 |
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Stops the video output. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -2657,21 +2470,19 @@ videoOutput.stop((err) => {
});
```
### stop(): Promise<void\>;
**System Capabilities:**
### stop
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 |
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -2681,21 +2492,19 @@ videoOutput.start().then(() => {
})
```
### release(callback: AsyncCallback<void\>): void;
**System Capabilities:**
### release
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**
| Name | Type | Mandatory | Description |
|----------|----------------------|-----------|----------------------------------------------|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result.|
**Example**
......@@ -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 |
|----------------|---------------------------------------------|
| Promise<void\> | Promise used to return the result |
| Type | Description |
| -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.|
**Example**
......@@ -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**
Listens for video frame start events. This method uses a callback to get the event information.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Type | Mandatory | Description |
| :------- | :---------------- | :-------- | :----------------------------------|
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| :------- | :------------------- | :--- | :----------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **frameStart**, indicating the video frame start event.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -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**
| Name | Type | Mandatory | Description |
| :------- | :---------------- | :-------- | :----------------------------------|
| type | string | Yes | Name of the event to listen for. |
| callback | Callback<void\> | Yes | Callback used to return the result |
| Name | Type | Mandatory| Description |
| :------- | :------------------- | :--- | :--------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **frameEnd**, indicating the video frame end event.|
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Example**
......@@ -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**
| Name | Type | Mandatory | Description |
| :------- | :--------------------- | :-------- | :-----------------------------------------------|
| type | string | Yes | Video output error event. |
| callback | Callback<VideoOutputError\> | Yes | Callback used to get the video output errors. |
| Name | Type | Mandatory| Description |
| :------- | :-------------------------- | :--- | :-------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the video output error event.|
| callback | Callback<VideoOutputError\> | Yes | Callback used to return the video output errors. |
**Example**
......@@ -2795,4 +2608,4 @@ Listens for **VideoOutput** errors. This method uses a callback to get errors.
videoOutput.on('error', (VideoOutputError) => {
console.log('Video output error code: ' + VideoOutputError.code);
})
```
\ No newline at end of file
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册