1e41f4b71Sopenharmony_ci# @ohos.multimedia.camera (Camera Management) (System API)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe camera module provides a set of camera service APIs for you to easily develop a camera application. The application can access and operate the camera hardware to implement basic operations, such as preview, taking photos, and recording videos. It can also perform more operations, for example, controlling the flash and exposure time, and focusing or adjusting the focus.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci> - This topic describes only system APIs provided by the module. For details about its public APIs, see [@ohos.multimedia.camera (Camera Management)](js-apis-camera.md).
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Modules to Import
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci```ts
13e41f4b71Sopenharmony_ciimport { camera } from '@kit.CameraKit';
14e41f4b71Sopenharmony_ci```
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci## CameraDevice
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ciDefines the camera device information.
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci| Name          | Type                              | Read-only| Mandatory| Description       |
23e41f4b71Sopenharmony_ci| -------------- | --------------------------------- | ---- | ---- |---------- |
24e41f4b71Sopenharmony_ci| hostDeviceName | string                            | Yes  | Yes  | Name of the remote device. **System API**: This is a system API.|
25e41f4b71Sopenharmony_ci| hostDeviceType | [HostDeviceType](#hostdevicetype) | Yes  | Yes  | Type of the remote device. **System API**: This is a system API.|
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci## HostDeviceType
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ciEnumerates the remote camera types.
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci**System API**: This is a system API.
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci| Name                         | Value      | Description          |
36e41f4b71Sopenharmony_ci| ---------------------------- | ----     | ------------- |
37e41f4b71Sopenharmony_ci| UNKNOWN_TYPE                 | 0        | Unknown type.     |
38e41f4b71Sopenharmony_ci| PHONE                        | 0x0E     | Phone camera.|
39e41f4b71Sopenharmony_ci| TABLET                       | 0x11     | Tablet camera.|
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci## SceneMode<sup>11+</sup>
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ciEnumerates the camera scene modes.
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci| Name                    | Value       | Description        |
48e41f4b71Sopenharmony_ci| ----------------------- | --------- | ------------ |
49e41f4b71Sopenharmony_ci| PORTRAIT_PHOTO       | 3      | Portrait photo mode. **System API**: This is a system API.           |
50e41f4b71Sopenharmony_ci| NIGHT_PHOTO        | 4      | Night photo mode. **System API**: This is a system API.            |
51e41f4b71Sopenharmony_ci| PROFESSIONAL_PHOTO<sup>12+</sup>        | 5      | Professional photo mode. **System API**: This is a system API.            |
52e41f4b71Sopenharmony_ci| PROFESSIONAL_VIDEO<sup>12+</sup>        | 6      | Professional video mode. **System API**: This is a system API.            |
53e41f4b71Sopenharmony_ci| SLOW_MOTION_VIDEO<sup>12+</sup>        | 7   | Slow-motion video mode. **System API**: This is a system API. |
54e41f4b71Sopenharmony_ci| HIGH_RESOLUTION_PHOTO<sup>12+</sup>        | 11     | High-resolution photo mode. **System API**: This is a system API.         |
55e41f4b71Sopenharmony_ci| PANORAMA_PHOTO<sup>12+</sup>        | 15     | Panoramic photo mode. **System API**: This is a system API.         |
56e41f4b71Sopenharmony_ci| TIME_LAPSE_PHOTO<sup>12+</sup>        | 16     | Time-lapse photo mode. **System API**: This is a system API.         |
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci## SlowMotionStatus<sup>12+</sup>
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ciEnumerates the slow-motion states.
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ci| Name            | Value  | Description           |
65e41f4b71Sopenharmony_ci|----------------|-----|---------------|
66e41f4b71Sopenharmony_ci| DISABLED       | 0   | Disabled.     |
67e41f4b71Sopenharmony_ci| READY          | 1   | Ready.     |
68e41f4b71Sopenharmony_ci| VIDEO_START    | 2   | Video start.   |
69e41f4b71Sopenharmony_ci| VIDEO_DONE     | 3   | Video complete.   |
70e41f4b71Sopenharmony_ci| FINISHED       | 4   | Finished.     |
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_ci## LcdFlashStatus<sup>12+</sup>
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ciDescribes the LCD flash information.
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci**System API**: This is a system API.
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci| Name     | Type                         | Read-only| Optional | Description        |
81e41f4b71Sopenharmony_ci| -------- | ----------------------------- |---- |-----| ------------- |
82e41f4b71Sopenharmony_ci| isLcdFlashNeeded   | boolean | Yes | No  | Whether the LCD flash is required.     |
83e41f4b71Sopenharmony_ci| lcdCompensation     | number                 | Yes | No  | LCD flash compensation.      |
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci## Photo<sup>11+</sup>
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ciDefines a higher-resolution image object.
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci**System API**: This is a system API.
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci| Name  | Type                           | Read-only | Optional      | Description|
94e41f4b71Sopenharmony_ci| ------ | ----------------------------- |-----| ---------- | ---------- |
95e41f4b71Sopenharmony_ci| raw<sup>12+</sup> | [image.Image](../apis-image-kit/js-apis-image.md#image9)| NA  | Yes  | Raw image.|
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci## ExposureMode
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ciEnumerates the exposure modes.
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci**System API**: This is a system API.
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci| Name                          | Value  | Description     |
106e41f4b71Sopenharmony_ci| ----------------------------- |-----|---------|
107e41f4b71Sopenharmony_ci| EXPOSURE_MODE_MANUAL<sup>12+</sup>          | 3   | Manual exposure mode.|
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_ci## PolicyType<sup>12+</sup>
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ciEnumerates the policy types.
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ci**System API**: This is a system API.
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci| Name                          | Value  | Description     |
118e41f4b71Sopenharmony_ci| ----------------------------- |-----|---------|
119e41f4b71Sopenharmony_ci| PRIVACY<sup>12+</sup>          | 1   | Privacy.|
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci## CameraManager
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ciImplements camera management. Before calling any API in **CameraManager**, you must use [getCameraManager](js-apis-camera.md#cameragetcameramanager) to obtain a **CameraManager** instance.
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ci### createDepthDataOutput<sup>12+</sup>
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_cicreateDepthDataOutput(profile: Profile): DepthDataOutput
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ciCreates a **DepthDataOutput** instance. This API returns the result synchronously.
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci**System API**: This is a system API.
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ci**Parameters**
136e41f4b71Sopenharmony_ci
137e41f4b71Sopenharmony_ci| Name    | Type                                            | Mandatory| Description                             |
138e41f4b71Sopenharmony_ci| -------- | ----------------------------------------------- | ---- | ------------------------------- |
139e41f4b71Sopenharmony_ci| profile  | [Profile](js-apis-camera.md#profile)                             | Yes  | Supported preview profile, which is obtained through [getSupportedOutputCapability](js-apis-camera.md#getsupportedoutputcapability11).|
140e41f4b71Sopenharmony_ci
141e41f4b71Sopenharmony_ci**Return value**
142e41f4b71Sopenharmony_ci
143e41f4b71Sopenharmony_ci| Type       | Description                         |
144e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
145e41f4b71Sopenharmony_ci| [DepthDataOutput](#depthdataoutput12)    | **DepthDataOutput** instance. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_ci**Error codes**
148e41f4b71Sopenharmony_ci
149e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ci| ID        | Error Message       |
152e41f4b71Sopenharmony_ci| --------------- | --------------- |
153e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.               |
154e41f4b71Sopenharmony_ci| 7400201                |  Camera service fatal error.               |
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ci**Example**
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci```ts
159e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
160e41f4b71Sopenharmony_ci
161e41f4b71Sopenharmony_cifunction createDepthDataOutput(cameraOutputCapability: camera.CameraOutputCapability, cameraManager: camera.CameraManager): camera.DepthDataOutput | undefined {
162e41f4b71Sopenharmony_ci  let profile: camera.Profile = cameraOutputCapability.depthProfiles[0];
163e41f4b71Sopenharmony_ci  let depthDataOutput: camera.DepthDataOutput | undefined = undefined;
164e41f4b71Sopenharmony_ci  try {
165e41f4b71Sopenharmony_ci    depthDataOutput = cameraManager.createDepthDataOutput(profile);
166e41f4b71Sopenharmony_ci  } catch (error) {
167e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
168e41f4b71Sopenharmony_ci    let err = error as BusinessError;
169e41f4b71Sopenharmony_ci    console.error(`The createDepthDataOutput call failed. error code: ${err.code}`);
170e41f4b71Sopenharmony_ci  }
171e41f4b71Sopenharmony_ci  return depthDataOutput;
172e41f4b71Sopenharmony_ci}
173e41f4b71Sopenharmony_ci```
174e41f4b71Sopenharmony_ci
175e41f4b71Sopenharmony_ci### isCameraMuteSupported
176e41f4b71Sopenharmony_ci
177e41f4b71Sopenharmony_ciisCameraMuteSupported(): boolean
178e41f4b71Sopenharmony_ci
179e41f4b71Sopenharmony_ciChecks whether the camera device can be muted.
180e41f4b71Sopenharmony_ci
181e41f4b71Sopenharmony_ci**System API**: This is a system API.
182e41f4b71Sopenharmony_ci
183e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
184e41f4b71Sopenharmony_ci
185e41f4b71Sopenharmony_ci**Return value**
186e41f4b71Sopenharmony_ci
187e41f4b71Sopenharmony_ci| Type       | Description                         |
188e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
189e41f4b71Sopenharmony_ci| boolean    | **true**: The camera device can be muted.<br>**false**: The camera device cannot be muted.|
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ci**Example**
192e41f4b71Sopenharmony_ci
193e41f4b71Sopenharmony_ci```ts
194e41f4b71Sopenharmony_cifunction isCameraMuteSupported(cameraManager: camera.CameraManager): boolean {
195e41f4b71Sopenharmony_ci  let isMuteSupported: boolean = cameraManager.isCameraMuteSupported();
196e41f4b71Sopenharmony_ci  return isMuteSupported;
197e41f4b71Sopenharmony_ci}
198e41f4b71Sopenharmony_ci```
199e41f4b71Sopenharmony_ci
200e41f4b71Sopenharmony_ci### muteCamera
201e41f4b71Sopenharmony_ci
202e41f4b71Sopenharmony_cimuteCamera(mute: boolean): void
203e41f4b71Sopenharmony_ci
204e41f4b71Sopenharmony_ciMutes or unmutes the camera device.
205e41f4b71Sopenharmony_ci
206e41f4b71Sopenharmony_ci> **NOTE**
207e41f4b71Sopenharmony_ci>
208e41f4b71Sopenharmony_ci> This API is supported since API version 10 and deprecated since API version 12. You are advised to use [muteCameraPersistent](#mutecamerapersistent12) instead.
209e41f4b71Sopenharmony_ci
210e41f4b71Sopenharmony_ci**System API**: This is a system API.
211e41f4b71Sopenharmony_ci
212e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
213e41f4b71Sopenharmony_ci
214e41f4b71Sopenharmony_ci**Parameters**
215e41f4b71Sopenharmony_ci
216e41f4b71Sopenharmony_ci| Name     | Type                             | Mandatory | Description       |
217e41f4b71Sopenharmony_ci| -------- | --------------------------------- | ---- | ---------- |
218e41f4b71Sopenharmony_ci| mute     | boolean                           |  Yes |  Whether to mute the camera device. The value **true** means to mute the camera device, and **false** means the opposite. |
219e41f4b71Sopenharmony_ci
220e41f4b71Sopenharmony_ci**Example**
221e41f4b71Sopenharmony_ci
222e41f4b71Sopenharmony_ci```ts
223e41f4b71Sopenharmony_cifunction muteCamera(cameraManager: camera.CameraManager): void {
224e41f4b71Sopenharmony_ci  let mute: boolean = true;
225e41f4b71Sopenharmony_ci  cameraManager.muteCamera(mute);
226e41f4b71Sopenharmony_ci}
227e41f4b71Sopenharmony_ci```
228e41f4b71Sopenharmony_ci
229e41f4b71Sopenharmony_ci### muteCameraPersistent<sup>12+</sup>
230e41f4b71Sopenharmony_ci
231e41f4b71Sopenharmony_cimuteCameraPersistent(mute: boolean, type: PolicyType): void
232e41f4b71Sopenharmony_ci
233e41f4b71Sopenharmony_ciDisables the camera in a persistent manner.
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ci**System API**: This is a system API.
236e41f4b71Sopenharmony_ci
237e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
238e41f4b71Sopenharmony_ci
239e41f4b71Sopenharmony_ci**Parameters**
240e41f4b71Sopenharmony_ci
241e41f4b71Sopenharmony_ci| Name     | Type                         | Mandatory | Description                                        |
242e41f4b71Sopenharmony_ci| -------- |-----------------------------| ---- |--------------------------------------------|
243e41f4b71Sopenharmony_ci| mute     | boolean                     |  Yes | Whether to mute the camera device. The value **true** means to mute the camera device, and **false** means the opposite.                  |
244e41f4b71Sopenharmony_ci| type     | [PolicyType](#policytype12) |  Yes | Policy type. For details about the available options, see [PolicyType](#policytype12).|
245e41f4b71Sopenharmony_ci
246e41f4b71Sopenharmony_ci**Example**
247e41f4b71Sopenharmony_ci
248e41f4b71Sopenharmony_ci```ts
249e41f4b71Sopenharmony_cifunction muteCameraPersistent(cameraManager: camera.CameraManager): void {
250e41f4b71Sopenharmony_ci  let mute: boolean = true;
251e41f4b71Sopenharmony_ci  cameraManager.muteCameraPersistent(mute, camera.PolicyType.PRIVACY);
252e41f4b71Sopenharmony_ci}
253e41f4b71Sopenharmony_ci```
254e41f4b71Sopenharmony_ci
255e41f4b71Sopenharmony_ci### on('cameraMute')
256e41f4b71Sopenharmony_ci
257e41f4b71Sopenharmony_cion(type: 'cameraMute', callback: AsyncCallback\<boolean\>): void
258e41f4b71Sopenharmony_ci
259e41f4b71Sopenharmony_ciSubscribes to camera mute status events. This API uses an asynchronous callback to return the result.
260e41f4b71Sopenharmony_ci
261e41f4b71Sopenharmony_ci**System API**: This is a system API.
262e41f4b71Sopenharmony_ci
263e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
264e41f4b71Sopenharmony_ci
265e41f4b71Sopenharmony_ci**Parameters**
266e41f4b71Sopenharmony_ci
267e41f4b71Sopenharmony_ci| Name    | Type            | Mandatory| Description      |
268e41f4b71Sopenharmony_ci| -------- | --------------- | ---- | --------- |
269e41f4b71Sopenharmony_ci| type     | string          | Yes  | Event type. The value is fixed at **'cameraMute'**, indicating the camera mute status. The event can be listened for when a **CameraManager** instance is obtained. This event is triggered and the status is returned when the camera device is muted or unmuted.|
270e41f4b71Sopenharmony_ci| callback | AsyncCallback\<boolean> | Yes  | Callback used to return the mute status. The value **true** means that the camera is enabled, and **false** means that the camera is disabled.              |
271e41f4b71Sopenharmony_ci
272e41f4b71Sopenharmony_ci**Example**
273e41f4b71Sopenharmony_ci
274e41f4b71Sopenharmony_ci```ts
275e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
276e41f4b71Sopenharmony_ci
277e41f4b71Sopenharmony_cifunction callback(err: BusinessError, curMuted: boolean): void {
278e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
279e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
280e41f4b71Sopenharmony_ci    return;
281e41f4b71Sopenharmony_ci  }
282e41f4b71Sopenharmony_ci  let isMuted: boolean = curMuted;
283e41f4b71Sopenharmony_ci  console.info(`cameraMute status: ${isMuted}`);
284e41f4b71Sopenharmony_ci}
285e41f4b71Sopenharmony_ci
286e41f4b71Sopenharmony_cifunction registerCameraMute(cameraManager: camera.CameraManager): void {
287e41f4b71Sopenharmony_ci  cameraManager.on('cameraMute', callback);
288e41f4b71Sopenharmony_ci}
289e41f4b71Sopenharmony_ci```
290e41f4b71Sopenharmony_ci
291e41f4b71Sopenharmony_ci### off('cameraMute')
292e41f4b71Sopenharmony_ci
293e41f4b71Sopenharmony_cioff(type: 'cameraMute', callback?: AsyncCallback\<boolean\>): void
294e41f4b71Sopenharmony_ci
295e41f4b71Sopenharmony_ciUnsubscribes from camera mute status events.
296e41f4b71Sopenharmony_ci
297e41f4b71Sopenharmony_ci**System API**: This is a system API.
298e41f4b71Sopenharmony_ci
299e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
300e41f4b71Sopenharmony_ci
301e41f4b71Sopenharmony_ci**Parameters**
302e41f4b71Sopenharmony_ci
303e41f4b71Sopenharmony_ci| Name    | Type            | Mandatory| Description                                                     |
304e41f4b71Sopenharmony_ci| -------- | --------------- | ---- |---------------------------------------------------------|
305e41f4b71Sopenharmony_ci| type     | string          | Yes  | Event type. The value is fixed at **'cameraMute'**, indicating the camera mute status. The event can be listened for when a **CameraManager** instance is obtained.|
306e41f4b71Sopenharmony_ci| callback | AsyncCallback\<boolean> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('cameraMute')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)                 |
307e41f4b71Sopenharmony_ci
308e41f4b71Sopenharmony_ci**Example**
309e41f4b71Sopenharmony_ci
310e41f4b71Sopenharmony_ci```ts
311e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
312e41f4b71Sopenharmony_ci
313e41f4b71Sopenharmony_cifunction callback(err: BusinessError, curMuted: boolean): void {
314e41f4b71Sopenharmony_ci  let isMuted: boolean = curMuted;
315e41f4b71Sopenharmony_ci}
316e41f4b71Sopenharmony_ci
317e41f4b71Sopenharmony_cifunction unregisterCameraMute(cameraManager: camera.CameraManager): void {
318e41f4b71Sopenharmony_ci  cameraManager.off('cameraMute', callback);
319e41f4b71Sopenharmony_ci}
320e41f4b71Sopenharmony_ci```
321e41f4b71Sopenharmony_ci
322e41f4b71Sopenharmony_ci### isPrelaunchSupported
323e41f4b71Sopenharmony_ci
324e41f4b71Sopenharmony_ciisPrelaunchSupported(camera: CameraDevice): boolean
325e41f4b71Sopenharmony_ci
326e41f4b71Sopenharmony_ciChecks whether a camera device supports prelaunch.
327e41f4b71Sopenharmony_ci
328e41f4b71Sopenharmony_ci**System API**: This is a system API.
329e41f4b71Sopenharmony_ci
330e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
331e41f4b71Sopenharmony_ci
332e41f4b71Sopenharmony_ci**Parameters**
333e41f4b71Sopenharmony_ci
334e41f4b71Sopenharmony_ci| Name    | Type            | Mandatory| Description      |
335e41f4b71Sopenharmony_ci| -------- | --------------- | ---- | --------- |
336e41f4b71Sopenharmony_ci| camera | [CameraDevice](#cameradevice) | Yes| Camera device.|
337e41f4b71Sopenharmony_ci
338e41f4b71Sopenharmony_ci**Return value**
339e41f4b71Sopenharmony_ci
340e41f4b71Sopenharmony_ci| Type| Description|
341e41f4b71Sopenharmony_ci| -------- | --------------- |
342e41f4b71Sopenharmony_ci| boolean | **true**: The camera device supports prelaunch.<br>**false**: The camera device does not support prelaunch.|
343e41f4b71Sopenharmony_ci
344e41f4b71Sopenharmony_ci**Error codes**
345e41f4b71Sopenharmony_ci
346e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
347e41f4b71Sopenharmony_ci
348e41f4b71Sopenharmony_ci| ID        | Error Message       |
349e41f4b71Sopenharmony_ci| --------------- | --------------- |
350e41f4b71Sopenharmony_ci| 202 | Not System Application. |
351e41f4b71Sopenharmony_ci| 7400101 | Parameter missing or parameter type incorrect. |
352e41f4b71Sopenharmony_ci
353e41f4b71Sopenharmony_ci**Example**
354e41f4b71Sopenharmony_ci
355e41f4b71Sopenharmony_ci```ts
356e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit';
357e41f4b71Sopenharmony_ci
358e41f4b71Sopenharmony_cifunction isPreLaunchSupported(context: common.BaseContext): boolean {
359e41f4b71Sopenharmony_ci  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
360e41f4b71Sopenharmony_ci  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
361e41f4b71Sopenharmony_ci  let isSupported: boolean = false;
362e41f4b71Sopenharmony_ci  if (cameras && cameras.length >= 1) {
363e41f4b71Sopenharmony_ci    isSupported = cameraManager.isPrelaunchSupported(cameras[0]);
364e41f4b71Sopenharmony_ci    console.info(`PreLaunch supported states: ${isSupported}`);
365e41f4b71Sopenharmony_ci    return isSupported;
366e41f4b71Sopenharmony_ci  }
367e41f4b71Sopenharmony_ci  return isSupported;
368e41f4b71Sopenharmony_ci}
369e41f4b71Sopenharmony_ci```
370e41f4b71Sopenharmony_ci
371e41f4b71Sopenharmony_ci### setPrelaunchConfig
372e41f4b71Sopenharmony_ci
373e41f4b71Sopenharmony_cisetPrelaunchConfig(prelaunchConfig: PrelaunchConfig): void
374e41f4b71Sopenharmony_ci
375e41f4b71Sopenharmony_ciSets prelaunch configuration.
376e41f4b71Sopenharmony_ci
377e41f4b71Sopenharmony_ciBefore the setting, call [isPrelaunchSupported](#isprelaunchsupported) to check whether the camera device supports prelaunch.
378e41f4b71Sopenharmony_ci
379e41f4b71Sopenharmony_ci**System API**: This is a system API.
380e41f4b71Sopenharmony_ci
381e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.CAMERA
382e41f4b71Sopenharmony_ci
383e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
384e41f4b71Sopenharmony_ci
385e41f4b71Sopenharmony_ci**Parameters**
386e41f4b71Sopenharmony_ci
387e41f4b71Sopenharmony_ci| Name    | Type            | Mandatory| Description      |
388e41f4b71Sopenharmony_ci| -------- | --------------- | ---- | --------- |
389e41f4b71Sopenharmony_ci| prelaunchConfig | [PrelaunchConfig](#prelaunchconfig) | Yes| Prelaunch configuration.|
390e41f4b71Sopenharmony_ci
391e41f4b71Sopenharmony_ci**Error codes**
392e41f4b71Sopenharmony_ci
393e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
394e41f4b71Sopenharmony_ci
395e41f4b71Sopenharmony_ci| ID        | Error Message       |
396e41f4b71Sopenharmony_ci| --------------- | --------------- |
397e41f4b71Sopenharmony_ci| 202 | Not System Application. |
398e41f4b71Sopenharmony_ci| 7400101 | Parameter missing or parameter type incorrect. |
399e41f4b71Sopenharmony_ci| 7400102 | Operation not allowed. |
400e41f4b71Sopenharmony_ci| 7400201 | Camera service fatal error. |
401e41f4b71Sopenharmony_ci
402e41f4b71Sopenharmony_ci**Example**
403e41f4b71Sopenharmony_ci
404e41f4b71Sopenharmony_ci```ts
405e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit';
406e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
407e41f4b71Sopenharmony_ci
408e41f4b71Sopenharmony_cifunction setPrelaunchConfig(context: common.BaseContext): void {
409e41f4b71Sopenharmony_ci  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
410e41f4b71Sopenharmony_ci  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
411e41f4b71Sopenharmony_ci  if (cameras && cameras.length >= 1) {
412e41f4b71Sopenharmony_ci    let cameraDevice: camera.CameraDevice = cameras[0];
413e41f4b71Sopenharmony_ci    if(cameraManager.isPrelaunchSupported(cameraDevice)) {
414e41f4b71Sopenharmony_ci      try {
415e41f4b71Sopenharmony_ci        cameraManager.setPrelaunchConfig({cameraDevice: cameraDevice});
416e41f4b71Sopenharmony_ci      } catch (error) {
417e41f4b71Sopenharmony_ci        let err = error as BusinessError;
418e41f4b71Sopenharmony_ci        console.error(`setPrelaunchConfig error. Code: ${err.code}, message: ${err.message}`);
419e41f4b71Sopenharmony_ci      }
420e41f4b71Sopenharmony_ci    }
421e41f4b71Sopenharmony_ci  }
422e41f4b71Sopenharmony_ci}
423e41f4b71Sopenharmony_ci```
424e41f4b71Sopenharmony_ci
425e41f4b71Sopenharmony_ci### prelaunch
426e41f4b71Sopenharmony_ci
427e41f4b71Sopenharmony_ciprelaunch(): void
428e41f4b71Sopenharmony_ci
429e41f4b71Sopenharmony_ciPrelaunches the camera device. This API is called when a user clicks the system camera icon to start the camera application.
430e41f4b71Sopenharmony_ci
431e41f4b71Sopenharmony_ci**System API**: This is a system API.
432e41f4b71Sopenharmony_ci
433e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
434e41f4b71Sopenharmony_ci
435e41f4b71Sopenharmony_ci**Example**
436e41f4b71Sopenharmony_ci
437e41f4b71Sopenharmony_ci```ts
438e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit';
439e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
440e41f4b71Sopenharmony_ci
441e41f4b71Sopenharmony_cifunction preLaunch(context: common.BaseContext): void {
442e41f4b71Sopenharmony_ci  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
443e41f4b71Sopenharmony_ci  try {
444e41f4b71Sopenharmony_ci    cameraManager.prelaunch();
445e41f4b71Sopenharmony_ci  } catch (error) {
446e41f4b71Sopenharmony_ci    let err = error as BusinessError;
447e41f4b71Sopenharmony_ci    console.error(`prelaunch error. Code: ${err.code}, message: ${err.message}`);
448e41f4b71Sopenharmony_ci  }
449e41f4b71Sopenharmony_ci}
450e41f4b71Sopenharmony_ci```
451e41f4b71Sopenharmony_ci
452e41f4b71Sopenharmony_ci### createDeferredPreviewOutput
453e41f4b71Sopenharmony_ci
454e41f4b71Sopenharmony_cicreateDeferredPreviewOutput(profile: Profile): PreviewOutput
455e41f4b71Sopenharmony_ci
456e41f4b71Sopenharmony_ciCreates a deferred **PreviewOutput** instance and adds it, instead of a common **PreviewOutput** instance, to the data stream during stream configuration.
457e41f4b71Sopenharmony_ci
458e41f4b71Sopenharmony_ci**System API**: This is a system API.
459e41f4b71Sopenharmony_ci
460e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
461e41f4b71Sopenharmony_ci
462e41f4b71Sopenharmony_ci**Parameters**
463e41f4b71Sopenharmony_ci
464e41f4b71Sopenharmony_ci| Name    | Type            | Mandatory| Description      |
465e41f4b71Sopenharmony_ci| -------- | --------------- | ---- | --------- |
466e41f4b71Sopenharmony_ci| profile | [Profile](js-apis-camera.md#profile) | Yes| Configuration file of the camera preview stream.|
467e41f4b71Sopenharmony_ci
468e41f4b71Sopenharmony_ci**Return value**
469e41f4b71Sopenharmony_ci
470e41f4b71Sopenharmony_ci| Type| Description|
471e41f4b71Sopenharmony_ci| -------- | --------------- |
472e41f4b71Sopenharmony_ci| [PreviewOutput](#previewoutput) | **PreviewOutput** instance obtained.|
473e41f4b71Sopenharmony_ci
474e41f4b71Sopenharmony_ci**Error codes**
475e41f4b71Sopenharmony_ci
476e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
477e41f4b71Sopenharmony_ci
478e41f4b71Sopenharmony_ci| ID        | Error Message       |
479e41f4b71Sopenharmony_ci| --------------- | --------------- |
480e41f4b71Sopenharmony_ci| 202         	  |  Not System Application.       |
481e41f4b71Sopenharmony_ci| 7400101 	      |  Parameter missing or parameter type incorrect. |
482e41f4b71Sopenharmony_ci
483e41f4b71Sopenharmony_ci**Example**
484e41f4b71Sopenharmony_ci
485e41f4b71Sopenharmony_ci```ts
486e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit';
487e41f4b71Sopenharmony_ci
488e41f4b71Sopenharmony_cifunction getDeferredPreviewOutput(context: common.BaseContext, previewProfile: camera.Profile): camera.PreviewOutput {
489e41f4b71Sopenharmony_ci  const cameraManager: camera.CameraManager = camera.getCameraManager(context);
490e41f4b71Sopenharmony_ci  const output: camera.PreviewOutput = cameraManager.createDeferredPreviewOutput(previewProfile);
491e41f4b71Sopenharmony_ci  return output;
492e41f4b71Sopenharmony_ci}
493e41f4b71Sopenharmony_ci```
494e41f4b71Sopenharmony_ci
495e41f4b71Sopenharmony_ci### preSwitchCamera<sup>11+</sup>
496e41f4b71Sopenharmony_ci
497e41f4b71Sopenharmony_cipreSwitchCamera(cameraId: string): void
498e41f4b71Sopenharmony_ci
499e41f4b71Sopenharmony_ciPre-switches a camera device to speed up its startup.
500e41f4b71Sopenharmony_ci
501e41f4b71Sopenharmony_ci**System API**: This is a system API.
502e41f4b71Sopenharmony_ci
503e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
504e41f4b71Sopenharmony_ci
505e41f4b71Sopenharmony_ci**Parameters**
506e41f4b71Sopenharmony_ci
507e41f4b71Sopenharmony_ci| Name    | Type            | Mandatory| Description      |
508e41f4b71Sopenharmony_ci| -------- | --------------- | ---- | --------- |
509e41f4b71Sopenharmony_ci| cameraId | string | Yes| Camera ID.|
510e41f4b71Sopenharmony_ci
511e41f4b71Sopenharmony_ci**Error codes**
512e41f4b71Sopenharmony_ci
513e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
514e41f4b71Sopenharmony_ci
515e41f4b71Sopenharmony_ci| ID  | Error Message                                          |
516e41f4b71Sopenharmony_ci| ------- |------------------------------------------------|
517e41f4b71Sopenharmony_ci| 202     | Not System Application.                        |
518e41f4b71Sopenharmony_ci| 7400101 | Parameter missing or parameter type incorrect. |
519e41f4b71Sopenharmony_ci| 7400201 | Camera service fatal error.                    |
520e41f4b71Sopenharmony_ci
521e41f4b71Sopenharmony_ci**Example**
522e41f4b71Sopenharmony_ci
523e41f4b71Sopenharmony_ci```ts
524e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit';
525e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
526e41f4b71Sopenharmony_ci
527e41f4b71Sopenharmony_cifunction preSwitch(cameraDevice: camera.CameraDevice, context: common.BaseContext): void {
528e41f4b71Sopenharmony_ci  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
529e41f4b71Sopenharmony_ci  try {
530e41f4b71Sopenharmony_ci    cameraManager.preSwitchCamera(cameraDevice.cameraId);
531e41f4b71Sopenharmony_ci  } catch (error) {
532e41f4b71Sopenharmony_ci    let err = error as BusinessError;
533e41f4b71Sopenharmony_ci    console.error(`prelaunch error. Code: ${err.code}, message: ${err.message}`);
534e41f4b71Sopenharmony_ci  }
535e41f4b71Sopenharmony_ci}
536e41f4b71Sopenharmony_ci```
537e41f4b71Sopenharmony_ci
538e41f4b71Sopenharmony_ci## CameraOutputCapability<sup>12+</sup>
539e41f4b71Sopenharmony_ci
540e41f4b71Sopenharmony_ciDescribes the camera output capability.
541e41f4b71Sopenharmony_ci
542e41f4b71Sopenharmony_ci**System API**: This is a system API.
543e41f4b71Sopenharmony_ci
544e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
545e41f4b71Sopenharmony_ci
546e41f4b71Sopenharmony_ci| Name                          | Type                                               | Read-only| Optional| Description               |
547e41f4b71Sopenharmony_ci| ----------------------------- | --------------------------------------------------- | ---- | ---- |-------------------|
548e41f4b71Sopenharmony_ci| depthProfiles                 | Array\<[DepthProfile](#depthprofile12)\>              |  Yes | No| Supported depth stream profiles.       |
549e41f4b71Sopenharmony_ci
550e41f4b71Sopenharmony_ci## CameraFormat
551e41f4b71Sopenharmony_ci
552e41f4b71Sopenharmony_ciEnumerates the camera output formats.
553e41f4b71Sopenharmony_ci
554e41f4b71Sopenharmony_ci**System API**: This is a system API.
555e41f4b71Sopenharmony_ci
556e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
557e41f4b71Sopenharmony_ci
558e41f4b71Sopenharmony_ci| Name                    | Value       | Description        |
559e41f4b71Sopenharmony_ci| ----------------------- | --------- | ------------ |
560e41f4b71Sopenharmony_ci| CAMERA_FORMAT_DEPTH_16<sup>12+</sup> |   3000   | Depth map in DEPTH_16 format.     |
561e41f4b71Sopenharmony_ci| CAMERA_FORMAT_DEPTH_32<sup>12+</sup> |   3001   | Depth map in DEPTH_32 format.     |
562e41f4b71Sopenharmony_ci
563e41f4b71Sopenharmony_ci## DepthDataAccuracy<sup>12+</sup>
564e41f4b71Sopenharmony_ci
565e41f4b71Sopenharmony_ciDescribes the accuracy of depth data.
566e41f4b71Sopenharmony_ci
567e41f4b71Sopenharmony_ci**System API**: This is a system API.
568e41f4b71Sopenharmony_ci
569e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
570e41f4b71Sopenharmony_ci
571e41f4b71Sopenharmony_ci| Name     | Type                         | Read-only| Optional| Description           |
572e41f4b71Sopenharmony_ci| -------- | ----------------------------- |----- |---| -------------- |
573e41f4b71Sopenharmony_ci| DEPTH_DATA_ACCURACY_RELATIVE      | number                        |  Yes | No| Relative accuracy, which is the depth map calculated based on the disparity.     |
574e41f4b71Sopenharmony_ci| DEPTH_DATA_ACCURACY_ABSOLUTE      | number                        |  Yes | No| Absolute accuracy, which is the depth map calculated from distance measurement.     |
575e41f4b71Sopenharmony_ci
576e41f4b71Sopenharmony_ci## DepthProfile<sup>12+</sup>
577e41f4b71Sopenharmony_ci
578e41f4b71Sopenharmony_ciDescribes the profile of depth data. It inherits from [Profile](js-apis-camera.md#profile).
579e41f4b71Sopenharmony_ci
580e41f4b71Sopenharmony_ci**System API**: This is a system API.
581e41f4b71Sopenharmony_ci
582e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
583e41f4b71Sopenharmony_ci
584e41f4b71Sopenharmony_ci| Name                      | Type                                     | Read-only| Optional| Description       |
585e41f4b71Sopenharmony_ci| ------------------------- | ----------------------------------------- | --- | ---- |----------- |
586e41f4b71Sopenharmony_ci| depthDataAccuracy            | [DepthDataAccuracy](#depthdataaccuracy12)         | Yes |  No | Accuracy of the depth data, which can be either relative accuracy or absolute accuracy.|
587e41f4b71Sopenharmony_ci
588e41f4b71Sopenharmony_ci## DepthDataQualityLevel<sup>12+</sup>
589e41f4b71Sopenharmony_ci
590e41f4b71Sopenharmony_ciEnumerates the quality levels of depth data.
591e41f4b71Sopenharmony_ci
592e41f4b71Sopenharmony_ci**System API**: This is a system API.
593e41f4b71Sopenharmony_ci
594e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
595e41f4b71Sopenharmony_ci
596e41f4b71Sopenharmony_ci| Name     | Type                         | Read-only| Optional| Description           |
597e41f4b71Sopenharmony_ci| -------- | ----------------------------- |----- |---| -------------- |
598e41f4b71Sopenharmony_ci| DEPTH_DATA_QUALITY_BAD     | number            |  Yes | No| The depth map is of poor quality and cannot be used for blurring.     |
599e41f4b71Sopenharmony_ci| DEPTH_DATA_QUALITY_FAIR      | number          |  Yes | No| The depth map is of average quality and cannot be used for high-quality blurring.     |
600e41f4b71Sopenharmony_ci| DEPTH_DATA_QUALITY_GOOD      | number          |  Yes | No| The depth map is of high quality and can be used for high-quality blurring.     |
601e41f4b71Sopenharmony_ci
602e41f4b71Sopenharmony_ci## DepthData<sup>12+</sup>
603e41f4b71Sopenharmony_ci
604e41f4b71Sopenharmony_ciDescribes a depth data object.
605e41f4b71Sopenharmony_ci
606e41f4b71Sopenharmony_ci### Properties
607e41f4b71Sopenharmony_ci
608e41f4b71Sopenharmony_ci**System API**: This is a system API.
609e41f4b71Sopenharmony_ci
610e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
611e41f4b71Sopenharmony_ci
612e41f4b71Sopenharmony_ci| Name     | Type                         | Read-only| Optional| Description           |
613e41f4b71Sopenharmony_ci| -------- | ----------------------------- |----- |---| -------------- |
614e41f4b71Sopenharmony_ci| format | [CameraFormat](#cameraformat)   | Yes|  No | Camera output format.|
615e41f4b71Sopenharmony_ci| depthMap | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)    | Yes|  No | Depth map.|
616e41f4b71Sopenharmony_ci| qualityLevel | [DepthDataQualityLevel](#depthdataqualitylevel12)   | Yes|  No | Quality level of the depth map.|
617e41f4b71Sopenharmony_ci| accuracy | [DepthDataAccuracy](#depthdataaccuracy12) | Yes|  No | Accuracy of the depth map.|
618e41f4b71Sopenharmony_ci
619e41f4b71Sopenharmony_ci### release<sup>12+</sup>
620e41f4b71Sopenharmony_ci
621e41f4b71Sopenharmony_cirelease(): void
622e41f4b71Sopenharmony_ci
623e41f4b71Sopenharmony_ciReleases depth data output resources.
624e41f4b71Sopenharmony_ci
625e41f4b71Sopenharmony_ci**System API**: This is a system API.
626e41f4b71Sopenharmony_ci
627e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
628e41f4b71Sopenharmony_ci
629e41f4b71Sopenharmony_ci**Example**
630e41f4b71Sopenharmony_ci
631e41f4b71Sopenharmony_ci```ts
632e41f4b71Sopenharmony_cifunction releaseDepthData(depthData: camera.DepthData): void {
633e41f4b71Sopenharmony_ci  await depthData.release();
634e41f4b71Sopenharmony_ci}
635e41f4b71Sopenharmony_ci```
636e41f4b71Sopenharmony_ci
637e41f4b71Sopenharmony_ci## DepthDataOutput<sup>12+</sup>
638e41f4b71Sopenharmony_ci
639e41f4b71Sopenharmony_ciImplements depth data output. It inherits from [CameraOutput](js-apis-camera.md#cameraoutput).
640e41f4b71Sopenharmony_ci
641e41f4b71Sopenharmony_ci### start<sup>12+</sup>
642e41f4b71Sopenharmony_ci
643e41f4b71Sopenharmony_cistart(): Promise\<void\>
644e41f4b71Sopenharmony_ci
645e41f4b71Sopenharmony_ciStarts a depth data output stream. This API uses a promise to return the result.
646e41f4b71Sopenharmony_ci
647e41f4b71Sopenharmony_ci**System API**: This is a system API.
648e41f4b71Sopenharmony_ci
649e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
650e41f4b71Sopenharmony_ci
651e41f4b71Sopenharmony_ci**Return value**
652e41f4b71Sopenharmony_ci
653e41f4b71Sopenharmony_ci| Type           | Description                    |
654e41f4b71Sopenharmony_ci| -------------- | ----------------------- |
655e41f4b71Sopenharmony_ci| Promise\<void\> | Promise that returns no value.|
656e41f4b71Sopenharmony_ci
657e41f4b71Sopenharmony_ci**Error codes**
658e41f4b71Sopenharmony_ci
659e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
660e41f4b71Sopenharmony_ci
661e41f4b71Sopenharmony_ci| ID        | Error Message       |
662e41f4b71Sopenharmony_ci| --------------- | --------------- |
663e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
664e41f4b71Sopenharmony_ci| 7400201                |  Camera service fatal error.                           |
665e41f4b71Sopenharmony_ci
666e41f4b71Sopenharmony_ci**Example**
667e41f4b71Sopenharmony_ci
668e41f4b71Sopenharmony_ci```ts
669e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
670e41f4b71Sopenharmony_ci
671e41f4b71Sopenharmony_cifunction startDepthDataOutput(depthDataOutput: camera.DepthDataOutput): void {
672e41f4b71Sopenharmony_ci  depthDataOutput.start().then(() => {
673e41f4b71Sopenharmony_ci    console.info('Promise returned to indicate that start method execution success.');
674e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
675e41f4b71Sopenharmony_ci    console.error(`Failed to depth data output start, error code: ${error.code}.`);
676e41f4b71Sopenharmony_ci  });
677e41f4b71Sopenharmony_ci}
678e41f4b71Sopenharmony_ci```
679e41f4b71Sopenharmony_ci
680e41f4b71Sopenharmony_ci### stop<sup>12+</sup>
681e41f4b71Sopenharmony_ci
682e41f4b71Sopenharmony_cistop(): Promise\<void\>
683e41f4b71Sopenharmony_ci
684e41f4b71Sopenharmony_ciStops a depth data output stream. This API uses a promise to return the result.
685e41f4b71Sopenharmony_ci
686e41f4b71Sopenharmony_ci**System API**: This is a system API.
687e41f4b71Sopenharmony_ci
688e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
689e41f4b71Sopenharmony_ci
690e41f4b71Sopenharmony_ci**Return value**
691e41f4b71Sopenharmony_ci
692e41f4b71Sopenharmony_ci| Type           | Description                    |
693e41f4b71Sopenharmony_ci| -------------- | ----------------------- |
694e41f4b71Sopenharmony_ci| Promise\<void\> | Promise that returns no value.|
695e41f4b71Sopenharmony_ci
696e41f4b71Sopenharmony_ci**Example**
697e41f4b71Sopenharmony_ci
698e41f4b71Sopenharmony_ci```ts
699e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
700e41f4b71Sopenharmony_ci
701e41f4b71Sopenharmony_cifunction stopDepthDataOutput(depthDataOutput: camera.DepthDataOutput): void {
702e41f4b71Sopenharmony_ci  depthDataOutput.stop().then(() => {
703e41f4b71Sopenharmony_ci    console.info('Promise returned to indicate that stop method execution success.');
704e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
705e41f4b71Sopenharmony_ci    console.error(`Failed to depth data output stop, error code: ${error.code}.`);
706e41f4b71Sopenharmony_ci  });
707e41f4b71Sopenharmony_ci}
708e41f4b71Sopenharmony_ci```
709e41f4b71Sopenharmony_ci
710e41f4b71Sopenharmony_ci### on('depthDataAvailable')<sup>12+</sup>
711e41f4b71Sopenharmony_ci
712e41f4b71Sopenharmony_cion(type: 'depthDataAvailable', callback: AsyncCallback\<DepthData\>): void
713e41f4b71Sopenharmony_ci
714e41f4b71Sopenharmony_ciSubscribes to depth data availability events. This API uses an asynchronous callback to return the result.
715e41f4b71Sopenharmony_ci
716e41f4b71Sopenharmony_ci> **NOTE**
717e41f4b71Sopenharmony_ci>
718e41f4b71Sopenharmony_ci> Currently, you cannot use **off()** to unregister the callback in the callback method of **on()**.
719e41f4b71Sopenharmony_ci
720e41f4b71Sopenharmony_ci**System API**: This is a system API.
721e41f4b71Sopenharmony_ci
722e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
723e41f4b71Sopenharmony_ci
724e41f4b71Sopenharmony_ci**Parameters**
725e41f4b71Sopenharmony_ci
726e41f4b71Sopenharmony_ci| Name    | Type     | Mandatory| Description                                 |
727e41f4b71Sopenharmony_ci| -------- | ---------- | --- | ------------------------------------ |
728e41f4b71Sopenharmony_ci| type     | string     | Yes  | Event type. The value is fixed at **'depthDataAvailable'**. The event can be listened for when a **depthDataOutput** instance is created.|
729e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[DepthData](#depthdata12)\> | Yes  | Callback used to listen for depth data.|
730e41f4b71Sopenharmony_ci
731e41f4b71Sopenharmony_ci**Example**
732e41f4b71Sopenharmony_ci
733e41f4b71Sopenharmony_ci```ts
734e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
735e41f4b71Sopenharmony_ci
736e41f4b71Sopenharmony_cifunction callback(err: BusinessError, depthData: camera.DepthData): void {
737e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
738e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
739e41f4b71Sopenharmony_ci    return;
740e41f4b71Sopenharmony_ci  }
741e41f4b71Sopenharmony_ci}
742e41f4b71Sopenharmony_ci
743e41f4b71Sopenharmony_cifunction registerDepthDataAvailable(depthDataOutput: camera.DepthDataOutput): void {
744e41f4b71Sopenharmony_ci  depthDataOutput.on('depthDataAvailable', callback);
745e41f4b71Sopenharmony_ci}
746e41f4b71Sopenharmony_ci```
747e41f4b71Sopenharmony_ci
748e41f4b71Sopenharmony_ci### off('depthDataAvailable')<sup>12+</sup>
749e41f4b71Sopenharmony_ci
750e41f4b71Sopenharmony_cioff(type: 'depthDataAvailable', callback?: AsyncCallback\<DepthData\>): void
751e41f4b71Sopenharmony_ci
752e41f4b71Sopenharmony_ciUnsubscribes from depth data availability events.
753e41f4b71Sopenharmony_ci
754e41f4b71Sopenharmony_ci**System API**: This is a system API.
755e41f4b71Sopenharmony_ci
756e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
757e41f4b71Sopenharmony_ci
758e41f4b71Sopenharmony_ci**Parameters**
759e41f4b71Sopenharmony_ci
760e41f4b71Sopenharmony_ci| Name     | Type                   | Mandatory| Description                                      |
761e41f4b71Sopenharmony_ci| -------- | ---------------------- | ---- | ------------------------------------------ |
762e41f4b71Sopenharmony_ci| type     | string                 | Yes  | Event type. The value is fixed at **'depthDataAvailable'**. The event can be listened for when a **depthDataOutput** instance is created.|
763e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[DepthData](#depthdata12)\> | No  | Callback used to return the result. If this parameter is specified, the subscription to the specified event with the specified callback is canceled. (The callback object cannot be an anonymous function.) Otherwise, the subscriptions to the specified event with all the callbacks are canceled.|
764e41f4b71Sopenharmony_ci
765e41f4b71Sopenharmony_ci**Example**
766e41f4b71Sopenharmony_ci
767e41f4b71Sopenharmony_ci```ts
768e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
769e41f4b71Sopenharmony_ci
770e41f4b71Sopenharmony_cifunction callback(err: BusinessError, depthData: camera.DepthData): void {
771e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
772e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
773e41f4b71Sopenharmony_ci    return;
774e41f4b71Sopenharmony_ci  }
775e41f4b71Sopenharmony_ci}
776e41f4b71Sopenharmony_ci
777e41f4b71Sopenharmony_cifunction unRegisterDepthDataAvailable(depthDataOutput: camera.DepthDataOutput): void {
778e41f4b71Sopenharmony_ci  depthDataOutput.off('depthDataAvailable', callback);
779e41f4b71Sopenharmony_ci}
780e41f4b71Sopenharmony_ci```
781e41f4b71Sopenharmony_ci
782e41f4b71Sopenharmony_ci### on('error')<sup>12+</sup>
783e41f4b71Sopenharmony_ci
784e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
785e41f4b71Sopenharmony_ci
786e41f4b71Sopenharmony_ciSubscribes to **DepthDataOutput** error events. This API uses an asynchronous callback to return the result.
787e41f4b71Sopenharmony_ci
788e41f4b71Sopenharmony_ci> **NOTE**
789e41f4b71Sopenharmony_ci>
790e41f4b71Sopenharmony_ci> Currently, you cannot use **off()** to unregister the callback in the callback method of **on()**.
791e41f4b71Sopenharmony_ci
792e41f4b71Sopenharmony_ci**System API**: This is a system API.
793e41f4b71Sopenharmony_ci
794e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
795e41f4b71Sopenharmony_ci
796e41f4b71Sopenharmony_ci**Parameters**
797e41f4b71Sopenharmony_ci
798e41f4b71Sopenharmony_ci| Name    | Type        | Mandatory| Description                      |
799e41f4b71Sopenharmony_ci| -------- | --------------| ---- | ------------------------ |
800e41f4b71Sopenharmony_ci| type     | string        | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a **depthDataOutput** instance is created.|
801e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode). |
802e41f4b71Sopenharmony_ci
803e41f4b71Sopenharmony_ci**Example**
804e41f4b71Sopenharmony_ci
805e41f4b71Sopenharmony_ci```ts
806e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
807e41f4b71Sopenharmony_ci
808e41f4b71Sopenharmony_cifunction callback(depthDataOutputError: BusinessError): void {
809e41f4b71Sopenharmony_ci  console.error(`Depth data output error code: ${depthDataOutputError.code}`);
810e41f4b71Sopenharmony_ci}
811e41f4b71Sopenharmony_ci
812e41f4b71Sopenharmony_cifunction registerDepthDataOutputError(depthDataOutput: camera.DepthDataOutput): void {
813e41f4b71Sopenharmony_ci  depthDataOutput.on('error', callback)
814e41f4b71Sopenharmony_ci}
815e41f4b71Sopenharmony_ci```
816e41f4b71Sopenharmony_ci
817e41f4b71Sopenharmony_ci### off('error')<sup>12+</sup>
818e41f4b71Sopenharmony_ci
819e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
820e41f4b71Sopenharmony_ci
821e41f4b71Sopenharmony_ciUnsubscribes from **DepthDataOutput** error events.
822e41f4b71Sopenharmony_ci
823e41f4b71Sopenharmony_ci**System API**: This is a system API.
824e41f4b71Sopenharmony_ci
825e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
826e41f4b71Sopenharmony_ci
827e41f4b71Sopenharmony_ci**Parameters**
828e41f4b71Sopenharmony_ci
829e41f4b71Sopenharmony_ci| Name    | Type        | Mandatory| Description                      |
830e41f4b71Sopenharmony_ci| -------- | --------------| ---- | ------------------------ |
831e41f4b71Sopenharmony_ci| type     | string        | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a **depthDataOutput** instance is created.|
832e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | No  | Callback used to return the result. If this parameter is specified, the subscription to the specified event with the specified callback is canceled. (The callback object cannot be an anonymous function.) Otherwise, the subscriptions to the specified event with all the callbacks are canceled.|
833e41f4b71Sopenharmony_ci
834e41f4b71Sopenharmony_ci**Example**
835e41f4b71Sopenharmony_ci
836e41f4b71Sopenharmony_ci```ts
837e41f4b71Sopenharmony_cifunction unregisterDepthDataOutputError(depthDataOutput: camera.DepthDataOutput): void {
838e41f4b71Sopenharmony_ci  depthDataOutput.off('error');
839e41f4b71Sopenharmony_ci}
840e41f4b71Sopenharmony_ci```
841e41f4b71Sopenharmony_ci
842e41f4b71Sopenharmony_ci## PrelaunchConfig
843e41f4b71Sopenharmony_ci
844e41f4b71Sopenharmony_ciDefines the camera prelaunch configuration.
845e41f4b71Sopenharmony_ci
846e41f4b71Sopenharmony_ciCurrently, the configuration is used for sensor-level prelaunch. It will be used for stream-level prelaunch in a later version.
847e41f4b71Sopenharmony_ci
848e41f4b71Sopenharmony_ci**System API**: This is a system API.
849e41f4b71Sopenharmony_ci
850e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
851e41f4b71Sopenharmony_ci
852e41f4b71Sopenharmony_ci|            Name                |                     Type                 |     Read-only   |     Mandatory    | Description      |
853e41f4b71Sopenharmony_ci| ------------------------------- | ---------------------------------------- | ----------- | ------------ | ---------- |
854e41f4b71Sopenharmony_ci| cameraDevice                    | [CameraDevice](#cameradevice)            |      No    |       Yes     | Camera device.        |
855e41f4b71Sopenharmony_ci| restoreParamType<sup>11+</sup>  | [RestoreParamType](#restoreparamtype11)  |      No    |       No     | Type of the parameter used for prelaunch.   |
856e41f4b71Sopenharmony_ci| activeTime<sup>11+</sup>        | number                                   |      No    |       No     | Activation time, in minutes.|
857e41f4b71Sopenharmony_ci| settingParam<sup>11+</sup>      |  [SettingParam](#settingparam11)         |      No    |       No     | Setting parameter.     |
858e41f4b71Sopenharmony_ci
859e41f4b71Sopenharmony_ci## RestoreParamType<sup>11+</sup>
860e41f4b71Sopenharmony_ci
861e41f4b71Sopenharmony_ciEnumerates the types of the parameters used for prelaunch.
862e41f4b71Sopenharmony_ci
863e41f4b71Sopenharmony_ci**System API**: This is a system API.
864e41f4b71Sopenharmony_ci
865e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
866e41f4b71Sopenharmony_ci
867e41f4b71Sopenharmony_ci| Name            | Value   | Description    |
868e41f4b71Sopenharmony_ci| ----------------| ----  | ---------|
869e41f4b71Sopenharmony_ci| NO_NEED_RESTORE_PARAM           | 0      | The parameter used for prelaunch is not required.    |
870e41f4b71Sopenharmony_ci| PRESISTENT_DEFAULT_PARAM    | 1      | Persistent parameter type. This parameter is used to restore stream information with the specified time point.    |
871e41f4b71Sopenharmony_ci| TRANSIENT_ACTIVE_PARAM   | 2      | Temporary parameter type. This parameter is used to restore stream information only within a period of time after the camera application is closed. Its priority is higher than that of the persistent parameter.    |
872e41f4b71Sopenharmony_ci
873e41f4b71Sopenharmony_ci## SettingParam<sup>11+</sup>
874e41f4b71Sopenharmony_ci
875e41f4b71Sopenharmony_ciDefines the effect parameters used to preheat an image.
876e41f4b71Sopenharmony_ci
877e41f4b71Sopenharmony_ci**System API**: This is a system API.
878e41f4b71Sopenharmony_ci
879e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
880e41f4b71Sopenharmony_ci
881e41f4b71Sopenharmony_ci| Name            | Type  |   Read-only   | Optional | Description                                                                                               |
882e41f4b71Sopenharmony_ci| --------------- | ------ | --------- |-----|---------------------------------------------------------------------------------------------------|
883e41f4b71Sopenharmony_ci| skinSmoothLevel | number |  No      | No  | Skin smoothing level, which is obtained through [Beauty.getSupportedBeautyRange](#getsupportedbeautyrange12). For example, the value **1** indicates level-1 smoothing.       |
884e41f4b71Sopenharmony_ci| faceSlender     | number |  No      | No  | Face slimming level, which is obtained through [Beauty.getSupportedBeautyRange](#getsupportedbeautyrange12). For example, the value **1** indicates level-1 slimming.       |
885e41f4b71Sopenharmony_ci| skinTone        | number |  No      | No  | Skin tone perfection level, which is obtained through [Beauty.getSupportedBeautyRange](#getsupportedbeautyrange12). For example, the value **0xBF986C** indicates a specific color.|
886e41f4b71Sopenharmony_ci
887e41f4b71Sopenharmony_ci## PreviewOutput
888e41f4b71Sopenharmony_ci
889e41f4b71Sopenharmony_ciImplements preview output. It inherits from [CameraOutput](js-apis-camera.md#cameraoutput).
890e41f4b71Sopenharmony_ci
891e41f4b71Sopenharmony_ci### addDeferredSurface
892e41f4b71Sopenharmony_ci
893e41f4b71Sopenharmony_ciaddDeferredSurface(surfaceId: string): void
894e41f4b71Sopenharmony_ci
895e41f4b71Sopenharmony_ciAdds a surface for delayed preview. This API can run after [Session.commitConfig](js-apis-camera.md#commitconfig11-1) or [Session.start](js-apis-camera.md#start11-1) is called.
896e41f4b71Sopenharmony_ci
897e41f4b71Sopenharmony_ci**System API**: This is a system API.
898e41f4b71Sopenharmony_ci
899e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
900e41f4b71Sopenharmony_ci
901e41f4b71Sopenharmony_ci**Parameters**
902e41f4b71Sopenharmony_ci
903e41f4b71Sopenharmony_ci| Name    | Type        | Mandatory| Description                      |
904e41f4b71Sopenharmony_ci| -------- | --------------| ---- | ------------------------ |
905e41f4b71Sopenharmony_ci| surfaceId | string | Yes| Surface ID, which is obtained from [XComponent](../apis-arkui/arkui-ts/ts-basic-components-xcomponent.md).|
906e41f4b71Sopenharmony_ci
907e41f4b71Sopenharmony_ci**Error codes**
908e41f4b71Sopenharmony_ci
909e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
910e41f4b71Sopenharmony_ci
911e41f4b71Sopenharmony_ci| ID        | Error Message       |
912e41f4b71Sopenharmony_ci| --------------- | --------------- |
913e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
914e41f4b71Sopenharmony_ci
915e41f4b71Sopenharmony_ci**Example**
916e41f4b71Sopenharmony_ci
917e41f4b71Sopenharmony_ci```ts
918e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit';
919e41f4b71Sopenharmony_ci
920e41f4b71Sopenharmony_ciasync function preview(context: common.BaseContext, cameraDevice: camera.CameraDevice, previewProfile: camera.Profile, photoProfile: camera.Profile, mode: camera.SceneMode, previewSurfaceId: string): Promise<void> {
921e41f4b71Sopenharmony_ci  const cameraManager: camera.CameraManager = camera.getCameraManager(context);
922e41f4b71Sopenharmony_ci  const cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameraDevice);
923e41f4b71Sopenharmony_ci  const previewOutput: camera.PreviewOutput = cameraManager.createDeferredPreviewOutput(previewProfile);
924e41f4b71Sopenharmony_ci  const photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
925e41f4b71Sopenharmony_ci  const session: camera.Session  = cameraManager.createSession(mode);
926e41f4b71Sopenharmony_ci  session.beginConfig();
927e41f4b71Sopenharmony_ci  session.addInput(cameraInput);
928e41f4b71Sopenharmony_ci  session.addOutput(previewOutput);
929e41f4b71Sopenharmony_ci  session.addOutput(photoOutput);
930e41f4b71Sopenharmony_ci  await session.commitConfig();
931e41f4b71Sopenharmony_ci  await session.start();
932e41f4b71Sopenharmony_ci  previewOutput.addDeferredSurface(previewSurfaceId);
933e41f4b71Sopenharmony_ci}
934e41f4b71Sopenharmony_ci```
935e41f4b71Sopenharmony_ci
936e41f4b71Sopenharmony_ci### isSketchSupported<sup>11+</sup>
937e41f4b71Sopenharmony_ci
938e41f4b71Sopenharmony_ciisSketchSupported(): boolean
939e41f4b71Sopenharmony_ci
940e41f4b71Sopenharmony_ciChecks whether Picture-in-Picture (PiP) preview is supported.
941e41f4b71Sopenharmony_ci
942e41f4b71Sopenharmony_ci**System API**: This is a system API.
943e41f4b71Sopenharmony_ci
944e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
945e41f4b71Sopenharmony_ci
946e41f4b71Sopenharmony_ci**Return value**
947e41f4b71Sopenharmony_ci
948e41f4b71Sopenharmony_ci| Type           | Description                    |
949e41f4b71Sopenharmony_ci| -------------- | ----------------------- |
950e41f4b71Sopenharmony_ci| boolean | **true**: PiP preview is supported.<br>**false**: PiP preview is not supported.|
951e41f4b71Sopenharmony_ci
952e41f4b71Sopenharmony_ci**Error codes**
953e41f4b71Sopenharmony_ci
954e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
955e41f4b71Sopenharmony_ci
956e41f4b71Sopenharmony_ci| ID        | Error Message                   |
957e41f4b71Sopenharmony_ci| --------------- |-------------------------|
958e41f4b71Sopenharmony_ci| 202             | Not System Application. |
959e41f4b71Sopenharmony_ci
960e41f4b71Sopenharmony_ci**Example**
961e41f4b71Sopenharmony_ci
962e41f4b71Sopenharmony_ci```ts
963e41f4b71Sopenharmony_cifunction isSketchSupported(previewOutput: camera.PreviewOutput): boolean {
964e41f4b71Sopenharmony_ci  try {
965e41f4b71Sopenharmony_ci    let isSupported: boolean = previewOutput.isSketchSupported();
966e41f4b71Sopenharmony_ci    return isSupported;
967e41f4b71Sopenharmony_ci  } catch (error) {
968e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
969e41f4b71Sopenharmony_ci    let err = error as BusinessError;
970e41f4b71Sopenharmony_ci    console.error(`The isSketchSupported call failed. error code: ${err.code}`);
971e41f4b71Sopenharmony_ci  }
972e41f4b71Sopenharmony_ci  return false;
973e41f4b71Sopenharmony_ci}
974e41f4b71Sopenharmony_ci```
975e41f4b71Sopenharmony_ci
976e41f4b71Sopenharmony_ci### getSketchRatio<sup>11+</sup>
977e41f4b71Sopenharmony_ci
978e41f4b71Sopenharmony_cigetSketchRatio(): number
979e41f4b71Sopenharmony_ci
980e41f4b71Sopenharmony_ciObtains the zoom ratio when PiP preview is enabled.
981e41f4b71Sopenharmony_ci
982e41f4b71Sopenharmony_ci**System API**: This is a system API.
983e41f4b71Sopenharmony_ci
984e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
985e41f4b71Sopenharmony_ci
986e41f4b71Sopenharmony_ci**Return value**
987e41f4b71Sopenharmony_ci
988e41f4b71Sopenharmony_ci| Type           | Description                    |
989e41f4b71Sopenharmony_ci| -------------- | ----------------------- |
990e41f4b71Sopenharmony_ci| number | Zoom ratio obtained. If PiP preview is not supported, the value **-1** is returned.|
991e41f4b71Sopenharmony_ci
992e41f4b71Sopenharmony_ci**Error codes**
993e41f4b71Sopenharmony_ci
994e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
995e41f4b71Sopenharmony_ci
996e41f4b71Sopenharmony_ci| ID        | Error Message       |
997e41f4b71Sopenharmony_ci| --------------- | --------------- |
998e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                      |
999e41f4b71Sopenharmony_ci| 202             |  Not System Application.                  |
1000e41f4b71Sopenharmony_ci
1001e41f4b71Sopenharmony_ci**Example**
1002e41f4b71Sopenharmony_ci
1003e41f4b71Sopenharmony_ci```ts
1004e41f4b71Sopenharmony_cifunction getSketchRatio(previewOutput: camera.PreviewOutput): number {
1005e41f4b71Sopenharmony_ci  let sketchRatio: number = previewOutput.getSketchRatio();
1006e41f4b71Sopenharmony_ci  return sketchRatio;
1007e41f4b71Sopenharmony_ci}
1008e41f4b71Sopenharmony_ci```
1009e41f4b71Sopenharmony_ci
1010e41f4b71Sopenharmony_ci### enableSketch<sup>11+</sup>
1011e41f4b71Sopenharmony_ci
1012e41f4b71Sopenharmony_cienableSketch(enabled: boolean): void
1013e41f4b71Sopenharmony_ci
1014e41f4b71Sopenharmony_ciEnables or disables PiP preview.
1015e41f4b71Sopenharmony_ci
1016e41f4b71Sopenharmony_ci**System API**: This is a system API.
1017e41f4b71Sopenharmony_ci
1018e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1019e41f4b71Sopenharmony_ci
1020e41f4b71Sopenharmony_ci**Parameters**
1021e41f4b71Sopenharmony_ci
1022e41f4b71Sopenharmony_ci| Name    | Type     | Mandatory| Description                      |
1023e41f4b71Sopenharmony_ci|---------|---------| ---- | ------------------------ |
1024e41f4b71Sopenharmony_ci| enabled | boolean | Yes| Whether to enable PiP preview. The value **true** means to enable PiP preview, and **false** means to disable it.|
1025e41f4b71Sopenharmony_ci
1026e41f4b71Sopenharmony_ci**Error codes**
1027e41f4b71Sopenharmony_ci
1028e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1029e41f4b71Sopenharmony_ci
1030e41f4b71Sopenharmony_ci| ID    | Error Message                       |
1031e41f4b71Sopenharmony_ci|-----------|-----------------------------|
1032e41f4b71Sopenharmony_ci| 202       | Not System Application.     |
1033e41f4b71Sopenharmony_ci| 7400102   | Operation not allowed.      |
1034e41f4b71Sopenharmony_ci| 7400103   | Session not config.         |
1035e41f4b71Sopenharmony_ci| 7400201   | Camera service fatal error. |
1036e41f4b71Sopenharmony_ci
1037e41f4b71Sopenharmony_ci**Example**
1038e41f4b71Sopenharmony_ci
1039e41f4b71Sopenharmony_ci```ts
1040e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1041e41f4b71Sopenharmony_ci
1042e41f4b71Sopenharmony_cifunction enableSketch(previewOutput: camera.PreviewOutput, session: camera.Session, cameraInput: camera.CameraInput): void {
1043e41f4b71Sopenharmony_ci  try {
1044e41f4b71Sopenharmony_ci    session.beginConfig();
1045e41f4b71Sopenharmony_ci    session.addInput(cameraInput);
1046e41f4b71Sopenharmony_ci    session.addOutput(previewOutput);
1047e41f4b71Sopenharmony_ci    previewOutput.enableSketch(true);
1048e41f4b71Sopenharmony_ci    session.commitConfig();
1049e41f4b71Sopenharmony_ci  } catch (error) {
1050e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
1051e41f4b71Sopenharmony_ci    let err = error as BusinessError;
1052e41f4b71Sopenharmony_ci    console.error(`The enableSketch call failed. error code: ${err.code}`);
1053e41f4b71Sopenharmony_ci  }
1054e41f4b71Sopenharmony_ci}
1055e41f4b71Sopenharmony_ci```
1056e41f4b71Sopenharmony_ci
1057e41f4b71Sopenharmony_ci### attachSketchSurface<sup>11+</sup>
1058e41f4b71Sopenharmony_ci
1059e41f4b71Sopenharmony_ciattachSketchSurface(surfaceId: string): void
1060e41f4b71Sopenharmony_ci
1061e41f4b71Sopenharmony_ciAttaches a surface for PiP preview.
1062e41f4b71Sopenharmony_ci
1063e41f4b71Sopenharmony_ci**System API**: This is a system API.
1064e41f4b71Sopenharmony_ci
1065e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1066e41f4b71Sopenharmony_ci
1067e41f4b71Sopenharmony_ci**Parameters**
1068e41f4b71Sopenharmony_ci
1069e41f4b71Sopenharmony_ci| Name    | Type        | Mandatory| Description                      |
1070e41f4b71Sopenharmony_ci| -------- | --------------| ---- | ------------------------ |
1071e41f4b71Sopenharmony_ci| surfaceId | string | Yes| Surface ID, which is obtained from [XComponent](../apis-arkui/arkui-ts/ts-basic-components-xcomponent.md).|
1072e41f4b71Sopenharmony_ci
1073e41f4b71Sopenharmony_ci**Error codes**
1074e41f4b71Sopenharmony_ci
1075e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1076e41f4b71Sopenharmony_ci
1077e41f4b71Sopenharmony_ci| ID  | Error Message                                          |
1078e41f4b71Sopenharmony_ci|---------|------------------------------------------------|
1079e41f4b71Sopenharmony_ci| 202     | Not System Application.                        |
1080e41f4b71Sopenharmony_ci| 7400101 | Parameter missing or parameter type incorrect. |
1081e41f4b71Sopenharmony_ci| 7400103 | Session not config.                            |
1082e41f4b71Sopenharmony_ci| 7400201 | Camera service fatal error.                    |
1083e41f4b71Sopenharmony_ci
1084e41f4b71Sopenharmony_ci**Example**
1085e41f4b71Sopenharmony_ci
1086e41f4b71Sopenharmony_ci```ts
1087e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1088e41f4b71Sopenharmony_ci
1089e41f4b71Sopenharmony_cifunction attachSketchSurface(previewOutput: camera.PreviewOutput, session: camera.Session, cameraInput: camera.CameraInput, sketchSurfaceId: string): void {
1090e41f4b71Sopenharmony_ci  try {
1091e41f4b71Sopenharmony_ci    session.beginConfig();
1092e41f4b71Sopenharmony_ci    session.addInput(cameraInput);
1093e41f4b71Sopenharmony_ci    session.addOutput(previewOutput);
1094e41f4b71Sopenharmony_ci    previewOutput.enableSketch(true);
1095e41f4b71Sopenharmony_ci    session.commitConfig();
1096e41f4b71Sopenharmony_ci    previewOutput.attachSketchSurface(sketchSurfaceId);
1097e41f4b71Sopenharmony_ci  } catch (error) {
1098e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
1099e41f4b71Sopenharmony_ci    let err = error as BusinessError;
1100e41f4b71Sopenharmony_ci    console.error(`The attachSketchSurface call failed. error code: ${err.code}`);
1101e41f4b71Sopenharmony_ci  }
1102e41f4b71Sopenharmony_ci}
1103e41f4b71Sopenharmony_ci```
1104e41f4b71Sopenharmony_ci
1105e41f4b71Sopenharmony_ci### on('sketchStatusChanged')<sup>11+</sup>
1106e41f4b71Sopenharmony_ci
1107e41f4b71Sopenharmony_cion(type: 'sketchStatusChanged', callback: AsyncCallback\<SketchStatusData\>): void
1108e41f4b71Sopenharmony_ci
1109e41f4b71Sopenharmony_ciSubscribes to PiP status change events. This API uses an asynchronous callback to return the result.
1110e41f4b71Sopenharmony_ci
1111e41f4b71Sopenharmony_ci**System API**: This is a system API.
1112e41f4b71Sopenharmony_ci
1113e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1114e41f4b71Sopenharmony_ci
1115e41f4b71Sopenharmony_ci**Parameters**
1116e41f4b71Sopenharmony_ci
1117e41f4b71Sopenharmony_ci| Name     | Type                   | Mandatory| Description                                      |
1118e41f4b71Sopenharmony_ci| -------- | ---------------------- | ---- | ------------------------------------------ |
1119e41f4b71Sopenharmony_ci| type     | string                 | Yes  | Event type. The value is fixed at **'sketchStatusChanged'**. The event can be listened for when a PiP preview stream is created. This event is triggered when PiP preview is enabled or disabled or the zoom ratio changes while PiP preview is enabled.|
1120e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SketchStatusData](#sketchstatusdata11)\> | Yes  | Callback used to return the PiP status data.           |
1121e41f4b71Sopenharmony_ci
1122e41f4b71Sopenharmony_ci**Error codes**
1123e41f4b71Sopenharmony_ci
1124e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1125e41f4b71Sopenharmony_ci
1126e41f4b71Sopenharmony_ci| ID  | Error Message                         |
1127e41f4b71Sopenharmony_ci|---------|-------------------------------|
1128e41f4b71Sopenharmony_ci| 202     | Not System Application.       |
1129e41f4b71Sopenharmony_ci
1130e41f4b71Sopenharmony_ci**Example**
1131e41f4b71Sopenharmony_ci
1132e41f4b71Sopenharmony_ci```ts
1133e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1134e41f4b71Sopenharmony_ci
1135e41f4b71Sopenharmony_cifunction callback(error: BusinessError, data: camera.SketchStatusData): void {
1136e41f4b71Sopenharmony_ci  if (error !== undefined && error.code !== 0) {
1137e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${error.code}`);
1138e41f4b71Sopenharmony_ci    return;
1139e41f4b71Sopenharmony_ci  }
1140e41f4b71Sopenharmony_ci  console.info(`sketch errorCode is ${error.code}, data is ${JSON.stringify(data)}`);
1141e41f4b71Sopenharmony_ci}
1142e41f4b71Sopenharmony_ci
1143e41f4b71Sopenharmony_cifunction registerSketchStatusChanged(previewOutput: camera.PreviewOutput): void {
1144e41f4b71Sopenharmony_ci  previewOutput.on('sketchStatusChanged', callback);
1145e41f4b71Sopenharmony_ci}
1146e41f4b71Sopenharmony_ci```
1147e41f4b71Sopenharmony_ci
1148e41f4b71Sopenharmony_ci### off('sketchStatusChanged')<sup>11+</sup>
1149e41f4b71Sopenharmony_ci
1150e41f4b71Sopenharmony_cioff(type: 'sketchStatusChanged', callback?: AsyncCallback\<SketchStatusData\>): void
1151e41f4b71Sopenharmony_ci
1152e41f4b71Sopenharmony_ciUnsubscribes from PiP status change events.
1153e41f4b71Sopenharmony_ci
1154e41f4b71Sopenharmony_ci**System API**: This is a system API.
1155e41f4b71Sopenharmony_ci
1156e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1157e41f4b71Sopenharmony_ci
1158e41f4b71Sopenharmony_ci**Parameters**
1159e41f4b71Sopenharmony_ci
1160e41f4b71Sopenharmony_ci| Name     | Type                   | Mandatory| Description                                      |
1161e41f4b71Sopenharmony_ci| -------- | ---------------------- | ---- | ------------------------------------------ |
1162e41f4b71Sopenharmony_ci| type     | string                 | Yes  | Event type. The value is fixed at **'sketchStatusChanged'**. The event can be listened for when a PiP preview stream is created.|
1163e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SketchStatusData](#sketchstatusdata11)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('sketchStatusChanged')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)          |
1164e41f4b71Sopenharmony_ci
1165e41f4b71Sopenharmony_ci**Error codes**
1166e41f4b71Sopenharmony_ci
1167e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1168e41f4b71Sopenharmony_ci
1169e41f4b71Sopenharmony_ci| ID  | Error Message                         |
1170e41f4b71Sopenharmony_ci|---------|-------------------------------|
1171e41f4b71Sopenharmony_ci| 202     | Not System Application.       |
1172e41f4b71Sopenharmony_ci
1173e41f4b71Sopenharmony_ci**Example**
1174e41f4b71Sopenharmony_ci
1175e41f4b71Sopenharmony_ci```ts
1176e41f4b71Sopenharmony_cifunction unregisterSketchStatusChanged(previewOutput: camera.PreviewOutput): void {
1177e41f4b71Sopenharmony_ci  previewOutput.off('sketchStatusChanged');
1178e41f4b71Sopenharmony_ci}
1179e41f4b71Sopenharmony_ci```
1180e41f4b71Sopenharmony_ci
1181e41f4b71Sopenharmony_ci## DeferredDeliveryImageType<sup>11+</sup>
1182e41f4b71Sopenharmony_ci
1183e41f4b71Sopenharmony_ciEnumerates the deferred delivery image types. In deferred delivery, photo and video capture are divided into two phases. In the first phase, an image or video is output to users at a relatively fast speed. In the second phase, a higher-resolution image or video is output again after optimization processing.
1184e41f4b71Sopenharmony_ci
1185e41f4b71Sopenharmony_ci**System API**: This is a system API.
1186e41f4b71Sopenharmony_ci
1187e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1188e41f4b71Sopenharmony_ci
1189e41f4b71Sopenharmony_ci| Name   | Value  | Description        |
1190e41f4b71Sopenharmony_ci| ------- | ---- | ------------ |
1191e41f4b71Sopenharmony_ci| NONE    | 0    | Deferred delivery is not supported.|
1192e41f4b71Sopenharmony_ci| PHOTO   | 1    | Deferred delivery for photo capture.|
1193e41f4b71Sopenharmony_ci| VIDEO   | 2    | Deferred delivery for video capture.|
1194e41f4b71Sopenharmony_ci
1195e41f4b71Sopenharmony_ci## DeferredPhotoProxy<sup>11+</sup>
1196e41f4b71Sopenharmony_ci
1197e41f4b71Sopenharmony_ciA class object that functions as a thumbnail proxy.
1198e41f4b71Sopenharmony_ci
1199e41f4b71Sopenharmony_ci### getThumbnail<sup>11+</sup>
1200e41f4b71Sopenharmony_ci
1201e41f4b71Sopenharmony_cigetThumbnail(): Promise<image.PixelMap>
1202e41f4b71Sopenharmony_ci
1203e41f4b71Sopenharmony_ciObtains the pixel map of a thumbnail.
1204e41f4b71Sopenharmony_ci
1205e41f4b71Sopenharmony_ci**System API**: This is a system API.
1206e41f4b71Sopenharmony_ci
1207e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1208e41f4b71Sopenharmony_ci
1209e41f4b71Sopenharmony_ci**Return value**
1210e41f4b71Sopenharmony_ci
1211e41f4b71Sopenharmony_ci| Type           | Description                    |
1212e41f4b71Sopenharmony_ci| -------------- | ----------------------- |
1213e41f4b71Sopenharmony_ci| Promise\<image.PixelMap\> | Pixel map of the thumbnail.|
1214e41f4b71Sopenharmony_ci
1215e41f4b71Sopenharmony_ci**Error codes**
1216e41f4b71Sopenharmony_ci
1217e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1218e41f4b71Sopenharmony_ci
1219e41f4b71Sopenharmony_ci| ID        | Error Message       |
1220e41f4b71Sopenharmony_ci| --------------- | --------------- |
1221e41f4b71Sopenharmony_ci| 202         	  |  Not System Application.       |
1222e41f4b71Sopenharmony_ci
1223e41f4b71Sopenharmony_ci**Example**
1224e41f4b71Sopenharmony_ci
1225e41f4b71Sopenharmony_ci```ts
1226e41f4b71Sopenharmony_ciimport { image } from '@kit.ImageKit';
1227e41f4b71Sopenharmony_ci
1228e41f4b71Sopenharmony_cifunction getThumbnail(proxyObj: camera.DeferredPhotoProxy): void {
1229e41f4b71Sopenharmony_ci  proxyObj.getThumbnail().then((thumbnail: image.PixelMap) => {
1230e41f4b71Sopenharmony_ci    AppStorage.setOrCreate('proxyThumbnail', thumbnail);
1231e41f4b71Sopenharmony_ci  });
1232e41f4b71Sopenharmony_ci}
1233e41f4b71Sopenharmony_ci```
1234e41f4b71Sopenharmony_ci
1235e41f4b71Sopenharmony_ci### release<sup>11+</sup>
1236e41f4b71Sopenharmony_ci
1237e41f4b71Sopenharmony_cirelease(): Promise\<void\>
1238e41f4b71Sopenharmony_ci
1239e41f4b71Sopenharmony_ciReleases output resources. This API uses a promise to return the result.
1240e41f4b71Sopenharmony_ci
1241e41f4b71Sopenharmony_ci**System API**: This is a system API.
1242e41f4b71Sopenharmony_ci
1243e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1244e41f4b71Sopenharmony_ci
1245e41f4b71Sopenharmony_ci**Return value**
1246e41f4b71Sopenharmony_ci
1247e41f4b71Sopenharmony_ci| Type           | Description              |
1248e41f4b71Sopenharmony_ci| -------------- |------------------|
1249e41f4b71Sopenharmony_ci| Promise\<void\> | Promise that returns no value.|
1250e41f4b71Sopenharmony_ci
1251e41f4b71Sopenharmony_ci**Error codes**
1252e41f4b71Sopenharmony_ci
1253e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1254e41f4b71Sopenharmony_ci
1255e41f4b71Sopenharmony_ci| ID        | Error Message       |
1256e41f4b71Sopenharmony_ci| --------------- | --------------- |
1257e41f4b71Sopenharmony_ci| 202         	  |  Not System Application.       |
1258e41f4b71Sopenharmony_ci
1259e41f4b71Sopenharmony_ci**Example**
1260e41f4b71Sopenharmony_ci
1261e41f4b71Sopenharmony_ci```ts
1262e41f4b71Sopenharmony_ciasync function releaseDeferredPhotoProxy(proxyObj: camera.DeferredPhotoProxy): Promise<void> {
1263e41f4b71Sopenharmony_ci  await proxyObj.release();
1264e41f4b71Sopenharmony_ci}
1265e41f4b71Sopenharmony_ci```
1266e41f4b71Sopenharmony_ci
1267e41f4b71Sopenharmony_ci## PhotoOutput
1268e41f4b71Sopenharmony_ci
1269e41f4b71Sopenharmony_ciImplements output information used in a photo session. It inherits from [CameraOutput](js-apis-camera.md#cameraoutput).
1270e41f4b71Sopenharmony_ci
1271e41f4b71Sopenharmony_ci### burstCapture<sup>12+</sup>
1272e41f4b71Sopenharmony_ci
1273e41f4b71Sopenharmony_ciburstCapture(setting: PhotoCaptureSetting): Promise\<void\>
1274e41f4b71Sopenharmony_ci
1275e41f4b71Sopenharmony_ciStarts the burst mode, in which users can capture a series of photos in quick succession. This API is generally used in photo mode. After the burst mode starts, the bottom layer continues displaying photos. You can call [confirmCapture](#confirmcapture11) to cancel the burst mode.
1276e41f4b71Sopenharmony_ci
1277e41f4b71Sopenharmony_ci**System API**: This is a system API.
1278e41f4b71Sopenharmony_ci
1279e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1280e41f4b71Sopenharmony_ci
1281e41f4b71Sopenharmony_ci**Parameters**
1282e41f4b71Sopenharmony_ci
1283e41f4b71Sopenharmony_ci| Name | Type                                       | Mandatory| Description    |
1284e41f4b71Sopenharmony_ci| ------- | ------------------------------------------- | ---- | -------- |
1285e41f4b71Sopenharmony_ci| setting | [PhotoCaptureSetting](js-apis-camera.md#photocapturesetting) | Yes  | Shooting parameters. The input of **undefined** is processed as if no parameters were passed.|
1286e41f4b71Sopenharmony_ci
1287e41f4b71Sopenharmony_ci**Return value**
1288e41f4b71Sopenharmony_ci
1289e41f4b71Sopenharmony_ci| Type           | Description                     |
1290e41f4b71Sopenharmony_ci| -------------- | ------------------------   |
1291e41f4b71Sopenharmony_ci| Promise\<void\> | Promise that returns no value.|
1292e41f4b71Sopenharmony_ci
1293e41f4b71Sopenharmony_ci**Error codes**
1294e41f4b71Sopenharmony_ci
1295e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1296e41f4b71Sopenharmony_ci
1297e41f4b71Sopenharmony_ci| ID        | Error Message       |
1298e41f4b71Sopenharmony_ci| --------------- | --------------- |
1299e41f4b71Sopenharmony_ci| 202         	  |  Not System Application.       |
1300e41f4b71Sopenharmony_ci| 7400101         |  Parameter missing or parameter type incorrect.          |
1301e41f4b71Sopenharmony_ci| 7400104         |  Session not running.          |
1302e41f4b71Sopenharmony_ci| 7400201         |  Camera service fatal error.   |
1303e41f4b71Sopenharmony_ci
1304e41f4b71Sopenharmony_ci**Example**
1305e41f4b71Sopenharmony_ci
1306e41f4b71Sopenharmony_ci```ts
1307e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1308e41f4b71Sopenharmony_ci
1309e41f4b71Sopenharmony_cifunction burstCapture(photoOutput: camera.PhotoOutput): void {
1310e41f4b71Sopenharmony_ci  let captureLocation: camera.Location = {
1311e41f4b71Sopenharmony_ci    latitude: 0,
1312e41f4b71Sopenharmony_ci    longitude: 0,
1313e41f4b71Sopenharmony_ci    altitude: 0
1314e41f4b71Sopenharmony_ci  }
1315e41f4b71Sopenharmony_ci  let settings: camera.PhotoCaptureSetting = {
1316e41f4b71Sopenharmony_ci    quality: camera.QualityLevel.QUALITY_LEVEL_LOW,
1317e41f4b71Sopenharmony_ci    rotation: camera.ImageRotation.ROTATION_0,
1318e41f4b71Sopenharmony_ci    location: captureLocation,
1319e41f4b71Sopenharmony_ci    mirror: false
1320e41f4b71Sopenharmony_ci  }
1321e41f4b71Sopenharmony_ci  photoOutput.burstCapture(settings).then(() => {
1322e41f4b71Sopenharmony_ci    console.info('Promise returned to indicate that photo burstCapture request success.');
1323e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
1324e41f4b71Sopenharmony_ci    console.error(`Failed to photo output burstCapture, error code: ${error.code}.`);
1325e41f4b71Sopenharmony_ci  });
1326e41f4b71Sopenharmony_ci}
1327e41f4b71Sopenharmony_ci```
1328e41f4b71Sopenharmony_ci
1329e41f4b71Sopenharmony_ci### confirmCapture<sup>11+</sup>
1330e41f4b71Sopenharmony_ci
1331e41f4b71Sopenharmony_ciconfirmCapture()
1332e41f4b71Sopenharmony_ci
1333e41f4b71Sopenharmony_ciConfirms photo capture. This API is generally used in night photo mode when users need to stop the exposure countdown and take a photo in advance.
1334e41f4b71Sopenharmony_ci
1335e41f4b71Sopenharmony_ciThis API is used to end the burst mode, which is started by calling [burstCapture](#burstcapture12).
1336e41f4b71Sopenharmony_ci
1337e41f4b71Sopenharmony_ci**System API**: This is a system API.
1338e41f4b71Sopenharmony_ci
1339e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1340e41f4b71Sopenharmony_ci
1341e41f4b71Sopenharmony_ci**Error codes**
1342e41f4b71Sopenharmony_ci
1343e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1344e41f4b71Sopenharmony_ci
1345e41f4b71Sopenharmony_ci| ID        | Error Message       |
1346e41f4b71Sopenharmony_ci| --------------- | --------------- |
1347e41f4b71Sopenharmony_ci| 202         	  |  Not System Application.       |
1348e41f4b71Sopenharmony_ci| 7400104         |  Session not running.          |
1349e41f4b71Sopenharmony_ci| 7400201         |  Camera service fatal error.   |
1350e41f4b71Sopenharmony_ci
1351e41f4b71Sopenharmony_ci**Example**
1352e41f4b71Sopenharmony_ci
1353e41f4b71Sopenharmony_ci```ts
1354e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1355e41f4b71Sopenharmony_ci
1356e41f4b71Sopenharmony_cifunction confirmCapture(photoOutput: camera.PhotoOutput): void {
1357e41f4b71Sopenharmony_ci  try {
1358e41f4b71Sopenharmony_ci    photoOutput.confirmCapture();
1359e41f4b71Sopenharmony_ci  } catch (error) {
1360e41f4b71Sopenharmony_ci    let err = error as BusinessError;
1361e41f4b71Sopenharmony_ci    console.error(`The confirmCapture call failed. error code: ${err.code}`);
1362e41f4b71Sopenharmony_ci  }
1363e41f4b71Sopenharmony_ci}
1364e41f4b71Sopenharmony_ci```
1365e41f4b71Sopenharmony_ci
1366e41f4b71Sopenharmony_ci### isDeferredImageDeliverySupported<sup>11+</sup>
1367e41f4b71Sopenharmony_ci
1368e41f4b71Sopenharmony_ciisDeferredImageDeliverySupported(type: DeferredDeliveryImageType): boolean
1369e41f4b71Sopenharmony_ci
1370e41f4b71Sopenharmony_ciChecks whether deferred delivery of a certain type is supported.
1371e41f4b71Sopenharmony_ci
1372e41f4b71Sopenharmony_ci**System API**: This is a system API.
1373e41f4b71Sopenharmony_ci
1374e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1375e41f4b71Sopenharmony_ci
1376e41f4b71Sopenharmony_ci**Parameters**
1377e41f4b71Sopenharmony_ci
1378e41f4b71Sopenharmony_ci| Name     | Type              | Mandatory| Description                |
1379e41f4b71Sopenharmony_ci| -------- | -------------------- | ---- | ------------------- |
1380e41f4b71Sopenharmony_ci|   type   |  [DeferredDeliveryImageType](#deferreddeliveryimagetype11)  |   Yes  |   Deferred delivery image type.   |
1381e41f4b71Sopenharmony_ci
1382e41f4b71Sopenharmony_ci**Return value**
1383e41f4b71Sopenharmony_ci
1384e41f4b71Sopenharmony_ci| Type           | Description                   |
1385e41f4b71Sopenharmony_ci| -------------- | ----------------------- |
1386e41f4b71Sopenharmony_ci| boolean | **true**: Deferred delivery is supported.<br>**false**: Deferred delivery is not supported.|
1387e41f4b71Sopenharmony_ci
1388e41f4b71Sopenharmony_ci**Error codes**
1389e41f4b71Sopenharmony_ci
1390e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1391e41f4b71Sopenharmony_ci
1392e41f4b71Sopenharmony_ci| ID        | Error Message                                               |
1393e41f4b71Sopenharmony_ci| --------------- |-----------------------------------------------------|
1394e41f4b71Sopenharmony_ci| 7400101                | Parameter missing or parameter type incorrect.      |
1395e41f4b71Sopenharmony_ci| 7400104                | Session not running.                                |
1396e41f4b71Sopenharmony_ci| 7400201                | Camera service fatal error.                         |
1397e41f4b71Sopenharmony_ci| 202                    | Not System Application.                             |
1398e41f4b71Sopenharmony_ci
1399e41f4b71Sopenharmony_ci**Example**
1400e41f4b71Sopenharmony_ci
1401e41f4b71Sopenharmony_ci```ts
1402e41f4b71Sopenharmony_cifunction isDeferredImageDeliverySupported(photoOutput: camera.PhotoOutput, type: camera.DeferredDeliveryImageType): boolean {
1403e41f4b71Sopenharmony_ci  let res: boolean = false;
1404e41f4b71Sopenharmony_ci  res = photoOutput.isDeferredImageDeliverySupported(type);
1405e41f4b71Sopenharmony_ci  return res;
1406e41f4b71Sopenharmony_ci}
1407e41f4b71Sopenharmony_ci```
1408e41f4b71Sopenharmony_ci
1409e41f4b71Sopenharmony_ci### isDeferredImageDeliveryEnabled<sup>11+</sup>
1410e41f4b71Sopenharmony_ci
1411e41f4b71Sopenharmony_ciisDeferredImageDeliveryEnabled(type: DeferredDeliveryImageType): boolean
1412e41f4b71Sopenharmony_ci
1413e41f4b71Sopenharmony_ciChecks whether deferred delivery of a certain type is enabled.
1414e41f4b71Sopenharmony_ci
1415e41f4b71Sopenharmony_ci**System API**: This is a system API.
1416e41f4b71Sopenharmony_ci
1417e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1418e41f4b71Sopenharmony_ci
1419e41f4b71Sopenharmony_ci**Parameters**
1420e41f4b71Sopenharmony_ci
1421e41f4b71Sopenharmony_ci| Name     | Type              | Mandatory| Description                |
1422e41f4b71Sopenharmony_ci| -------- | -------------------- | ---- | ------------------- |
1423e41f4b71Sopenharmony_ci|   type   |  [DeferredDeliveryImageType](#deferreddeliveryimagetype11)  |   Yes  |   Deferred delivery image type.   |
1424e41f4b71Sopenharmony_ci
1425e41f4b71Sopenharmony_ci**Return value**
1426e41f4b71Sopenharmony_ci
1427e41f4b71Sopenharmony_ci| Type           | Description                   |
1428e41f4b71Sopenharmony_ci| -------------- | ----------------------- |
1429e41f4b71Sopenharmony_ci| boolean | **true**: Deferred delivery is enabled. **false**: Deferred delivery is disabled.|
1430e41f4b71Sopenharmony_ci
1431e41f4b71Sopenharmony_ci**Error codes**
1432e41f4b71Sopenharmony_ci
1433e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1434e41f4b71Sopenharmony_ci
1435e41f4b71Sopenharmony_ci| ID        | Error Message       |
1436e41f4b71Sopenharmony_ci| --------------- | --------------- |
1437e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
1438e41f4b71Sopenharmony_ci| 7400104                |  Session not running.                                  |
1439e41f4b71Sopenharmony_ci| 7400201                |  Camera service fatal error.                           |
1440e41f4b71Sopenharmony_ci| 202                    |  Not System Application.                               |
1441e41f4b71Sopenharmony_ci
1442e41f4b71Sopenharmony_ci**Example**
1443e41f4b71Sopenharmony_ci
1444e41f4b71Sopenharmony_ci```ts
1445e41f4b71Sopenharmony_cifunction isDeferredImageDeliveryEnabled(photoOutput: camera.PhotoOutput, type: camera.DeferredDeliveryImageType): boolean {
1446e41f4b71Sopenharmony_ci  let res: boolean = false;
1447e41f4b71Sopenharmony_ci  res = photoOutput.isDeferredImageDeliveryEnabled(type);
1448e41f4b71Sopenharmony_ci  return res;
1449e41f4b71Sopenharmony_ci}
1450e41f4b71Sopenharmony_ci```
1451e41f4b71Sopenharmony_ci
1452e41f4b71Sopenharmony_ci### deferImageDelivery<sup>11+</sup>
1453e41f4b71Sopenharmony_ci
1454e41f4b71Sopenharmony_cideferImageDelivery(type: DeferredDeliveryImageType): void
1455e41f4b71Sopenharmony_ci
1456e41f4b71Sopenharmony_ciEnables deferred delivery of a certain type.
1457e41f4b71Sopenharmony_ci
1458e41f4b71Sopenharmony_ci**System API**: This is a system API.
1459e41f4b71Sopenharmony_ci
1460e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1461e41f4b71Sopenharmony_ci
1462e41f4b71Sopenharmony_ci**Parameters**
1463e41f4b71Sopenharmony_ci
1464e41f4b71Sopenharmony_ci| Name     | Type              | Mandatory| Description                |
1465e41f4b71Sopenharmony_ci| -------- | -------------------- | ---- | ------------------- |
1466e41f4b71Sopenharmony_ci|   type   |  [DeferredDeliveryImageType](#deferreddeliveryimagetype11)  |   Yes  |   Deferred delivery image type.   |
1467e41f4b71Sopenharmony_ci
1468e41f4b71Sopenharmony_ci**Error codes**
1469e41f4b71Sopenharmony_ci
1470e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1471e41f4b71Sopenharmony_ci
1472e41f4b71Sopenharmony_ci| ID        | Error Message       |
1473e41f4b71Sopenharmony_ci| --------------- | --------------- |
1474e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
1475e41f4b71Sopenharmony_ci| 7400104                |  Session not running.                                  |
1476e41f4b71Sopenharmony_ci| 7400201                |  Camera service fatal error.                           |
1477e41f4b71Sopenharmony_ci| 202                    |  Not System Application.                               |
1478e41f4b71Sopenharmony_ci
1479e41f4b71Sopenharmony_ci**Example**
1480e41f4b71Sopenharmony_ci
1481e41f4b71Sopenharmony_ci```ts
1482e41f4b71Sopenharmony_cifunction deferImageDelivery(photoOutput: camera.PhotoOutput, type: camera.DeferredDeliveryImageType): void {
1483e41f4b71Sopenharmony_ci  photoOutput.deferImageDelivery(type);
1484e41f4b71Sopenharmony_ci}
1485e41f4b71Sopenharmony_ci```
1486e41f4b71Sopenharmony_ci
1487e41f4b71Sopenharmony_ci### isAutoHighQualityPhotoSupported<sup>12+</sup>
1488e41f4b71Sopenharmony_ci
1489e41f4b71Sopenharmony_ciisAutoHighQualityPhotoSupported(): boolean
1490e41f4b71Sopenharmony_ci
1491e41f4b71Sopenharmony_ciChecks whether automatic high quality is supported for photos.
1492e41f4b71Sopenharmony_ci
1493e41f4b71Sopenharmony_ci**System API**: This is a system API.
1494e41f4b71Sopenharmony_ci
1495e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1496e41f4b71Sopenharmony_ci
1497e41f4b71Sopenharmony_ci**Return value**
1498e41f4b71Sopenharmony_ci
1499e41f4b71Sopenharmony_ci| Type           | Description                    |
1500e41f4b71Sopenharmony_ci| -------------- | ----------------------- |
1501e41f4b71Sopenharmony_ci| boolean | Whether automatic high quality is supported.|
1502e41f4b71Sopenharmony_ci
1503e41f4b71Sopenharmony_ci**Error codes**
1504e41f4b71Sopenharmony_ci
1505e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1506e41f4b71Sopenharmony_ci
1507e41f4b71Sopenharmony_ci| ID        | Error Message       |
1508e41f4b71Sopenharmony_ci| --------------- | --------------- |
1509e41f4b71Sopenharmony_ci| 202 | Not System Application. |
1510e41f4b71Sopenharmony_ci| 7400104                |  Session not running.                                  |
1511e41f4b71Sopenharmony_ci| 7400201                |  Camera service fatal error.                           |
1512e41f4b71Sopenharmony_ci
1513e41f4b71Sopenharmony_ci**Example**
1514e41f4b71Sopenharmony_ci
1515e41f4b71Sopenharmony_ci```ts
1516e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1517e41f4b71Sopenharmony_ci
1518e41f4b71Sopenharmony_cifunction isAutoHighQualityPhotoSupported(photoOutput: camera.PhotoOutput): boolean {
1519e41f4b71Sopenharmony_ci  return photoOutput.isAutoHighQualityPhotoSupported();
1520e41f4b71Sopenharmony_ci}
1521e41f4b71Sopenharmony_ci```
1522e41f4b71Sopenharmony_ci
1523e41f4b71Sopenharmony_ci### enableAutoHighQualityPhoto<sup>12+</sup>
1524e41f4b71Sopenharmony_ci
1525e41f4b71Sopenharmony_cienableAutoHighQualityPhoto(enabled: boolean): void
1526e41f4b71Sopenharmony_ci
1527e41f4b71Sopenharmony_ciEnables automatic high quality for photos. 
1528e41f4b71Sopenharmony_ci
1529e41f4b71Sopenharmony_ciBefore using this API, call [isAutoHighQualityPhotoSupported](#isautohighqualityphotosupported12) to check whether automatic high quality is supported.
1530e41f4b71Sopenharmony_ci
1531e41f4b71Sopenharmony_ci**System API**: This is a system API.
1532e41f4b71Sopenharmony_ci
1533e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1534e41f4b71Sopenharmony_ci
1535e41f4b71Sopenharmony_ci**Parameters**
1536e41f4b71Sopenharmony_ci
1537e41f4b71Sopenharmony_ci| Name     | Type              | Mandatory| Description                |
1538e41f4b71Sopenharmony_ci| -------- | -------------------- | ---- | ------------------- |
1539e41f4b71Sopenharmony_ci|   enabled   |  boolean  |   Yes  |   Whether to enable automatic high quality for photos.   |
1540e41f4b71Sopenharmony_ci
1541e41f4b71Sopenharmony_ci**Error codes**
1542e41f4b71Sopenharmony_ci
1543e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1544e41f4b71Sopenharmony_ci
1545e41f4b71Sopenharmony_ci| ID        | Error Message       |
1546e41f4b71Sopenharmony_ci| --------------- | --------------- |
1547e41f4b71Sopenharmony_ci| 202 | Not System Application. |
1548e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
1549e41f4b71Sopenharmony_ci| 7400104                |  Session not running.                                  |
1550e41f4b71Sopenharmony_ci| 7400201                |  Camera service fatal error.                           |
1551e41f4b71Sopenharmony_ci
1552e41f4b71Sopenharmony_ci**Example**
1553e41f4b71Sopenharmony_ci
1554e41f4b71Sopenharmony_ci```ts
1555e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1556e41f4b71Sopenharmony_ci
1557e41f4b71Sopenharmony_cifunction enableAutoHighQualityPhoto(photoOutput: camera.PhotoOutput): void {
1558e41f4b71Sopenharmony_ci  return photoOutput.enableAutoHighQualityPhoto(true);
1559e41f4b71Sopenharmony_ci}
1560e41f4b71Sopenharmony_ci```
1561e41f4b71Sopenharmony_ci
1562e41f4b71Sopenharmony_ci### on('deferredPhotoProxyAvailable')<sup>11+</sup>
1563e41f4b71Sopenharmony_ci
1564e41f4b71Sopenharmony_cion(type: 'deferredPhotoProxyAvailable', callback: AsyncCallback\<DeferredPhotoProxy\>): void
1565e41f4b71Sopenharmony_ci
1566e41f4b71Sopenharmony_ciSubscribes to events indicating available thumbnail proxies. This API uses an asynchronous callback to return the result.
1567e41f4b71Sopenharmony_ci
1568e41f4b71Sopenharmony_ci**System API**: This is a system API.
1569e41f4b71Sopenharmony_ci
1570e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1571e41f4b71Sopenharmony_ci
1572e41f4b71Sopenharmony_ci**Parameters**
1573e41f4b71Sopenharmony_ci
1574e41f4b71Sopenharmony_ci| Name    | Type     | Mandatory| Description                                 |
1575e41f4b71Sopenharmony_ci| -------- | ---------- | --- | ------------------------------------ |
1576e41f4b71Sopenharmony_ci| type     | string     | Yes  | Event type. The value is fixed at **'deferredPhotoProxyAvailable'**. The event can be listened for when a **photoOutput** instance is created.|
1577e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[DeferredPhotoProxy](#deferredphotoproxy11)\> | Yes  | Callback used to return the thumbnail proxy.|
1578e41f4b71Sopenharmony_ci
1579e41f4b71Sopenharmony_ci**Error codes**
1580e41f4b71Sopenharmony_ci
1581e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1582e41f4b71Sopenharmony_ci
1583e41f4b71Sopenharmony_ci| ID        | Error Message       |
1584e41f4b71Sopenharmony_ci| --------------- | --------------- |
1585e41f4b71Sopenharmony_ci| 202         	  |  Not System Application.       |
1586e41f4b71Sopenharmony_ci
1587e41f4b71Sopenharmony_ci**Example**
1588e41f4b71Sopenharmony_ci
1589e41f4b71Sopenharmony_ci```ts
1590e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1591e41f4b71Sopenharmony_ciimport { image } from '@kit.ImageKit';
1592e41f4b71Sopenharmony_ci
1593e41f4b71Sopenharmony_cifunction callback(err: BusinessError, proxyObj: camera.DeferredPhotoProxy): void {
1594e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
1595e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
1596e41f4b71Sopenharmony_ci    return;
1597e41f4b71Sopenharmony_ci  }
1598e41f4b71Sopenharmony_ci  proxyObj.getThumbnail().then((thumbnail: image.PixelMap) => {
1599e41f4b71Sopenharmony_ci    AppStorage.setOrCreate('proxyThumbnail', thumbnail);
1600e41f4b71Sopenharmony_ci  });
1601e41f4b71Sopenharmony_ci}
1602e41f4b71Sopenharmony_ci
1603e41f4b71Sopenharmony_cifunction registerPhotoOutputDeferredPhotoProxyAvailable(photoOutput: camera.PhotoOutput): void {
1604e41f4b71Sopenharmony_ci  photoOutput.on('deferredPhotoProxyAvailable', callback);
1605e41f4b71Sopenharmony_ci}
1606e41f4b71Sopenharmony_ci```
1607e41f4b71Sopenharmony_ci
1608e41f4b71Sopenharmony_ci### off('deferredPhotoProxyAvailable')<sup>11+</sup>
1609e41f4b71Sopenharmony_ci
1610e41f4b71Sopenharmony_cioff(type: 'deferredPhotoProxyAvailable', callback?: AsyncCallback\<DeferredPhotoProxy\>): void
1611e41f4b71Sopenharmony_ci
1612e41f4b71Sopenharmony_ciUnsubscribes from events indicating available thumbnail proxies.
1613e41f4b71Sopenharmony_ci
1614e41f4b71Sopenharmony_ci**System API**: This is a system API.
1615e41f4b71Sopenharmony_ci
1616e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1617e41f4b71Sopenharmony_ci
1618e41f4b71Sopenharmony_ci**Parameters**
1619e41f4b71Sopenharmony_ci
1620e41f4b71Sopenharmony_ci| Name     | Type                   | Mandatory| Description                                      |
1621e41f4b71Sopenharmony_ci| -------- | ---------------------- | ---- | ------------------------------------------ |
1622e41f4b71Sopenharmony_ci| type     | string                 | Yes  | Event type. The value is fixed at **'deferredPhotoProxyAvailable'**. The event can be listened for when a **photoOutput** instance is created.|
1623e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[DeferredPhotoProxy](#deferredphotoproxy11)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('deferredPhotoProxyAvailable')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)           |
1624e41f4b71Sopenharmony_ci
1625e41f4b71Sopenharmony_ci**Error codes**
1626e41f4b71Sopenharmony_ci
1627e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1628e41f4b71Sopenharmony_ci
1629e41f4b71Sopenharmony_ci| ID        | Error Message       |
1630e41f4b71Sopenharmony_ci| --------------- | --------------- |
1631e41f4b71Sopenharmony_ci| 202         	  |  Not System Application.       |
1632e41f4b71Sopenharmony_ci
1633e41f4b71Sopenharmony_ci**Example**
1634e41f4b71Sopenharmony_ci
1635e41f4b71Sopenharmony_ci```ts
1636e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1637e41f4b71Sopenharmony_ciimport { image } from '@kit.ImageKit';
1638e41f4b71Sopenharmony_ci
1639e41f4b71Sopenharmony_cifunction callback(err: BusinessError, proxyObj: camera.DeferredPhotoProxy): void {
1640e41f4b71Sopenharmony_ci  proxyObj.getThumbnail().then((thumbnail: image.PixelMap) => {
1641e41f4b71Sopenharmony_ci    AppStorage.setOrCreate('proxyThumbnail', thumbnail);
1642e41f4b71Sopenharmony_ci  });
1643e41f4b71Sopenharmony_ci}
1644e41f4b71Sopenharmony_ci
1645e41f4b71Sopenharmony_cifunction unRegisterPhotoOutputDeferredPhotoProxyAvailable(photoOutput: camera.PhotoOutput): void {
1646e41f4b71Sopenharmony_ci  photoOutput.off('deferredPhotoProxyAvailable', callback);
1647e41f4b71Sopenharmony_ci}
1648e41f4b71Sopenharmony_ci```
1649e41f4b71Sopenharmony_ci
1650e41f4b71Sopenharmony_ci### isQuickThumbnailSupported
1651e41f4b71Sopenharmony_ci
1652e41f4b71Sopenharmony_ciisQuickThumbnailSupported(): boolean
1653e41f4b71Sopenharmony_ci
1654e41f4b71Sopenharmony_ciChecks whether the quick thumbnail feature is supported.
1655e41f4b71Sopenharmony_ci
1656e41f4b71Sopenharmony_ciThis API must be called after [addOutput](js-apis-camera.md#addoutput11) or [addInput](js-apis-camera.md#addinput11) and before [commitConfig](js-apis-camera.md#commitconfig11-1).
1657e41f4b71Sopenharmony_ci
1658e41f4b71Sopenharmony_ci**System API**: This is a system API.
1659e41f4b71Sopenharmony_ci
1660e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1661e41f4b71Sopenharmony_ci
1662e41f4b71Sopenharmony_ci**Return value**
1663e41f4b71Sopenharmony_ci
1664e41f4b71Sopenharmony_ci| Type| Description|
1665e41f4b71Sopenharmony_ci| --------- | ------ |
1666e41f4b71Sopenharmony_ci| boolean | **true**: The quick thumbnail feature is supported.<br>**false**: The quick thumbnail feature is not supported.|
1667e41f4b71Sopenharmony_ci
1668e41f4b71Sopenharmony_ci**Error codes**
1669e41f4b71Sopenharmony_ci
1670e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1671e41f4b71Sopenharmony_ci
1672e41f4b71Sopenharmony_ci| ID        | Error Message       |
1673e41f4b71Sopenharmony_ci| --------------- | --------------- |
1674e41f4b71Sopenharmony_ci| 202                	 |  Not System Application.        |
1675e41f4b71Sopenharmony_ci| 7400104                |  session is not running.        |
1676e41f4b71Sopenharmony_ci
1677e41f4b71Sopenharmony_ci**Example**
1678e41f4b71Sopenharmony_ci
1679e41f4b71Sopenharmony_ci```ts
1680e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit';
1681e41f4b71Sopenharmony_ci
1682e41f4b71Sopenharmony_ciasync function isQuickThumbnailSupported(context: common.BaseContext, mode: camera.SceneMode, photoProfile: camera.Profile): Promise<boolean> {
1683e41f4b71Sopenharmony_ci  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
1684e41f4b71Sopenharmony_ci  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
1685e41f4b71Sopenharmony_ci  // Create a CaptureSession instance.
1686e41f4b71Sopenharmony_ci  let session: camera.Session = cameraManager.createSession(mode);
1687e41f4b71Sopenharmony_ci  // Start configuration for the session.
1688e41f4b71Sopenharmony_ci  session.beginConfig();
1689e41f4b71Sopenharmony_ci  // Add a CameraInput instance to the session.
1690e41f4b71Sopenharmony_ci  let cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameras[0]);
1691e41f4b71Sopenharmony_ci  await cameraInput.open();
1692e41f4b71Sopenharmony_ci  session.addInput(cameraInput);
1693e41f4b71Sopenharmony_ci  // Add a PhotoOutput instance to the session.
1694e41f4b71Sopenharmony_ci  let photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
1695e41f4b71Sopenharmony_ci  session.addOutput(photoOutput);
1696e41f4b71Sopenharmony_ci  let isSupported: boolean = photoOutput.isQuickThumbnailSupported();
1697e41f4b71Sopenharmony_ci  return isSupported;
1698e41f4b71Sopenharmony_ci}
1699e41f4b71Sopenharmony_ci```
1700e41f4b71Sopenharmony_ci
1701e41f4b71Sopenharmony_ci### enableQuickThumbnail
1702e41f4b71Sopenharmony_ci
1703e41f4b71Sopenharmony_cienableQuickThumbnail(enabled: boolean): void
1704e41f4b71Sopenharmony_ci
1705e41f4b71Sopenharmony_ciEnables or disables the quick thumbnail feature.
1706e41f4b71Sopenharmony_ci
1707e41f4b71Sopenharmony_ciThis API must be called after [addOutput](js-apis-camera.md#addoutput11) or [addInput](js-apis-camera.md#addinput11) and before [commitConfig](js-apis-camera.md#commitconfig11-1).
1708e41f4b71Sopenharmony_ci
1709e41f4b71Sopenharmony_ci**System API**: This is a system API.
1710e41f4b71Sopenharmony_ci
1711e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1712e41f4b71Sopenharmony_ci
1713e41f4b71Sopenharmony_ci**Parameters**
1714e41f4b71Sopenharmony_ci
1715e41f4b71Sopenharmony_ci| Name    | Type        | Mandatory| Description                                |
1716e41f4b71Sopenharmony_ci| -------- | ------------- | ---- | ----------------------------------- |
1717e41f4b71Sopenharmony_ci| enabled    | boolean       | Yes  | Whether to enable the quick thumbnail feature. The value **true** means to enable the quick thumbnail feature, and **false** means to disable it.|
1718e41f4b71Sopenharmony_ci
1719e41f4b71Sopenharmony_ci**Error codes**
1720e41f4b71Sopenharmony_ci
1721e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1722e41f4b71Sopenharmony_ci
1723e41f4b71Sopenharmony_ci| ID        | Error Message       |
1724e41f4b71Sopenharmony_ci| --------------- | --------------- |
1725e41f4b71Sopenharmony_ci| 202                	 |  Not System Application.        |
1726e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
1727e41f4b71Sopenharmony_ci| 7400104                |  session is not running.        |
1728e41f4b71Sopenharmony_ci| 7400201                |  Camera service fatal error.        |
1729e41f4b71Sopenharmony_ci
1730e41f4b71Sopenharmony_ci**Example**
1731e41f4b71Sopenharmony_ci
1732e41f4b71Sopenharmony_ci```ts
1733e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit';
1734e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1735e41f4b71Sopenharmony_ci
1736e41f4b71Sopenharmony_ciasync function enableQuickThumbnail(context: common.BaseContext, mode: camera.SceneMode, photoProfile: camera.Profile): Promise<void> {
1737e41f4b71Sopenharmony_ci  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
1738e41f4b71Sopenharmony_ci  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
1739e41f4b71Sopenharmony_ci  // Create a CaptureSession instance.
1740e41f4b71Sopenharmony_ci  let session: camera.Session = cameraManager.createSession(mode);
1741e41f4b71Sopenharmony_ci  // Start configuration for the session.
1742e41f4b71Sopenharmony_ci  session.beginConfig();
1743e41f4b71Sopenharmony_ci  // Add a CameraInput instance to the session.
1744e41f4b71Sopenharmony_ci  let cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameras[0]);
1745e41f4b71Sopenharmony_ci  await cameraInput.open();
1746e41f4b71Sopenharmony_ci  session.addInput(cameraInput);
1747e41f4b71Sopenharmony_ci  // Add a PhotoOutput instance to the session.
1748e41f4b71Sopenharmony_ci  let photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
1749e41f4b71Sopenharmony_ci  session.addOutput(photoOutput);
1750e41f4b71Sopenharmony_ci  let isSupported: boolean = photoOutput.isQuickThumbnailSupported();
1751e41f4b71Sopenharmony_ci  if (!isSupported) {
1752e41f4b71Sopenharmony_ci    console.info('Quick Thumbnail is not supported to be turned on.');
1753e41f4b71Sopenharmony_ci    return;
1754e41f4b71Sopenharmony_ci  }
1755e41f4b71Sopenharmony_ci  try {
1756e41f4b71Sopenharmony_ci    photoOutput.enableQuickThumbnail(true);
1757e41f4b71Sopenharmony_ci  } catch (error) {
1758e41f4b71Sopenharmony_ci    let err = error as BusinessError;
1759e41f4b71Sopenharmony_ci    console.error(`The enableQuickThumbnail call failed. error code: ${err.code}`);
1760e41f4b71Sopenharmony_ci  }
1761e41f4b71Sopenharmony_ci}
1762e41f4b71Sopenharmony_ci```
1763e41f4b71Sopenharmony_ci
1764e41f4b71Sopenharmony_ci### on('quickThumbnail')
1765e41f4b71Sopenharmony_ci
1766e41f4b71Sopenharmony_cion(type: 'quickThumbnail', callback: AsyncCallback\<image.PixelMap>): void
1767e41f4b71Sopenharmony_ci
1768e41f4b71Sopenharmony_ciSubscribes to quick thumbnail output events. This API uses an asynchronous callback to return the result.
1769e41f4b71Sopenharmony_ci
1770e41f4b71Sopenharmony_ciThe listening takes effect after **enableQuickThumbnail(true)** is called.
1771e41f4b71Sopenharmony_ci
1772e41f4b71Sopenharmony_ci**System API**: This is a system API.
1773e41f4b71Sopenharmony_ci
1774e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1775e41f4b71Sopenharmony_ci
1776e41f4b71Sopenharmony_ci**Parameters**
1777e41f4b71Sopenharmony_ci
1778e41f4b71Sopenharmony_ci| Name    | Type        | Mandatory| Description                                |
1779e41f4b71Sopenharmony_ci| -------- | ------------- | ---- | ----------------------------------- |
1780e41f4b71Sopenharmony_ci| type    | string     | Yes  | Event type. The value is fixed at **'quickThumbnail'**.|
1781e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)> | Yes| Callback that returns a **PixelMap** instance.|
1782e41f4b71Sopenharmony_ci
1783e41f4b71Sopenharmony_ci**Example**
1784e41f4b71Sopenharmony_ci
1785e41f4b71Sopenharmony_ci```ts
1786e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit';
1787e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1788e41f4b71Sopenharmony_ciimport { image } from '@kit.ImageKit';
1789e41f4b71Sopenharmony_ci
1790e41f4b71Sopenharmony_cifunction callback(err: BusinessError, pixelMap: image.PixelMap): void {
1791e41f4b71Sopenharmony_ci  if (err || pixelMap === undefined) {
1792e41f4b71Sopenharmony_ci      console.error('photoOutput on thumbnail failed');
1793e41f4b71Sopenharmony_ci      return;
1794e41f4b71Sopenharmony_ci  }
1795e41f4b71Sopenharmony_ci  // Display or save the PixelMap instance.
1796e41f4b71Sopenharmony_ci  // do something
1797e41f4b71Sopenharmony_ci}
1798e41f4b71Sopenharmony_ci
1799e41f4b71Sopenharmony_ciasync function registerQuickThumbnail(context: common.BaseContext, mode: camera.SceneMode, photoProfile: camera.Profile): Promise<void> {
1800e41f4b71Sopenharmony_ci  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
1801e41f4b71Sopenharmony_ci  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
1802e41f4b71Sopenharmony_ci  // Create a CaptureSession instance.
1803e41f4b71Sopenharmony_ci  let session: camera.Session = cameraManager.createSession(mode);
1804e41f4b71Sopenharmony_ci  // Start configuration for the session.
1805e41f4b71Sopenharmony_ci  session.beginConfig();
1806e41f4b71Sopenharmony_ci  // Add a CameraInput instance to the session.
1807e41f4b71Sopenharmony_ci  let cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameras[0]);
1808e41f4b71Sopenharmony_ci  await cameraInput.open();
1809e41f4b71Sopenharmony_ci  session.addInput(cameraInput);
1810e41f4b71Sopenharmony_ci  // Add a PhotoOutput instance to the session.
1811e41f4b71Sopenharmony_ci  let photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
1812e41f4b71Sopenharmony_ci  session.addOutput(photoOutput);
1813e41f4b71Sopenharmony_ci  let isSupported: boolean = photoOutput.isQuickThumbnailSupported();
1814e41f4b71Sopenharmony_ci  if (!isSupported) {
1815e41f4b71Sopenharmony_ci    console.info('Quick Thumbnail is not supported to be turned on.');
1816e41f4b71Sopenharmony_ci    return;
1817e41f4b71Sopenharmony_ci  }
1818e41f4b71Sopenharmony_ci  try {
1819e41f4b71Sopenharmony_ci    photoOutput.enableQuickThumbnail(true);
1820e41f4b71Sopenharmony_ci  } catch (error) {
1821e41f4b71Sopenharmony_ci    let err = error as BusinessError;
1822e41f4b71Sopenharmony_ci    console.error(`The enableQuickThumbnail call failed. error code: ${err.code}`);
1823e41f4b71Sopenharmony_ci  }
1824e41f4b71Sopenharmony_ci
1825e41f4b71Sopenharmony_ci  photoOutput.on('quickThumbnail', callback);
1826e41f4b71Sopenharmony_ci}
1827e41f4b71Sopenharmony_ci```
1828e41f4b71Sopenharmony_ci
1829e41f4b71Sopenharmony_ci### off('quickThumbnail')
1830e41f4b71Sopenharmony_ci
1831e41f4b71Sopenharmony_cioff(type: 'quickThumbnail', callback?: AsyncCallback\<image.PixelMap>): void
1832e41f4b71Sopenharmony_ci
1833e41f4b71Sopenharmony_ciUnsubscribes from quick thumbnail output events.
1834e41f4b71Sopenharmony_ci
1835e41f4b71Sopenharmony_ci**System API**: This is a system API.
1836e41f4b71Sopenharmony_ci
1837e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1838e41f4b71Sopenharmony_ci
1839e41f4b71Sopenharmony_ci**Parameters**
1840e41f4b71Sopenharmony_ci
1841e41f4b71Sopenharmony_ci| Name    | Type        | Mandatory| Description                                |
1842e41f4b71Sopenharmony_ci| -------- | ------------- | ---- | ----------------------------------- |
1843e41f4b71Sopenharmony_ci| type    | string     | Yes  | Event type. The value is fixed at **'quickThumbnail'**.|
1844e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)> | No| Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('quickThumbnail')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)|
1845e41f4b71Sopenharmony_ci
1846e41f4b71Sopenharmony_ci**Example**
1847e41f4b71Sopenharmony_ci
1848e41f4b71Sopenharmony_ci```ts
1849e41f4b71Sopenharmony_cifunction unregisterQuickThumbnail(photoOutput: camera.PhotoOutput): void {
1850e41f4b71Sopenharmony_ci  photoOutput.off('quickThumbnail');
1851e41f4b71Sopenharmony_ci}
1852e41f4b71Sopenharmony_ci```
1853e41f4b71Sopenharmony_ci
1854e41f4b71Sopenharmony_ci## VideoOutput
1855e41f4b71Sopenharmony_ci
1856e41f4b71Sopenharmony_ciImplements output information used in a video session. It inherits from [CameraOutput](js-apis-camera.md#cameraoutput).
1857e41f4b71Sopenharmony_ci
1858e41f4b71Sopenharmony_ci### isMirrorSupported<sup>12+</sup>
1859e41f4b71Sopenharmony_ci
1860e41f4b71Sopenharmony_ciisMirrorSupported(): boolean
1861e41f4b71Sopenharmony_ci
1862e41f4b71Sopenharmony_ciChecks whether video mirroring is supported.
1863e41f4b71Sopenharmony_ci
1864e41f4b71Sopenharmony_ci**System API**: This is a system API.
1865e41f4b71Sopenharmony_ci
1866e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1867e41f4b71Sopenharmony_ci
1868e41f4b71Sopenharmony_ci**Return value**
1869e41f4b71Sopenharmony_ci
1870e41f4b71Sopenharmony_ci| Type           | Description                    |
1871e41f4b71Sopenharmony_ci| -------------- | ----------------------- |
1872e41f4b71Sopenharmony_ci| boolean | Whether video mirroring is supported.|
1873e41f4b71Sopenharmony_ci
1874e41f4b71Sopenharmony_ci**Error codes**
1875e41f4b71Sopenharmony_ci
1876e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1877e41f4b71Sopenharmony_ci
1878e41f4b71Sopenharmony_ci| ID        | Error Message       |
1879e41f4b71Sopenharmony_ci| --------------- | --------------- |
1880e41f4b71Sopenharmony_ci| 202                |  Not System Application.    |
1881e41f4b71Sopenharmony_ci
1882e41f4b71Sopenharmony_ci**Example**
1883e41f4b71Sopenharmony_ci
1884e41f4b71Sopenharmony_ci```ts
1885e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1886e41f4b71Sopenharmony_ci
1887e41f4b71Sopenharmony_cifunction isMirrorSupported(videoOutput: camera.VideoOutput): boolean {
1888e41f4b71Sopenharmony_ci  return videoOutput.isMirrorSupported();
1889e41f4b71Sopenharmony_ci}
1890e41f4b71Sopenharmony_ci```
1891e41f4b71Sopenharmony_ci
1892e41f4b71Sopenharmony_ci### enableMirror<sup>12+</sup>
1893e41f4b71Sopenharmony_ci
1894e41f4b71Sopenharmony_cienableMirror(enabled: boolean): void
1895e41f4b71Sopenharmony_ci
1896e41f4b71Sopenharmony_ciEnables video mirroring.
1897e41f4b71Sopenharmony_ci
1898e41f4b71Sopenharmony_ciBefore using this API, call [isMirrorSupported](#ismirrorsupported12) to check whether video mirroring is supported.
1899e41f4b71Sopenharmony_ci
1900e41f4b71Sopenharmony_ci**System API**: This is a system API.
1901e41f4b71Sopenharmony_ci
1902e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1903e41f4b71Sopenharmony_ci
1904e41f4b71Sopenharmony_ci**Parameters**
1905e41f4b71Sopenharmony_ci
1906e41f4b71Sopenharmony_ci| Name     | Type              | Mandatory| Description                |
1907e41f4b71Sopenharmony_ci| -------- | -------------------- | ---- | ------------------- |
1908e41f4b71Sopenharmony_ci|   enabled   |  boolean  |   Yes  |   Whether to enable video mirroring.   |
1909e41f4b71Sopenharmony_ci
1910e41f4b71Sopenharmony_ci**Error codes**
1911e41f4b71Sopenharmony_ci
1912e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1913e41f4b71Sopenharmony_ci
1914e41f4b71Sopenharmony_ci| ID        | Error Message       |
1915e41f4b71Sopenharmony_ci| --------------- | --------------- |
1916e41f4b71Sopenharmony_ci| 202 | Not System Application. |
1917e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.  |
1918e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                             |
1919e41f4b71Sopenharmony_ci
1920e41f4b71Sopenharmony_ci**Example**
1921e41f4b71Sopenharmony_ci
1922e41f4b71Sopenharmony_ci```ts
1923e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1924e41f4b71Sopenharmony_ci
1925e41f4b71Sopenharmony_cifunction enableMirror(videoOutput: camera.VideoOutput): void {
1926e41f4b71Sopenharmony_ci  return videoOutput.enableMirror(true);
1927e41f4b71Sopenharmony_ci}
1928e41f4b71Sopenharmony_ci```
1929e41f4b71Sopenharmony_ci
1930e41f4b71Sopenharmony_ci## PortraitEffect
1931e41f4b71Sopenharmony_ci
1932e41f4b71Sopenharmony_ciEnumerates the portrait effects.
1933e41f4b71Sopenharmony_ci
1934e41f4b71Sopenharmony_ci**System API**: This is a system API.
1935e41f4b71Sopenharmony_ci
1936e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1937e41f4b71Sopenharmony_ci
1938e41f4b71Sopenharmony_ci| Name            | Value   | Description    |
1939e41f4b71Sopenharmony_ci| ----------------| ----  | ---------|
1940e41f4b71Sopenharmony_ci| OFF             | 0      | Disabled.   |
1941e41f4b71Sopenharmony_ci| CIRCLES         | 1      | Circles.   |
1942e41f4b71Sopenharmony_ci| HEART<sup>11+</sup>           | 2      | Heart-shaped.   |
1943e41f4b71Sopenharmony_ci| ROTATED<sup>11+</sup>         | 3      | Rotated.   |
1944e41f4b71Sopenharmony_ci| STUDIO<sup>11+</sup>          | 4      | Studio light. |
1945e41f4b71Sopenharmony_ci| THEATER<sup>11+</sup>         | 5      | Theater light. |
1946e41f4b71Sopenharmony_ci
1947e41f4b71Sopenharmony_ci## BeautyQuery<sup>12+</sup>
1948e41f4b71Sopenharmony_ci
1949e41f4b71Sopenharmony_ciProvides APIs to obtain and set the beauty effect.
1950e41f4b71Sopenharmony_ci
1951e41f4b71Sopenharmony_ci### getSupportedBeautyTypes<sup>12+</sup>
1952e41f4b71Sopenharmony_ci
1953e41f4b71Sopenharmony_cigetSupportedBeautyTypes(): Array\<BeautyType\>
1954e41f4b71Sopenharmony_ci
1955e41f4b71Sopenharmony_ciObtains the supported beauty types.
1956e41f4b71Sopenharmony_ci
1957e41f4b71Sopenharmony_ci**System API**: This is a system API.
1958e41f4b71Sopenharmony_ci
1959e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
1960e41f4b71Sopenharmony_ci
1961e41f4b71Sopenharmony_ci**Return value**
1962e41f4b71Sopenharmony_ci
1963e41f4b71Sopenharmony_ci| Type               | Description                                                 |
1964e41f4b71Sopenharmony_ci| ----------          | -----------------------------                         |
1965e41f4b71Sopenharmony_ci|  Array\<[BeautyType](#beautytype)\>| Array of beauty types supported.                            |
1966e41f4b71Sopenharmony_ci
1967e41f4b71Sopenharmony_ci**Error codes**
1968e41f4b71Sopenharmony_ci
1969e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1970e41f4b71Sopenharmony_ci
1971e41f4b71Sopenharmony_ci| ID        | Error Message       |
1972e41f4b71Sopenharmony_ci| --------------- | --------------- |
1973e41f4b71Sopenharmony_ci| 202                |  Not System Application.                                   |
1974e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
1975e41f4b71Sopenharmony_ci
1976e41f4b71Sopenharmony_ci**Example**
1977e41f4b71Sopenharmony_ci
1978e41f4b71Sopenharmony_ci```ts
1979e41f4b71Sopenharmony_cifunction getSupportedBeautyTypes(portraitPhotoSession: camera.PortraitPhotoSession): Array<camera.BeautyType> {
1980e41f4b71Sopenharmony_ci  let beautyTypes: Array<camera.BeautyType> = portraitPhotoSession.getSupportedBeautyTypes();
1981e41f4b71Sopenharmony_ci  return beautyTypes;
1982e41f4b71Sopenharmony_ci}
1983e41f4b71Sopenharmony_ci```
1984e41f4b71Sopenharmony_ci
1985e41f4b71Sopenharmony_ci### getSupportedBeautyRange<sup>12+</sup>
1986e41f4b71Sopenharmony_ci
1987e41f4b71Sopenharmony_cigetSupportedBeautyRange(type: BeautyType): Array\<number\>
1988e41f4b71Sopenharmony_ci
1989e41f4b71Sopenharmony_ciObtains the levels that can be set a beauty type.
1990e41f4b71Sopenharmony_ci
1991e41f4b71Sopenharmony_ciThe beauty levels vary according to the device type. The following table is only an example.
1992e41f4b71Sopenharmony_ci
1993e41f4b71Sopenharmony_ci| Input Parameter          | Example Return Value   | Return Value Description    |
1994e41f4b71Sopenharmony_ci| ----------------| ----  | ---------|
1995e41f4b71Sopenharmony_ci| AUTO           | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]     |Beauty levels supported when **type** is set to **AUTO**. The value **0** means that beauty mode is disabled, and other positive values mean the corresponding automatic beauty levels.   |
1996e41f4b71Sopenharmony_ci| SKIN_SMOOTH    | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]     | Beauty levels supported when **type** is set to **SKIN_SMOOTH**. The value **0** means that the skin smoothing feature is disabled, and other positive values mean the corresponding skin smoothing levels.   |
1997e41f4b71Sopenharmony_ci| FACE_SLENDER   | [0, 1, 2, 3, 4, 5]      | Beauty levels supported when **type** is set to **FACE_SLENDER**. The value **0** means that the face slimming feature is disabled, and other positive values mean the corresponding face slimming levels.  |
1998e41f4b71Sopenharmony_ci| SKIN_TONE      | [-1, 16242611]      | Beauty levels supported when **type** is set to **SKIN_TONE**. The value **-1** means that the skin tone perfection feature is disabled. Other non-negative values mean the skin tone perfection levels represented by RGB,<br> for example, 16242611, which is 0xF7D7B3 in hexadecimal format, where F7, D7, and B3 represent the values of the R channel, G channel, and B channel, respectively.   |
1999e41f4b71Sopenharmony_ci
2000e41f4b71Sopenharmony_ci**System API**: This is a system API.
2001e41f4b71Sopenharmony_ci
2002e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2003e41f4b71Sopenharmony_ci
2004e41f4b71Sopenharmony_ci**Parameters**
2005e41f4b71Sopenharmony_ci
2006e41f4b71Sopenharmony_ci| Name     | Type                   | Mandatory| Description      |
2007e41f4b71Sopenharmony_ci| -------- | --------------------------| ---- | ----------|
2008e41f4b71Sopenharmony_ci| type     | [BeautyType](#beautytype) | Yes  | Beauty type.  |
2009e41f4b71Sopenharmony_ci
2010e41f4b71Sopenharmony_ci**Return value**
2011e41f4b71Sopenharmony_ci
2012e41f4b71Sopenharmony_ci| Type       | Description                         |
2013e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
2014e41f4b71Sopenharmony_ci|  Array\<number\>     | Array of levels supported.|
2015e41f4b71Sopenharmony_ci
2016e41f4b71Sopenharmony_ci**Error codes**
2017e41f4b71Sopenharmony_ci
2018e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2019e41f4b71Sopenharmony_ci
2020e41f4b71Sopenharmony_ci| ID        | Error Message       |
2021e41f4b71Sopenharmony_ci| --------------- | --------------- |
2022e41f4b71Sopenharmony_ci| 202                |  Not System Application.                                   |
2023e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
2024e41f4b71Sopenharmony_ci
2025e41f4b71Sopenharmony_ci**Example**
2026e41f4b71Sopenharmony_ci
2027e41f4b71Sopenharmony_ci```ts
2028e41f4b71Sopenharmony_cifunction getSupportedBeautyRange(portraitPhotoSession: camera.PortraitPhotoSession): Array<number> {
2029e41f4b71Sopenharmony_ci  let beautyTypes: Array<camera.BeautyType> = portraitPhotoSession.getSupportedBeautyTypes();
2030e41f4b71Sopenharmony_ci  if (beautyTypes === undefined || beautyTypes.length <= 0) {
2031e41f4b71Sopenharmony_ci    return [];
2032e41f4b71Sopenharmony_ci  }
2033e41f4b71Sopenharmony_ci  let beautyLevels: Array<number> = portraitPhotoSession.getSupportedBeautyRange(beautyTypes[0]);
2034e41f4b71Sopenharmony_ci  return beautyLevels;
2035e41f4b71Sopenharmony_ci}
2036e41f4b71Sopenharmony_ci```
2037e41f4b71Sopenharmony_ci
2038e41f4b71Sopenharmony_ci## BeautyType
2039e41f4b71Sopenharmony_ci
2040e41f4b71Sopenharmony_ciEnumerates the beauty types.
2041e41f4b71Sopenharmony_ci
2042e41f4b71Sopenharmony_ci**System API**: This is a system API.
2043e41f4b71Sopenharmony_ci
2044e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2045e41f4b71Sopenharmony_ci
2046e41f4b71Sopenharmony_ci| Name            | Value   | Description    |
2047e41f4b71Sopenharmony_ci| ----------------| ----  | ---------|
2048e41f4b71Sopenharmony_ci| AUTO           | 0      | Automatic.    |
2049e41f4b71Sopenharmony_ci| SKIN_SMOOTH    | 1      | Skin smoothing.    |
2050e41f4b71Sopenharmony_ci| FACE_SLENDER   | 2      | Face slimming.    |
2051e41f4b71Sopenharmony_ci| SKIN_TONE      | 3      | Skin tone perfection.    |
2052e41f4b71Sopenharmony_ci
2053e41f4b71Sopenharmony_ci## ManualExposureQuery<sup>12+</sup>
2054e41f4b71Sopenharmony_ci
2055e41f4b71Sopenharmony_ciProvides APIs to obtain the manual exposure range supported.
2056e41f4b71Sopenharmony_ci
2057e41f4b71Sopenharmony_ci### getSupportedExposureRange<sup>12+</sup>
2058e41f4b71Sopenharmony_ci
2059e41f4b71Sopenharmony_cigetSupportedExposureRange(): Array\<number\>
2060e41f4b71Sopenharmony_ci
2061e41f4b71Sopenharmony_ciObtains the supported manual exposure durations.
2062e41f4b71Sopenharmony_ci
2063e41f4b71Sopenharmony_ci**System API**: This is a system API.
2064e41f4b71Sopenharmony_ci
2065e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2066e41f4b71Sopenharmony_ci
2067e41f4b71Sopenharmony_ci**Return value**
2068e41f4b71Sopenharmony_ci
2069e41f4b71Sopenharmony_ci| Type               | Description                                                 |
2070e41f4b71Sopenharmony_ci| ----------          | -----------------------------                         |
2071e41f4b71Sopenharmony_ci|  Array\<number\>| Array of manual exposure durations supported, in ms.                            |
2072e41f4b71Sopenharmony_ci
2073e41f4b71Sopenharmony_ci**Error codes**
2074e41f4b71Sopenharmony_ci
2075e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2076e41f4b71Sopenharmony_ci
2077e41f4b71Sopenharmony_ci| ID        | Error Message       |
2078e41f4b71Sopenharmony_ci| --------------- | --------------- |
2079e41f4b71Sopenharmony_ci| 202                |  Not System Application.  |
2080e41f4b71Sopenharmony_ci| 7400101            |  Parameter missing or parameter type incorrect.  |
2081e41f4b71Sopenharmony_ci| 7400103            |  Session not config, only throw in session usage.  |
2082e41f4b71Sopenharmony_ci
2083e41f4b71Sopenharmony_ci **Example**
2084e41f4b71Sopenharmony_ci
2085e41f4b71Sopenharmony_ci```ts
2086e41f4b71Sopenharmony_cifunction getSupportedExposureRange(nightPhotoSession: camera.NightPhotoSession): Array<number> {
2087e41f4b71Sopenharmony_ci  let exposureRange: Array<number> = nightPhotoSession.getSupportedExposureRange();
2088e41f4b71Sopenharmony_ci  return exposureRange;
2089e41f4b71Sopenharmony_ci}
2090e41f4b71Sopenharmony_ci```
2091e41f4b71Sopenharmony_ci
2092e41f4b71Sopenharmony_ci## ManualExposure<sup>11+</sup>
2093e41f4b71Sopenharmony_ci
2094e41f4b71Sopenharmony_ciManualExposure extends [ManualExposureQuery](#manualexposurequery12)
2095e41f4b71Sopenharmony_ci
2096e41f4b71Sopenharmony_ciProvides APIs to obtain and set the exposure duration.
2097e41f4b71Sopenharmony_ci
2098e41f4b71Sopenharmony_ci### getExposure<sup>11+</sup>
2099e41f4b71Sopenharmony_ci
2100e41f4b71Sopenharmony_cigetExposure(): number
2101e41f4b71Sopenharmony_ci
2102e41f4b71Sopenharmony_ciObtains the manual exposure duration in use.
2103e41f4b71Sopenharmony_ci
2104e41f4b71Sopenharmony_ci**System API**: This is a system API.
2105e41f4b71Sopenharmony_ci
2106e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2107e41f4b71Sopenharmony_ci
2108e41f4b71Sopenharmony_ci**Return value**
2109e41f4b71Sopenharmony_ci| Name     | Type                                             | Mandatory| Description                   |
2110e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------- | ---- | --------------------- |
2111e41f4b71Sopenharmony_ci| value     | number | Yes  | Manual exposure duration, in ms. |
2112e41f4b71Sopenharmony_ci
2113e41f4b71Sopenharmony_ci**Error codes**
2114e41f4b71Sopenharmony_ci 
2115e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2116e41f4b71Sopenharmony_ci
2117e41f4b71Sopenharmony_ci| ID        | Error Message       |
2118e41f4b71Sopenharmony_ci| --------------- | --------------- |
2119e41f4b71Sopenharmony_ci| 202                    |  Not System Application.                               |
2120e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
2121e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
2122e41f4b71Sopenharmony_ci
2123e41f4b71Sopenharmony_ci**Example**
2124e41f4b71Sopenharmony_ci
2125e41f4b71Sopenharmony_ci```ts
2126e41f4b71Sopenharmony_cifunction getExposure(nightPhotoSession: camera.NightPhotoSession): number | undefined {
2127e41f4b71Sopenharmony_ci  let exposureRange: Array<number> = nightPhotoSession.getSupportedExposureRange();
2128e41f4b71Sopenharmony_ci  if (exposureRange === undefined || exposureRange.length <= 0) {
2129e41f4b71Sopenharmony_ci    return undefined;
2130e41f4b71Sopenharmony_ci  }
2131e41f4b71Sopenharmony_ci  let exposure: number = nightPhotoSession.getExposure();
2132e41f4b71Sopenharmony_ci  return exposure;
2133e41f4b71Sopenharmony_ci}
2134e41f4b71Sopenharmony_ci```
2135e41f4b71Sopenharmony_ci
2136e41f4b71Sopenharmony_ci### setExposure<sup>11+</sup>
2137e41f4b71Sopenharmony_ci
2138e41f4b71Sopenharmony_cisetExposure(exposure: number): void
2139e41f4b71Sopenharmony_ci
2140e41f4b71Sopenharmony_ciSets the manual exposure duration, in ms.
2141e41f4b71Sopenharmony_ci
2142e41f4b71Sopenharmony_ci**System API**: This is a system API.
2143e41f4b71Sopenharmony_ci
2144e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2145e41f4b71Sopenharmony_ci
2146e41f4b71Sopenharmony_ci**Parameters**
2147e41f4b71Sopenharmony_ci
2148e41f4b71Sopenharmony_ci| Name     | Type                   | Mandatory| Description                                                                     |
2149e41f4b71Sopenharmony_ci| -------- | --------------------------| ---- |-------------------------------------------------------------------------|
2150e41f4b71Sopenharmony_ci| value    | number                    | Yes  | Manual exposure duration, which must be one of the supported durations obtained by running [getSupportedExposureRange](#getsupportedexposurerange12).|
2151e41f4b71Sopenharmony_ci
2152e41f4b71Sopenharmony_ci **Error codes**
2153e41f4b71Sopenharmony_ci
2154e41f4b71Sopenharmony_ci| ID        | Error Message       |
2155e41f4b71Sopenharmony_ci| --------------- | --------------- |
2156e41f4b71Sopenharmony_ci| 202                	 |  Not System Application.  |
2157e41f4b71Sopenharmony_ci| 7400102                |  Operation not allowed.   |
2158e41f4b71Sopenharmony_ci| 7400103                |  Session not config.      |
2159e41f4b71Sopenharmony_ci
2160e41f4b71Sopenharmony_ci```ts
2161e41f4b71Sopenharmony_cifunction setExposure(nightPhotoSession: camera.NightPhotoSession): void {
2162e41f4b71Sopenharmony_ci  let exposureRange: Array<number> = nightPhotoSession.getSupportedExposureRange();
2163e41f4b71Sopenharmony_ci  if (exposureRange === undefined || exposureRange.length <= 0) {
2164e41f4b71Sopenharmony_ci    return;
2165e41f4b71Sopenharmony_ci  }
2166e41f4b71Sopenharmony_ci  nightPhotoSession.setExposure(exposureRange[0]);
2167e41f4b71Sopenharmony_ci}
2168e41f4b71Sopenharmony_ci```
2169e41f4b71Sopenharmony_ci
2170e41f4b71Sopenharmony_ci## MacroQuery<sup>12+</sup>
2171e41f4b71Sopenharmony_ci
2172e41f4b71Sopenharmony_ciProvides the API to check the support for macro photography.
2173e41f4b71Sopenharmony_ci
2174e41f4b71Sopenharmony_ci### isMacroSupported<sup>12+</sup>
2175e41f4b71Sopenharmony_ci
2176e41f4b71Sopenharmony_ciisMacroSupported(): boolean
2177e41f4b71Sopenharmony_ci
2178e41f4b71Sopenharmony_ciChecks whether macro photography is supported in the current state. This API must be called after [commitConfig](js-apis-camera.md#commitconfig11-1).
2179e41f4b71Sopenharmony_ci
2180e41f4b71Sopenharmony_ci**System API**: This is a system API.
2181e41f4b71Sopenharmony_ci
2182e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2183e41f4b71Sopenharmony_ci
2184e41f4b71Sopenharmony_ci**Return value**
2185e41f4b71Sopenharmony_ci
2186e41f4b71Sopenharmony_ci| Type       | Description                         |
2187e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
2188e41f4b71Sopenharmony_ci|   boolean  | **true**: Macro photography is supported.<br>**false**: Macro photography is not supported.|
2189e41f4b71Sopenharmony_ci
2190e41f4b71Sopenharmony_ci**Error codes**
2191e41f4b71Sopenharmony_ci
2192e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2193e41f4b71Sopenharmony_ci
2194e41f4b71Sopenharmony_ci| ID  | Error Message                    |
2195e41f4b71Sopenharmony_ci|---------|--------------------------|
2196e41f4b71Sopenharmony_ci| 202     | Not System Application.  |
2197e41f4b71Sopenharmony_ci
2198e41f4b71Sopenharmony_ci**Example**
2199e41f4b71Sopenharmony_ci
2200e41f4b71Sopenharmony_ci```ts
2201e41f4b71Sopenharmony_cifunction isMacroSupported(photoSession: camera.PhotoSessionForSys): boolean {
2202e41f4b71Sopenharmony_ci  let isSupported: boolean = photoSession.isMacroSupported();
2203e41f4b71Sopenharmony_ci  return isSupported;
2204e41f4b71Sopenharmony_ci}
2205e41f4b71Sopenharmony_ci```
2206e41f4b71Sopenharmony_ci
2207e41f4b71Sopenharmony_ci## Macro<sup>11+</sup>
2208e41f4b71Sopenharmony_ci
2209e41f4b71Sopenharmony_ciMacro extends [MacroQuery](#macroquery12)
2210e41f4b71Sopenharmony_ci
2211e41f4b71Sopenharmony_ciProvides the API to enable macro photography.
2212e41f4b71Sopenharmony_ci
2213e41f4b71Sopenharmony_ci### enableMacro<sup>11+</sup>
2214e41f4b71Sopenharmony_ci
2215e41f4b71Sopenharmony_cienableMacro(enabled: boolean): void
2216e41f4b71Sopenharmony_ci
2217e41f4b71Sopenharmony_ciEnables or disables macro photography. This API can be called only when macro photography is supported.
2218e41f4b71Sopenharmony_ci
2219e41f4b71Sopenharmony_ci**System API**: This is a system API.
2220e41f4b71Sopenharmony_ci
2221e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2222e41f4b71Sopenharmony_ci
2223e41f4b71Sopenharmony_ci**Parameters**
2224e41f4b71Sopenharmony_ci
2225e41f4b71Sopenharmony_ci| Name    | Type                  | Mandatory| Description                 |
2226e41f4b71Sopenharmony_ci| -------- | -------------------- | ---- | -------------------- |
2227e41f4b71Sopenharmony_ci| enabled | boolean | Yes  | Whether to enable macro photography. The value **true** means to enable macro photography, and **false** means to disable it.|
2228e41f4b71Sopenharmony_ci
2229e41f4b71Sopenharmony_ci**Error codes**
2230e41f4b71Sopenharmony_ci
2231e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2232e41f4b71Sopenharmony_ci
2233e41f4b71Sopenharmony_ci| ID   | Error Message                    |
2234e41f4b71Sopenharmony_ci|----------|--------------------------|
2235e41f4b71Sopenharmony_ci| 202      | Not System Application.  |
2236e41f4b71Sopenharmony_ci| 7400102  | Operation not allowed.   |
2237e41f4b71Sopenharmony_ci| 7400103  | Session not config.      |
2238e41f4b71Sopenharmony_ci
2239e41f4b71Sopenharmony_ci**Example**
2240e41f4b71Sopenharmony_ci
2241e41f4b71Sopenharmony_ci```ts
2242e41f4b71Sopenharmony_cifunction enableMacro(photoSession: camera.PhotoSessionForSys): void {
2243e41f4b71Sopenharmony_ci  let isSupported: boolean = photoSession.isMacroSupported();
2244e41f4b71Sopenharmony_ci  if (isSupported) {
2245e41f4b71Sopenharmony_ci    photoSession.enableMacro(true);
2246e41f4b71Sopenharmony_ci  }
2247e41f4b71Sopenharmony_ci}
2248e41f4b71Sopenharmony_ci```
2249e41f4b71Sopenharmony_ci
2250e41f4b71Sopenharmony_ci## SceneFeatureType<sup>12+</sup>
2251e41f4b71Sopenharmony_ci
2252e41f4b71Sopenharmony_ciEnumerates the scene features.
2253e41f4b71Sopenharmony_ci
2254e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2255e41f4b71Sopenharmony_ci
2256e41f4b71Sopenharmony_ci| Name                    | Value       | Description        |
2257e41f4b71Sopenharmony_ci| ----------------------- | --------- | ------------ |
2258e41f4b71Sopenharmony_ci| MOON_CAPTURE_BOOST       | 0      | Moon scene. **System API**: This is a system API.           |
2259e41f4b71Sopenharmony_ci
2260e41f4b71Sopenharmony_ci## SceneFeatureDetectionResult<sup>12+</sup>
2261e41f4b71Sopenharmony_ci
2262e41f4b71Sopenharmony_ciDescribes the scene feature detection result.
2263e41f4b71Sopenharmony_ci
2264e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2265e41f4b71Sopenharmony_ci
2266e41f4b71Sopenharmony_ci| Name    | Type       |   Read-only  |   Mandatory  | Description      |
2267e41f4b71Sopenharmony_ci| -------- | ---------- | -------- | -------- | ---------- |
2268e41f4b71Sopenharmony_ci| featureType |   [SceneFeatureType](#scenefeaturetype12)   |   Yes    |    Yes   | Scene feature type. |
2269e41f4b71Sopenharmony_ci| detected |   boolean   |   Yes    |    Yes   | Detection result. The value **true** means that the specified scene feature is detected.|
2270e41f4b71Sopenharmony_ci
2271e41f4b71Sopenharmony_ci## SceneDetection<sup>12+</sup>
2272e41f4b71Sopenharmony_ci
2273e41f4b71Sopenharmony_ciProvides the scene detection capability.
2274e41f4b71Sopenharmony_ci
2275e41f4b71Sopenharmony_ci### isSceneFeatureSupported<sup>12+</sup>
2276e41f4b71Sopenharmony_ci
2277e41f4b71Sopenharmony_ciisSceneFeatureSupported(type: SceneFeatureType): boolean
2278e41f4b71Sopenharmony_ci
2279e41f4b71Sopenharmony_ciChecks whether a scene feature is supported.
2280e41f4b71Sopenharmony_ci
2281e41f4b71Sopenharmony_ci**System API**: This is a system API.
2282e41f4b71Sopenharmony_ci
2283e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2284e41f4b71Sopenharmony_ci
2285e41f4b71Sopenharmony_ci**Parameters**
2286e41f4b71Sopenharmony_ci
2287e41f4b71Sopenharmony_ci| Name  | Type                                       | Mandatory | Description         |
2288e41f4b71Sopenharmony_ci|-------|-------------------------------------------|-----|-------------|
2289e41f4b71Sopenharmony_ci| type  | [SceneFeatureType](#scenefeaturetype12)   | Yes  | Scene feature. |
2290e41f4b71Sopenharmony_ci
2291e41f4b71Sopenharmony_ci**Return value**
2292e41f4b71Sopenharmony_ci
2293e41f4b71Sopenharmony_ci| Type       | Description          |
2294e41f4b71Sopenharmony_ci|-----------|--------------|
2295e41f4b71Sopenharmony_ci| boolean   | **true**: The scene feature is supported.<br>**false**: The scene feature is not supported. |
2296e41f4b71Sopenharmony_ci
2297e41f4b71Sopenharmony_ci**Error codes**
2298e41f4b71Sopenharmony_ci
2299e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2300e41f4b71Sopenharmony_ci
2301e41f4b71Sopenharmony_ci| ID  | Error Message                                          |
2302e41f4b71Sopenharmony_ci|---------|------------------------------------------------|
2303e41f4b71Sopenharmony_ci| 202     | Not System Application.                        |
2304e41f4b71Sopenharmony_ci| 7400101 | Parameter missing or parameter type incorrect. |
2305e41f4b71Sopenharmony_ci
2306e41f4b71Sopenharmony_ci**Example**
2307e41f4b71Sopenharmony_ci
2308e41f4b71Sopenharmony_ci```ts
2309e41f4b71Sopenharmony_cifunction isSceneFeatureSupported(photoSession: camera.PhotoSession, featureType: camera.SceneFeatureType): boolean {
2310e41f4b71Sopenharmony_ci  let isSupported: boolean = photoSession.isSceneFeatureSupported(featureType);
2311e41f4b71Sopenharmony_ci  return isSupported;
2312e41f4b71Sopenharmony_ci}
2313e41f4b71Sopenharmony_ci```
2314e41f4b71Sopenharmony_ci
2315e41f4b71Sopenharmony_ci### enableSceneFeature<sup>12+</sup>
2316e41f4b71Sopenharmony_ci
2317e41f4b71Sopenharmony_cienableSceneFeature(type: SceneFeatureType, enabled: boolean): void
2318e41f4b71Sopenharmony_ci
2319e41f4b71Sopenharmony_ciEnables or disables a scene feature. This API must be called after [SceneFeatureDetectionResult](#scenefeaturedetectionresult12) of the corresponding scene feature is received.
2320e41f4b71Sopenharmony_ci
2321e41f4b71Sopenharmony_ci**System API**: This is a system API.
2322e41f4b71Sopenharmony_ci
2323e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2324e41f4b71Sopenharmony_ci
2325e41f4b71Sopenharmony_ci**Parameters**
2326e41f4b71Sopenharmony_ci
2327e41f4b71Sopenharmony_ci| Name    | Type                                       | Mandatory | Description                         |
2328e41f4b71Sopenharmony_ci|---------|-------------------------------------------|-----|-----------------------------|
2329e41f4b71Sopenharmony_ci| type    | [SceneFeatureType](#scenefeaturetype12)   | Yes  | Scene feature.              |
2330e41f4b71Sopenharmony_ci| enabled | boolean                                   | Yes  | Whether to enable the scene feature. The value **true** means to enable the scene feature, and **false** means the opposite.|
2331e41f4b71Sopenharmony_ci
2332e41f4b71Sopenharmony_ci**Error codes**
2333e41f4b71Sopenharmony_ci
2334e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2335e41f4b71Sopenharmony_ci
2336e41f4b71Sopenharmony_ci| ID  | Error Message                                          |
2337e41f4b71Sopenharmony_ci|---------|------------------------------------------------|
2338e41f4b71Sopenharmony_ci| 202     | Not System Application.                        |
2339e41f4b71Sopenharmony_ci| 7400101 | Parameter missing or parameter type incorrect. |
2340e41f4b71Sopenharmony_ci
2341e41f4b71Sopenharmony_ci**Example**
2342e41f4b71Sopenharmony_ci
2343e41f4b71Sopenharmony_ci```ts
2344e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
2345e41f4b71Sopenharmony_ci
2346e41f4b71Sopenharmony_cifunction enableSceneFeature(photoSession: camera.PhotoSessionForSys, cameraInput: camera.CameraInput, previewOutput: camera.PreviewOutput): void {
2347e41f4b71Sopenharmony_ci  photoSession.beginConfig();
2348e41f4b71Sopenharmony_ci  photoSession.addInput(cameraInput);
2349e41f4b71Sopenharmony_ci  photoSession.addOutput(previewOutput);
2350e41f4b71Sopenharmony_ci  photoSession.commitConfig();
2351e41f4b71Sopenharmony_ci
2352e41f4b71Sopenharmony_ci  photoSession.on('featureDetection', camera.SceneFeatureType.MOON_CAPTURE_BOOST,
2353e41f4b71Sopenharmony_ci    (err: BusinessError, statusObject: camera.SceneFeatureDetectionResult) => {
2354e41f4b71Sopenharmony_ci      if (err !== undefined && err.code !== 0) {
2355e41f4b71Sopenharmony_ci        console.error(`Callback Error, errorCode: ${err.code}`);
2356e41f4b71Sopenharmony_ci        return;
2357e41f4b71Sopenharmony_ci      }
2358e41f4b71Sopenharmony_ci      console.info(
2359e41f4b71Sopenharmony_ci        `on featureDetectionStatus featureType:${statusObject.featureType} detected:${statusObject.detected}`);
2360e41f4b71Sopenharmony_ci      if (statusObject.featureType === camera.SceneFeatureType.MOON_CAPTURE_BOOST) {
2361e41f4b71Sopenharmony_ci        try {
2362e41f4b71Sopenharmony_ci          photoSession.enableSceneFeature(statusObject.featureType, statusObject.detected);
2363e41f4b71Sopenharmony_ci        } catch (error) {
2364e41f4b71Sopenharmony_ci          let err = error as BusinessError;
2365e41f4b71Sopenharmony_ci          console.error(`The enableSceneFeature call failed. error code: ${err.code}`);
2366e41f4b71Sopenharmony_ci        }
2367e41f4b71Sopenharmony_ci      }
2368e41f4b71Sopenharmony_ci    });
2369e41f4b71Sopenharmony_ci}
2370e41f4b71Sopenharmony_ci```
2371e41f4b71Sopenharmony_ci
2372e41f4b71Sopenharmony_ci## ZoomPointInfo<sup>12+</sup>
2373e41f4b71Sopenharmony_ci
2374e41f4b71Sopenharmony_ciDescribes the equivalent focal length information.
2375e41f4b71Sopenharmony_ci
2376e41f4b71Sopenharmony_ci**System API**: This is a system API.
2377e41f4b71Sopenharmony_ci
2378e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2379e41f4b71Sopenharmony_ci
2380e41f4b71Sopenharmony_ci| Name    | Type       |   Read-only  | Optional | Description      |
2381e41f4b71Sopenharmony_ci| -------- | ---------- | -------- |-----| ---------- |
2382e41f4b71Sopenharmony_ci| zoomRatio |   number   |   Yes    | No  | Zoom ratio.|
2383e41f4b71Sopenharmony_ci| equivalentFocalLength |   number   |   Yes    | No  | Equivalent focal length corresponding to the current focal length ratio.|
2384e41f4b71Sopenharmony_ci
2385e41f4b71Sopenharmony_ci## ZoomQuery<sup>12+</sup>
2386e41f4b71Sopenharmony_ci
2387e41f4b71Sopenharmony_ciProvides the API to obtain the equivalent focal length information list in the current mode.
2388e41f4b71Sopenharmony_ci
2389e41f4b71Sopenharmony_ci### getZoomPointInfos<sup>12+</sup>
2390e41f4b71Sopenharmony_ci
2391e41f4b71Sopenharmony_cigetZoomPointInfos(): Array\<ZoomPointInfo\>
2392e41f4b71Sopenharmony_ci
2393e41f4b71Sopenharmony_ciObtains the equivalent focal length information list in the current mode.
2394e41f4b71Sopenharmony_ci
2395e41f4b71Sopenharmony_ci**System API**: This is a system API.
2396e41f4b71Sopenharmony_ci
2397e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2398e41f4b71Sopenharmony_ci
2399e41f4b71Sopenharmony_ci**Return value**
2400e41f4b71Sopenharmony_ci
2401e41f4b71Sopenharmony_ci| Type               | Description                                                 |
2402e41f4b71Sopenharmony_ci| ----------          | -----------------------------                         |
2403e41f4b71Sopenharmony_ci|  Array\<[ZoomPointInfo](#zoompointinfo12)\>| Equivalent focal length information list in the current mode.                  |
2404e41f4b71Sopenharmony_ci
2405e41f4b71Sopenharmony_ci**Error codes**
2406e41f4b71Sopenharmony_ci
2407e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2408e41f4b71Sopenharmony_ci
2409e41f4b71Sopenharmony_ci| ID        | Error Message       |
2410e41f4b71Sopenharmony_ci| --------------- | --------------- |
2411e41f4b71Sopenharmony_ci| 202                    |  Not System Application.                      |
2412e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                          |
2413e41f4b71Sopenharmony_ci
2414e41f4b71Sopenharmony_ci**Example**
2415e41f4b71Sopenharmony_ci
2416e41f4b71Sopenharmony_ci```ts
2417e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
2418e41f4b71Sopenharmony_ci
2419e41f4b71Sopenharmony_cifunction getZoomPointInfos(): Array<ZoomPointInfo> {
2420e41f4b71Sopenharmony_ci  try {
2421e41f4b71Sopenharmony_ci    let zoomPointInfos: Array<ZoomPointInfo> = sessionExtendsZoom.getZoomPointInfos();
2422e41f4b71Sopenharmony_ci	return zoomPointInfos;
2423e41f4b71Sopenharmony_ci  } catch (error) {
2424e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
2425e41f4b71Sopenharmony_ci    let err = error as BusinessError;
2426e41f4b71Sopenharmony_ci    console.error(`The getZoomPointInfos call failed. error code: ${err.code}`);
2427e41f4b71Sopenharmony_ci  }
2428e41f4b71Sopenharmony_ci}
2429e41f4b71Sopenharmony_ci```
2430e41f4b71Sopenharmony_ci
2431e41f4b71Sopenharmony_ci## Zoom<sup>11+</sup>
2432e41f4b71Sopenharmony_ci
2433e41f4b71Sopenharmony_ciZoom extend [ZoomQuery](#zoomquery12)
2434e41f4b71Sopenharmony_ci
2435e41f4b71Sopenharmony_ciProvides APIs to process the zoom effect of a camera device, including obtaining the current zoom ratio, setting a zoom ratio, setting a zoom ratio in a smooth manner, and preparing or unpreparing for zooming.
2436e41f4b71Sopenharmony_ci
2437e41f4b71Sopenharmony_ci### prepareZoom<sup>11+</sup>
2438e41f4b71Sopenharmony_ci
2439e41f4b71Sopenharmony_ciprepareZoom(): void
2440e41f4b71Sopenharmony_ci
2441e41f4b71Sopenharmony_ciInstructs the bottom layer to prepare for zooming, for example, powering on the sensor.
2442e41f4b71Sopenharmony_ci
2443e41f4b71Sopenharmony_ci**System API**: This is a system API.
2444e41f4b71Sopenharmony_ci
2445e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2446e41f4b71Sopenharmony_ci
2447e41f4b71Sopenharmony_ci**Error codes**
2448e41f4b71Sopenharmony_ci
2449e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2450e41f4b71Sopenharmony_ci
2451e41f4b71Sopenharmony_ci| ID        | Error Message       |
2452e41f4b71Sopenharmony_ci| --------------- | --------------- |
2453e41f4b71Sopenharmony_ci| 202                    |  Not System Application.                      |
2454e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                          |
2455e41f4b71Sopenharmony_ci
2456e41f4b71Sopenharmony_ci**Example**
2457e41f4b71Sopenharmony_ci
2458e41f4b71Sopenharmony_ci```ts
2459e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
2460e41f4b71Sopenharmony_ci
2461e41f4b71Sopenharmony_cifunction prepareZoom(sessionExtendsZoom: camera.Zoom): void {
2462e41f4b71Sopenharmony_ci  try {
2463e41f4b71Sopenharmony_ci    sessionExtendsZoom.prepareZoom();
2464e41f4b71Sopenharmony_ci  } catch (error) {
2465e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
2466e41f4b71Sopenharmony_ci    let err = error as BusinessError;
2467e41f4b71Sopenharmony_ci    console.error(`The prepareZoom call failed. error code: ${err.code}`);
2468e41f4b71Sopenharmony_ci  }
2469e41f4b71Sopenharmony_ci}
2470e41f4b71Sopenharmony_ci```
2471e41f4b71Sopenharmony_ci
2472e41f4b71Sopenharmony_ci### unprepareZoom<sup>11+</sup>
2473e41f4b71Sopenharmony_ci
2474e41f4b71Sopenharmony_ciunprepareZoom(): void
2475e41f4b71Sopenharmony_ci
2476e41f4b71Sopenharmony_ciInstructs the bottom layer to unprepare for zooming.
2477e41f4b71Sopenharmony_ci
2478e41f4b71Sopenharmony_ci**System API**: This is a system API.
2479e41f4b71Sopenharmony_ci
2480e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2481e41f4b71Sopenharmony_ci
2482e41f4b71Sopenharmony_ci**Error codes**
2483e41f4b71Sopenharmony_ci
2484e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2485e41f4b71Sopenharmony_ci
2486e41f4b71Sopenharmony_ci| ID        | Error Message       |
2487e41f4b71Sopenharmony_ci| --------------- | --------------- |
2488e41f4b71Sopenharmony_ci| 202                    |  Not System Application.                      |
2489e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                          |
2490e41f4b71Sopenharmony_ci
2491e41f4b71Sopenharmony_ci**Example**
2492e41f4b71Sopenharmony_ci
2493e41f4b71Sopenharmony_ci```ts
2494e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
2495e41f4b71Sopenharmony_ci
2496e41f4b71Sopenharmony_cifunction unprepareZoom(sessionExtendsZoom: camera.Zoom): void {
2497e41f4b71Sopenharmony_ci  try {
2498e41f4b71Sopenharmony_ci    sessionExtendsZoom.unprepareZoom();
2499e41f4b71Sopenharmony_ci  } catch (error) {
2500e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
2501e41f4b71Sopenharmony_ci    let err = error as BusinessError;
2502e41f4b71Sopenharmony_ci    console.error(`The unprepareZoom call failed. error code: ${err.code}`);
2503e41f4b71Sopenharmony_ci  }
2504e41f4b71Sopenharmony_ci}
2505e41f4b71Sopenharmony_ci```
2506e41f4b71Sopenharmony_ci
2507e41f4b71Sopenharmony_ci## ZoomRange<sup>11+</sup>
2508e41f4b71Sopenharmony_ci
2509e41f4b71Sopenharmony_ciObtains the supported zoom ratio range. The range is [min, max), which includes the minimum value but excludes the maximum value.
2510e41f4b71Sopenharmony_ci
2511e41f4b71Sopenharmony_ci**System API**: This is a system API.
2512e41f4b71Sopenharmony_ci
2513e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2514e41f4b71Sopenharmony_ci
2515e41f4b71Sopenharmony_ci| Name    | Type          | Read-only| Mandatory| Description        |
2516e41f4b71Sopenharmony_ci| -------- | ------------- |---- | ---- | -------------|
2517e41f4b71Sopenharmony_ci| min      | number        | Yes |  N/A  | Minimum value of the zoom ratio range. |
2518e41f4b71Sopenharmony_ci| max      | number        | Yes |  N/A  | Maximum value of the zoom ratio range.|
2519e41f4b71Sopenharmony_ci
2520e41f4b71Sopenharmony_ci## Beauty<sup>11+</sup>
2521e41f4b71Sopenharmony_ci
2522e41f4b71Sopenharmony_ciBeauty extends [BeautyQuery](#beautyquery12)
2523e41f4b71Sopenharmony_ci
2524e41f4b71Sopenharmony_ciProvides APIs to obtain and set the beauty effect.
2525e41f4b71Sopenharmony_ci
2526e41f4b71Sopenharmony_ci### setBeauty<sup>11+</sup>
2527e41f4b71Sopenharmony_ci
2528e41f4b71Sopenharmony_cisetBeauty(type: BeautyType, value: number): void
2529e41f4b71Sopenharmony_ci
2530e41f4b71Sopenharmony_ciSets a beauty type and its level. Beauty mode is turned off only when all the [beauty types](#beautytype) obtained through [getSupportedBeautyTypes](#getsupportedbeautytypes12) are disabled.
2531e41f4b71Sopenharmony_ci
2532e41f4b71Sopenharmony_ci**System API**: This is a system API.
2533e41f4b71Sopenharmony_ci
2534e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2535e41f4b71Sopenharmony_ci
2536e41f4b71Sopenharmony_ci**Parameters**
2537e41f4b71Sopenharmony_ci
2538e41f4b71Sopenharmony_ci| Name     | Type                   | Mandatory| Description                                                               |
2539e41f4b71Sopenharmony_ci| -------- | --------------------------| ---- |-------------------------------------------------------------------|
2540e41f4b71Sopenharmony_ci| type     | [BeautyType](#beautytype) | Yes  | Beauty type.                                                            |
2541e41f4b71Sopenharmony_ci| value    | number                    | Yes  | Beauty level, which is obtained through [getSupportedBeautyRange](#getsupportedbeautyrange12).|
2542e41f4b71Sopenharmony_ci
2543e41f4b71Sopenharmony_ci**Error codes**
2544e41f4b71Sopenharmony_ci
2545e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2546e41f4b71Sopenharmony_ci
2547e41f4b71Sopenharmony_ci| ID        | Error Message       |
2548e41f4b71Sopenharmony_ci| --------------- | --------------- |
2549e41f4b71Sopenharmony_ci| 202                |  Not System Application.                                   |
2550e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
2551e41f4b71Sopenharmony_ci
2552e41f4b71Sopenharmony_ci**Example**
2553e41f4b71Sopenharmony_ci
2554e41f4b71Sopenharmony_ci```ts
2555e41f4b71Sopenharmony_cifunction setBeauty(portraitPhotoSession: camera.PortraitPhotoSession): void {
2556e41f4b71Sopenharmony_ci  let beautyTypes: Array<camera.BeautyType> = portraitPhotoSession.getSupportedBeautyTypes();
2557e41f4b71Sopenharmony_ci  if (beautyTypes === undefined || beautyTypes.length <= 0) {
2558e41f4b71Sopenharmony_ci    return;
2559e41f4b71Sopenharmony_ci  }
2560e41f4b71Sopenharmony_ci  let beautyLevels: Array<number> = portraitPhotoSession.getSupportedBeautyRange(beautyTypes[0]);
2561e41f4b71Sopenharmony_ci  if (beautyLevels === undefined || beautyLevels.length <= 0) {
2562e41f4b71Sopenharmony_ci    return;
2563e41f4b71Sopenharmony_ci  }
2564e41f4b71Sopenharmony_ci  portraitPhotoSession.setBeauty(beautyTypes[0], beautyLevels[0]);
2565e41f4b71Sopenharmony_ci}
2566e41f4b71Sopenharmony_ci```
2567e41f4b71Sopenharmony_ci
2568e41f4b71Sopenharmony_ci### getBeauty<sup>11+</sup>
2569e41f4b71Sopenharmony_ci
2570e41f4b71Sopenharmony_cigetBeauty(type: BeautyType): number
2571e41f4b71Sopenharmony_ci
2572e41f4b71Sopenharmony_ciObtains the level of the beauty type in use.
2573e41f4b71Sopenharmony_ci
2574e41f4b71Sopenharmony_ci**System API**: This is a system API.
2575e41f4b71Sopenharmony_ci
2576e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2577e41f4b71Sopenharmony_ci
2578e41f4b71Sopenharmony_ci**Parameters**
2579e41f4b71Sopenharmony_ci
2580e41f4b71Sopenharmony_ci| Name     | Type                                             | Mandatory| Description                   |
2581e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------- | ---- | --------------------- |
2582e41f4b71Sopenharmony_ci| type     | [BeautyType](#beautytype) | Yes  | Beauty type.  |
2583e41f4b71Sopenharmony_ci
2584e41f4b71Sopenharmony_ci**Return value**
2585e41f4b71Sopenharmony_ci| Name     | Type                                             | Mandatory| Description                   |
2586e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------- | ---- | --------------------- |
2587e41f4b71Sopenharmony_ci| value     | number | Yes  | Beauty level. |
2588e41f4b71Sopenharmony_ci
2589e41f4b71Sopenharmony_ci**Error codes**
2590e41f4b71Sopenharmony_ci
2591e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2592e41f4b71Sopenharmony_ci
2593e41f4b71Sopenharmony_ci| ID        | Error Message       |
2594e41f4b71Sopenharmony_ci| --------------- | --------------- |
2595e41f4b71Sopenharmony_ci| 202                |  Not System Application.                                   |
2596e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
2597e41f4b71Sopenharmony_ci
2598e41f4b71Sopenharmony_ci**Example**
2599e41f4b71Sopenharmony_ci
2600e41f4b71Sopenharmony_ci```ts
2601e41f4b71Sopenharmony_cifunction getBeauty(portraitPhotoSession: camera.PortraitPhotoSession): number {
2602e41f4b71Sopenharmony_ci  const invalidValue: number = -1;
2603e41f4b71Sopenharmony_ci  let beautyTypes = portraitPhotoSession.getSupportedBeautyTypes();
2604e41f4b71Sopenharmony_ci  if (beautyTypes === undefined || beautyTypes.length <= 0) {
2605e41f4b71Sopenharmony_ci    return invalidValue;
2606e41f4b71Sopenharmony_ci  }
2607e41f4b71Sopenharmony_ci  let beautyLevels: Array<number> = portraitPhotoSession.getSupportedBeautyRange(beautyTypes[0]);
2608e41f4b71Sopenharmony_ci  if (beautyLevels === undefined || beautyLevels.length <= 0) {
2609e41f4b71Sopenharmony_ci    return invalidValue;
2610e41f4b71Sopenharmony_ci  }
2611e41f4b71Sopenharmony_ci  portraitPhotoSession.setBeauty(beautyTypes[0], beautyLevels[0]);
2612e41f4b71Sopenharmony_ci  let beautyLevel: number = portraitPhotoSession.getBeauty(beautyTypes[0]);
2613e41f4b71Sopenharmony_ci  return beautyLevel;
2614e41f4b71Sopenharmony_ci}
2615e41f4b71Sopenharmony_ci```
2616e41f4b71Sopenharmony_ci
2617e41f4b71Sopenharmony_ci## ColorEffectQuery<sup>12+</sup>
2618e41f4b71Sopenharmony_ci
2619e41f4b71Sopenharmony_ciProvides the API to obtain the color effects supported.
2620e41f4b71Sopenharmony_ci
2621e41f4b71Sopenharmony_ci### getSupportedColorEffects<sup>12+</sup>
2622e41f4b71Sopenharmony_ci
2623e41f4b71Sopenharmony_cigetSupportedColorEffects(): Array\<ColorEffectType\>
2624e41f4b71Sopenharmony_ci
2625e41f4b71Sopenharmony_ciObtains the supported color effects.
2626e41f4b71Sopenharmony_ci
2627e41f4b71Sopenharmony_ci**System API**: This is a system API.
2628e41f4b71Sopenharmony_ci
2629e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2630e41f4b71Sopenharmony_ci
2631e41f4b71Sopenharmony_ci**Return value**
2632e41f4b71Sopenharmony_ci
2633e41f4b71Sopenharmony_ci| Type                                            | Description                          |
2634e41f4b71Sopenharmony_ci| ----------------------------------------------- | ---------------------------- |
2635e41f4b71Sopenharmony_ci| Array<[ColorEffectType](#coloreffecttype11)>       | Array of color effects supported.          |
2636e41f4b71Sopenharmony_ci
2637e41f4b71Sopenharmony_ci**Error codes**
2638e41f4b71Sopenharmony_ci
2639e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2640e41f4b71Sopenharmony_ci
2641e41f4b71Sopenharmony_ci| ID        | Error Message       |
2642e41f4b71Sopenharmony_ci| --------------- | --------------- |
2643e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                      |
2644e41f4b71Sopenharmony_ci| 202             |  Not System Application.                  |
2645e41f4b71Sopenharmony_ci
2646e41f4b71Sopenharmony_ci**Example**
2647e41f4b71Sopenharmony_ci
2648e41f4b71Sopenharmony_ci```ts
2649e41f4b71Sopenharmony_cifunction getSupportedColorEffects(session: camera.PhotoSessionForSys): Array<camera.ColorEffectType> {
2650e41f4b71Sopenharmony_ci  let colorEffects: Array<camera.ColorEffectType> = session.getSupportedColorEffects();
2651e41f4b71Sopenharmony_ci  return colorEffects;
2652e41f4b71Sopenharmony_ci}
2653e41f4b71Sopenharmony_ci```
2654e41f4b71Sopenharmony_ci
2655e41f4b71Sopenharmony_ci## ColorEffect<sup>11+</sup>
2656e41f4b71Sopenharmony_ci
2657e41f4b71Sopenharmony_ciColorEffect extends [ColorEffectQuery](#coloreffectquery12)
2658e41f4b71Sopenharmony_ci
2659e41f4b71Sopenharmony_ciProvides the APIs to obtain and set the lens color effect.
2660e41f4b71Sopenharmony_ci
2661e41f4b71Sopenharmony_ci### setColorEffect<sup>11+</sup>
2662e41f4b71Sopenharmony_ci
2663e41f4b71Sopenharmony_cisetColorEffect(type: ColorEffectType): void
2664e41f4b71Sopenharmony_ci
2665e41f4b71Sopenharmony_ciSets a color effect. Before the setting, call [getSupportedColorEffects](#getsupportedcoloreffects12) to obtain the supported color effects.
2666e41f4b71Sopenharmony_ci
2667e41f4b71Sopenharmony_ci**System API**: This is a system API.
2668e41f4b71Sopenharmony_ci
2669e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2670e41f4b71Sopenharmony_ci
2671e41f4b71Sopenharmony_ci**Parameters**
2672e41f4b71Sopenharmony_ci
2673e41f4b71Sopenharmony_ci| Name        | Type                                                           | Mandatory| Description                     |
2674e41f4b71Sopenharmony_ci| ------------ |--------------------------------------------------------------- | -- | -------------------------- |
2675e41f4b71Sopenharmony_ci| type | [ColorEffectType](#coloreffecttype11)                              | Yes| Color effect, which can be obtained through [getSupportedColorEffects](#getsupportedcoloreffects12).  |
2676e41f4b71Sopenharmony_ci
2677e41f4b71Sopenharmony_ci**Error codes**
2678e41f4b71Sopenharmony_ci
2679e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2680e41f4b71Sopenharmony_ci
2681e41f4b71Sopenharmony_ci| ID        | Error Message       |
2682e41f4b71Sopenharmony_ci| --------------- | --------------- |
2683e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
2684e41f4b71Sopenharmony_ci| 202             |  Not System Application.                         |
2685e41f4b71Sopenharmony_ci
2686e41f4b71Sopenharmony_ci**Example**
2687e41f4b71Sopenharmony_ci
2688e41f4b71Sopenharmony_ci```ts
2689e41f4b71Sopenharmony_cifunction setColorEffect(session: camera.PhotoSessionForSys, colorEffect: camera.ColorEffectType): void {
2690e41f4b71Sopenharmony_ci  session.setColorEffect(colorEffect);
2691e41f4b71Sopenharmony_ci}
2692e41f4b71Sopenharmony_ci```
2693e41f4b71Sopenharmony_ci
2694e41f4b71Sopenharmony_ci### getColorEffect<sup>11+</sup>
2695e41f4b71Sopenharmony_ci
2696e41f4b71Sopenharmony_cigetColorEffect(): ColorEffectType
2697e41f4b71Sopenharmony_ci
2698e41f4b71Sopenharmony_ciObtains the color effect in use.
2699e41f4b71Sopenharmony_ci
2700e41f4b71Sopenharmony_ci**System API**: This is a system API.
2701e41f4b71Sopenharmony_ci
2702e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2703e41f4b71Sopenharmony_ci
2704e41f4b71Sopenharmony_ci**Return value**
2705e41f4b71Sopenharmony_ci
2706e41f4b71Sopenharmony_ci| Type                                            | Description                          |
2707e41f4b71Sopenharmony_ci| ----------------------------------------------- | ---------------------------- |
2708e41f4b71Sopenharmony_ci| [ColorEffectType](#coloreffecttype11)             | Color effect.               |
2709e41f4b71Sopenharmony_ci
2710e41f4b71Sopenharmony_ci**Error codes**
2711e41f4b71Sopenharmony_ci
2712e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2713e41f4b71Sopenharmony_ci
2714e41f4b71Sopenharmony_ci| ID        | Error Message       |
2715e41f4b71Sopenharmony_ci| --------------- | --------------- |
2716e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
2717e41f4b71Sopenharmony_ci| 202             |  Not System Application.                         |
2718e41f4b71Sopenharmony_ci
2719e41f4b71Sopenharmony_ci**Example**
2720e41f4b71Sopenharmony_ci
2721e41f4b71Sopenharmony_ci```ts
2722e41f4b71Sopenharmony_cifunction getColorEffect(session: camera.PhotoSessionForSys): camera.ColorEffectType {
2723e41f4b71Sopenharmony_ci  let colorEffect: camera.ColorEffectType = session.getColorEffect();
2724e41f4b71Sopenharmony_ci  return colorEffect;
2725e41f4b71Sopenharmony_ci}
2726e41f4b71Sopenharmony_ci```
2727e41f4b71Sopenharmony_ci
2728e41f4b71Sopenharmony_ci## ColorEffectType<sup>11+</sup>
2729e41f4b71Sopenharmony_ci
2730e41f4b71Sopenharmony_ciEnumerates the color effect types.
2731e41f4b71Sopenharmony_ci
2732e41f4b71Sopenharmony_ci**System API**: This is a system API.
2733e41f4b71Sopenharmony_ci
2734e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2735e41f4b71Sopenharmony_ci
2736e41f4b71Sopenharmony_ci| Name                 | Value  | Description      |
2737e41f4b71Sopenharmony_ci| --------------------- | ---- | --------- |
2738e41f4b71Sopenharmony_ci| NORMAL                | 0    | Regular color effect. |
2739e41f4b71Sopenharmony_ci| BRIGHT                | 1    | Bright color effect. |
2740e41f4b71Sopenharmony_ci| SOFT                  | 2    | Soft color effect. |
2741e41f4b71Sopenharmony_ci| BLACK_WHITE<sup>12+</sup>    | 3    | Black and white color effect. |
2742e41f4b71Sopenharmony_ci
2743e41f4b71Sopenharmony_ci## Portrait<sup>11+</sup>
2744e41f4b71Sopenharmony_ci
2745e41f4b71Sopenharmony_ciProvides the APIs for portrait photo settings.
2746e41f4b71Sopenharmony_ci
2747e41f4b71Sopenharmony_ci### getSupportedPortraitEffects<sup>10+</sup>
2748e41f4b71Sopenharmony_ci
2749e41f4b71Sopenharmony_cigetSupportedPortraitEffects(): Array\<PortraitEffect\>
2750e41f4b71Sopenharmony_ci
2751e41f4b71Sopenharmony_ciObtains the supported portrait effects.
2752e41f4b71Sopenharmony_ci
2753e41f4b71Sopenharmony_ci**System API**: This is a system API.
2754e41f4b71Sopenharmony_ci
2755e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2756e41f4b71Sopenharmony_ci
2757e41f4b71Sopenharmony_ci**Return value**
2758e41f4b71Sopenharmony_ci
2759e41f4b71Sopenharmony_ci| Type                                            | Description                          |
2760e41f4b71Sopenharmony_ci| ----------------------------------------------- | ---------------------------- |
2761e41f4b71Sopenharmony_ci| Array<[PortraitEffect](#portraiteffect)> | Array of portrait effects supported.              |
2762e41f4b71Sopenharmony_ci
2763e41f4b71Sopenharmony_ci**Error codes**
2764e41f4b71Sopenharmony_ci
2765e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2766e41f4b71Sopenharmony_ci
2767e41f4b71Sopenharmony_ci| ID        | Error Message       |
2768e41f4b71Sopenharmony_ci| --------------- | --------------- |
2769e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                |
2770e41f4b71Sopenharmony_ci| 202             |  Not System Application.            |
2771e41f4b71Sopenharmony_ci
2772e41f4b71Sopenharmony_ci**Example**
2773e41f4b71Sopenharmony_ci
2774e41f4b71Sopenharmony_ci```ts
2775e41f4b71Sopenharmony_cifunction getSupportedPortraitEffects(portraitPhotoSession: camera.PortraitPhotoSession): Array<camera.PortraitEffect> {
2776e41f4b71Sopenharmony_ci  let portraitEffects: Array<camera.PortraitEffect> = portraitPhotoSession.getSupportedPortraitEffects();
2777e41f4b71Sopenharmony_ci  return portraitEffects;
2778e41f4b71Sopenharmony_ci}
2779e41f4b71Sopenharmony_ci```
2780e41f4b71Sopenharmony_ci
2781e41f4b71Sopenharmony_ci### setPortraitEffect<sup>10+</sup>
2782e41f4b71Sopenharmony_ci
2783e41f4b71Sopenharmony_cisetPortraitEffect(effect: PortraitEffect): void
2784e41f4b71Sopenharmony_ci
2785e41f4b71Sopenharmony_ciSets a portrait effect. Before the setting, call [getSupportedPortraitEffects](#getsupportedportraiteffects10) to obtain the supported portrait effects and check whether the target portrait effect is supported.
2786e41f4b71Sopenharmony_ci
2787e41f4b71Sopenharmony_ci**System API**: This is a system API.
2788e41f4b71Sopenharmony_ci
2789e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2790e41f4b71Sopenharmony_ci
2791e41f4b71Sopenharmony_ci**Parameters**
2792e41f4b71Sopenharmony_ci
2793e41f4b71Sopenharmony_ci| Name        | Type                       | Mandatory| Description                     |
2794e41f4b71Sopenharmony_ci| ------------ |----------------------------- | -- | -------------------------- |
2795e41f4b71Sopenharmony_ci| effect | [PortraitEffect](#portraiteffect)  | Yes| Portrait effect, which can be obtained through [getSupportedPortraitEffects](#getsupportedportraiteffects10).  |
2796e41f4b71Sopenharmony_ci
2797e41f4b71Sopenharmony_ci**Error codes**
2798e41f4b71Sopenharmony_ci
2799e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2800e41f4b71Sopenharmony_ci
2801e41f4b71Sopenharmony_ci| ID        | Error Message       |
2802e41f4b71Sopenharmony_ci| --------------- | --------------- |
2803e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                                   |
2804e41f4b71Sopenharmony_ci| 202             |  Not System Application.                         |
2805e41f4b71Sopenharmony_ci
2806e41f4b71Sopenharmony_ci**Example**
2807e41f4b71Sopenharmony_ci
2808e41f4b71Sopenharmony_ci```ts
2809e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
2810e41f4b71Sopenharmony_ci
2811e41f4b71Sopenharmony_cifunction setPortraitEffect(portraitPhotoSession: camera.PortraitPhotoSession, portraitEffects: Array<camera.PortraitEffect>): void {
2812e41f4b71Sopenharmony_ci  if (portraitEffects === undefined || portraitEffects.length <= 0) {
2813e41f4b71Sopenharmony_ci    return;
2814e41f4b71Sopenharmony_ci  }
2815e41f4b71Sopenharmony_ci  try {
2816e41f4b71Sopenharmony_ci    portraitPhotoSession.setPortraitEffect(portraitEffects[0]);
2817e41f4b71Sopenharmony_ci  } catch (error) {
2818e41f4b71Sopenharmony_ci    let err = error as BusinessError;
2819e41f4b71Sopenharmony_ci    console.error(`The setPortraitEffect call failed. error code: ${err.code}`);
2820e41f4b71Sopenharmony_ci  }
2821e41f4b71Sopenharmony_ci}
2822e41f4b71Sopenharmony_ci```
2823e41f4b71Sopenharmony_ci
2824e41f4b71Sopenharmony_ci### getPortraitEffect<sup>10+</sup>
2825e41f4b71Sopenharmony_ci
2826e41f4b71Sopenharmony_cigetPortraitEffect(): PortraitEffect
2827e41f4b71Sopenharmony_ci
2828e41f4b71Sopenharmony_ciObtains the portrait effect in use.
2829e41f4b71Sopenharmony_ci
2830e41f4b71Sopenharmony_ci**System API**: This is a system API.
2831e41f4b71Sopenharmony_ci
2832e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2833e41f4b71Sopenharmony_ci
2834e41f4b71Sopenharmony_ci**Return value**
2835e41f4b71Sopenharmony_ci
2836e41f4b71Sopenharmony_ci| Type                                            | Description                          |
2837e41f4b71Sopenharmony_ci| ----------------------------------------------- | ---------------------------- |
2838e41f4b71Sopenharmony_ci| [PortraitEffect](#portraiteffect)               | Portrait effect.               |
2839e41f4b71Sopenharmony_ci
2840e41f4b71Sopenharmony_ci**Error codes**
2841e41f4b71Sopenharmony_ci
2842e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2843e41f4b71Sopenharmony_ci
2844e41f4b71Sopenharmony_ci| ID        | Error Message       |
2845e41f4b71Sopenharmony_ci| --------------- | --------------- |
2846e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                |
2847e41f4b71Sopenharmony_ci| 202             |  Not System Application.            |
2848e41f4b71Sopenharmony_ci
2849e41f4b71Sopenharmony_ci**Example**
2850e41f4b71Sopenharmony_ci
2851e41f4b71Sopenharmony_ci```ts
2852e41f4b71Sopenharmony_cifunction getPortraitEffect(portraitPhotoSession: camera.PortraitPhotoSession): camera.PortraitEffect {
2853e41f4b71Sopenharmony_ci  let portraitEffect: camera.PortraitEffect = portraitPhotoSession.getPortraitEffect();
2854e41f4b71Sopenharmony_ci  return portraitEffect;
2855e41f4b71Sopenharmony_ci}
2856e41f4b71Sopenharmony_ci```
2857e41f4b71Sopenharmony_ci
2858e41f4b71Sopenharmony_ci## PhysicalAperture<sup>11+</sup>
2859e41f4b71Sopenharmony_ci
2860e41f4b71Sopenharmony_ciDefines the physical aperture information.
2861e41f4b71Sopenharmony_ci
2862e41f4b71Sopenharmony_ci**System API**: This is a system API.
2863e41f4b71Sopenharmony_ci
2864e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2865e41f4b71Sopenharmony_ci
2866e41f4b71Sopenharmony_ci| Name      | Type                      |  Read-only| Optional | Description              |
2867e41f4b71Sopenharmony_ci| ---------- | ------------------------- | ----- |-----| ----------------- |
2868e41f4b71Sopenharmony_ci| zoomRange  | [ZoomRange](#zoomrange11) | No   | No  | Zoom range of a given physical aperture. |
2869e41f4b71Sopenharmony_ci| apertures  | Array\<number\>           | No   | No  | Array of physical apertures supported.     |
2870e41f4b71Sopenharmony_ci
2871e41f4b71Sopenharmony_ci## Aperture<sup>11+</sup>
2872e41f4b71Sopenharmony_ci
2873e41f4b71Sopenharmony_ciProvides the APIs for aperture settings.
2874e41f4b71Sopenharmony_ci
2875e41f4b71Sopenharmony_ci### getSupportedVirtualApertures<sup>11+</sup>
2876e41f4b71Sopenharmony_ci
2877e41f4b71Sopenharmony_cigetSupportedVirtualApertures(): Array\<number\>
2878e41f4b71Sopenharmony_ci
2879e41f4b71Sopenharmony_ciObtains the supported virtual apertures.
2880e41f4b71Sopenharmony_ci
2881e41f4b71Sopenharmony_ci**System API**: This is a system API.
2882e41f4b71Sopenharmony_ci
2883e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2884e41f4b71Sopenharmony_ci
2885e41f4b71Sopenharmony_ci**Return value**
2886e41f4b71Sopenharmony_ci
2887e41f4b71Sopenharmony_ci| Type                                            | Description                          |
2888e41f4b71Sopenharmony_ci| ----------------------------------------------- | ---------------------------- |
2889e41f4b71Sopenharmony_ci| Array\<number\> | Array of virtual apertures supported.              |
2890e41f4b71Sopenharmony_ci
2891e41f4b71Sopenharmony_ci**Error codes**
2892e41f4b71Sopenharmony_ci
2893e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2894e41f4b71Sopenharmony_ci
2895e41f4b71Sopenharmony_ci| ID        | Error Message       |
2896e41f4b71Sopenharmony_ci| --------------- | --------------- |
2897e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                             |
2898e41f4b71Sopenharmony_ci| 202             |  Not System Application.                         |
2899e41f4b71Sopenharmony_ci
2900e41f4b71Sopenharmony_ci**Example**
2901e41f4b71Sopenharmony_ci
2902e41f4b71Sopenharmony_ci```ts
2903e41f4b71Sopenharmony_cifunction getSupportedVirtualApertures(session: camera.PortraitPhotoSession): Array<number> {
2904e41f4b71Sopenharmony_ci  let virtualApertures: Array<number> = session.getSupportedVirtualApertures();
2905e41f4b71Sopenharmony_ci  return virtualApertures;
2906e41f4b71Sopenharmony_ci}
2907e41f4b71Sopenharmony_ci```
2908e41f4b71Sopenharmony_ci
2909e41f4b71Sopenharmony_ci### getVirtualAperture<sup>11+</sup>
2910e41f4b71Sopenharmony_ci
2911e41f4b71Sopenharmony_cigetVirtualAperture(): number
2912e41f4b71Sopenharmony_ci
2913e41f4b71Sopenharmony_ciObtains the virtual aperture in use.
2914e41f4b71Sopenharmony_ci
2915e41f4b71Sopenharmony_ci**System API**: This is a system API.
2916e41f4b71Sopenharmony_ci
2917e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2918e41f4b71Sopenharmony_ci
2919e41f4b71Sopenharmony_ci**Return value**
2920e41f4b71Sopenharmony_ci
2921e41f4b71Sopenharmony_ci| Type                                            | Description                          |
2922e41f4b71Sopenharmony_ci| ----------------------------------------------- | ---------------------------- |
2923e41f4b71Sopenharmony_ci| number               | Virtual aperture.               |
2924e41f4b71Sopenharmony_ci
2925e41f4b71Sopenharmony_ci**Error codes**
2926e41f4b71Sopenharmony_ci
2927e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2928e41f4b71Sopenharmony_ci
2929e41f4b71Sopenharmony_ci| ID        | Error Message       |
2930e41f4b71Sopenharmony_ci| --------------- | --------------- |
2931e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                             |
2932e41f4b71Sopenharmony_ci| 202             |  Not System Application.                         |
2933e41f4b71Sopenharmony_ci
2934e41f4b71Sopenharmony_ci**Example**
2935e41f4b71Sopenharmony_ci
2936e41f4b71Sopenharmony_ci```ts
2937e41f4b71Sopenharmony_cifunction getVirtualAperture(session: camera.PortraitPhotoSession): number {
2938e41f4b71Sopenharmony_ci  let virtualAperture: number = session.getVirtualAperture();
2939e41f4b71Sopenharmony_ci  return virtualAperture;
2940e41f4b71Sopenharmony_ci}
2941e41f4b71Sopenharmony_ci```
2942e41f4b71Sopenharmony_ci
2943e41f4b71Sopenharmony_ci### setVirtualAperture<sup>11+</sup>
2944e41f4b71Sopenharmony_ci
2945e41f4b71Sopenharmony_cisetVirtualAperture(aperture: number): void
2946e41f4b71Sopenharmony_ci
2947e41f4b71Sopenharmony_ciSets a virtual aperture. Before the setting, call [getSupportedVirtualApertures](#getsupportedvirtualapertures11) to obtain the supported virtual apertures.
2948e41f4b71Sopenharmony_ci
2949e41f4b71Sopenharmony_ci**System API**: This is a system API.
2950e41f4b71Sopenharmony_ci
2951e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2952e41f4b71Sopenharmony_ci
2953e41f4b71Sopenharmony_ci**Parameters**
2954e41f4b71Sopenharmony_ci
2955e41f4b71Sopenharmony_ci| Name        | Type                   | Mandatory| Description                     |
2956e41f4b71Sopenharmony_ci| ------------ |------------------------- | -- | -------------------------- |
2957e41f4b71Sopenharmony_ci| aperture       | number                 | Yes| Virtual aperture, which can be obtained by calling [getSupportedVirtualApertures](#getsupportedvirtualapertures11).  |
2958e41f4b71Sopenharmony_ci
2959e41f4b71Sopenharmony_ci**Error codes**
2960e41f4b71Sopenharmony_ci
2961e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2962e41f4b71Sopenharmony_ci
2963e41f4b71Sopenharmony_ci| ID        | Error Message       |
2964e41f4b71Sopenharmony_ci| --------------- | --------------- |
2965e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                          |
2966e41f4b71Sopenharmony_ci| 202             |  Not System Application.                      |
2967e41f4b71Sopenharmony_ci
2968e41f4b71Sopenharmony_ci**Example**
2969e41f4b71Sopenharmony_ci
2970e41f4b71Sopenharmony_ci```ts
2971e41f4b71Sopenharmony_cifunction setVirtualAperture(session: camera.PortraitPhotoSession, virtualAperture: number): void {
2972e41f4b71Sopenharmony_ci  session.setVirtualAperture(virtualAperture);
2973e41f4b71Sopenharmony_ci}
2974e41f4b71Sopenharmony_ci```
2975e41f4b71Sopenharmony_ci
2976e41f4b71Sopenharmony_ci### getSupportedPhysicalApertures<sup>11+</sup>
2977e41f4b71Sopenharmony_ci
2978e41f4b71Sopenharmony_cigetSupportedPhysicalApertures(): Array\<PhysicalAperture\>
2979e41f4b71Sopenharmony_ci
2980e41f4b71Sopenharmony_ciObtains the supported physical apertures.
2981e41f4b71Sopenharmony_ci
2982e41f4b71Sopenharmony_ci**System API**: This is a system API.
2983e41f4b71Sopenharmony_ci
2984e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
2985e41f4b71Sopenharmony_ci
2986e41f4b71Sopenharmony_ci**Return value**
2987e41f4b71Sopenharmony_ci
2988e41f4b71Sopenharmony_ci| Type                                            | Description                          |
2989e41f4b71Sopenharmony_ci| ----------------------------------------------- | ---------------------------- |
2990e41f4b71Sopenharmony_ci| Array<[PhysicalAperture](#physicalaperture11)>    | Array of physical apertures supported.              |
2991e41f4b71Sopenharmony_ci
2992e41f4b71Sopenharmony_ci**Error codes**
2993e41f4b71Sopenharmony_ci
2994e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2995e41f4b71Sopenharmony_ci
2996e41f4b71Sopenharmony_ci| ID        | Error Message       |
2997e41f4b71Sopenharmony_ci| --------------- | --------------- |
2998e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                          |
2999e41f4b71Sopenharmony_ci| 202             |  Not System Application.                      |
3000e41f4b71Sopenharmony_ci
3001e41f4b71Sopenharmony_ci**Example**
3002e41f4b71Sopenharmony_ci
3003e41f4b71Sopenharmony_ci```ts
3004e41f4b71Sopenharmony_cifunction getSupportedPhysicalApertures(session: camera.PortraitPhotoSession): Array<camera.PhysicalAperture> {
3005e41f4b71Sopenharmony_ci  let physicalApertures: Array<camera.PhysicalAperture> = session.getSupportedPhysicalApertures();
3006e41f4b71Sopenharmony_ci  return physicalApertures;
3007e41f4b71Sopenharmony_ci}
3008e41f4b71Sopenharmony_ci```
3009e41f4b71Sopenharmony_ci
3010e41f4b71Sopenharmony_ci### getPhysicalAperture<sup>11+</sup>
3011e41f4b71Sopenharmony_ci
3012e41f4b71Sopenharmony_cigetPhysicalAperture(): number
3013e41f4b71Sopenharmony_ci
3014e41f4b71Sopenharmony_ciObtains the physical aperture in use.
3015e41f4b71Sopenharmony_ci
3016e41f4b71Sopenharmony_ci**System API**: This is a system API.
3017e41f4b71Sopenharmony_ci
3018e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3019e41f4b71Sopenharmony_ci
3020e41f4b71Sopenharmony_ci**Return value**
3021e41f4b71Sopenharmony_ci
3022e41f4b71Sopenharmony_ci| Type                | Description                          |
3023e41f4b71Sopenharmony_ci| -------------------- | ---------------------------- |
3024e41f4b71Sopenharmony_ci| number               | Physical aperture.          |
3025e41f4b71Sopenharmony_ci
3026e41f4b71Sopenharmony_ci**Error codes**
3027e41f4b71Sopenharmony_ci
3028e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3029e41f4b71Sopenharmony_ci
3030e41f4b71Sopenharmony_ci| ID        | Error Message       |
3031e41f4b71Sopenharmony_ci| --------------- | --------------- |
3032e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                             |
3033e41f4b71Sopenharmony_ci| 202             |  Not System Application.                         |
3034e41f4b71Sopenharmony_ci
3035e41f4b71Sopenharmony_ci**Example**
3036e41f4b71Sopenharmony_ci
3037e41f4b71Sopenharmony_ci```ts
3038e41f4b71Sopenharmony_cifunction getPhysicalAperture(session: camera.PortraitPhotoSession): number {
3039e41f4b71Sopenharmony_ci  let physicalAperture: number = session.getPhysicalAperture();
3040e41f4b71Sopenharmony_ci  return physicalAperture;
3041e41f4b71Sopenharmony_ci}
3042e41f4b71Sopenharmony_ci```
3043e41f4b71Sopenharmony_ci
3044e41f4b71Sopenharmony_ci### setPhysicalAperture<sup>11+</sup>
3045e41f4b71Sopenharmony_ci
3046e41f4b71Sopenharmony_cisetPhysicalAperture(aperture: number): void
3047e41f4b71Sopenharmony_ci
3048e41f4b71Sopenharmony_ciSets a physical aperture. Before the setting, call [getSupportedPhysicalApertures](#getsupportedphysicalapertures11) to obtain the supported physical apertures.
3049e41f4b71Sopenharmony_ci
3050e41f4b71Sopenharmony_ci**System API**: This is a system API.
3051e41f4b71Sopenharmony_ci
3052e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3053e41f4b71Sopenharmony_ci
3054e41f4b71Sopenharmony_ci**Parameters**
3055e41f4b71Sopenharmony_ci
3056e41f4b71Sopenharmony_ci| Name        | Type                   | Mandatory| Description                     |
3057e41f4b71Sopenharmony_ci| ------------ |------------------------- | -- | -------------------------- |
3058e41f4b71Sopenharmony_ci| aperture       | number                 | Yes| Physical aperture, which can be obtained by calling [getSupportedPhysicalApertures](#getsupportedphysicalapertures11).  |
3059e41f4b71Sopenharmony_ci
3060e41f4b71Sopenharmony_ci**Error codes**
3061e41f4b71Sopenharmony_ci
3062e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3063e41f4b71Sopenharmony_ci
3064e41f4b71Sopenharmony_ci| ID        | Error Message       |
3065e41f4b71Sopenharmony_ci| --------------- | --------------- |
3066e41f4b71Sopenharmony_ci| 7400103         |  Session not config.                          |
3067e41f4b71Sopenharmony_ci| 202             |  Not System Application.                      |
3068e41f4b71Sopenharmony_ci
3069e41f4b71Sopenharmony_ci**Example**
3070e41f4b71Sopenharmony_ci
3071e41f4b71Sopenharmony_ci```ts
3072e41f4b71Sopenharmony_cifunction setPhysicalAperture(session: camera.PortraitPhotoSession, physicalAperture: number): void {
3073e41f4b71Sopenharmony_ci  session.setPhysicalAperture(physicalAperture);
3074e41f4b71Sopenharmony_ci}
3075e41f4b71Sopenharmony_ci```
3076e41f4b71Sopenharmony_ci
3077e41f4b71Sopenharmony_ci## CaptureSession<sup>(deprecated)</sup>
3078e41f4b71Sopenharmony_ci
3079e41f4b71Sopenharmony_ciImplements a capture session, which saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera and requests the camera to complete shooting or video recording.
3080e41f4b71Sopenharmony_ci
3081e41f4b71Sopenharmony_ci> **NOTE**
3082e41f4b71Sopenharmony_ci>
3083e41f4b71Sopenharmony_ci> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [PhotoSession](#photosession11) and [VideoSession](#videosession11) instead.
3084e41f4b71Sopenharmony_ci
3085e41f4b71Sopenharmony_ci### getSupportedBeautyTypes<sup>(deprecated)</sup>
3086e41f4b71Sopenharmony_ci
3087e41f4b71Sopenharmony_cigetSupportedBeautyTypes(): Array\<BeautyType>
3088e41f4b71Sopenharmony_ci
3089e41f4b71Sopenharmony_ciObtains the supported beauty types.
3090e41f4b71Sopenharmony_ci
3091e41f4b71Sopenharmony_ci> **NOTE**
3092e41f4b71Sopenharmony_ci>
3093e41f4b71Sopenharmony_ci> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [Beauty.getSupportedBeautyTypes](#getsupportedbeautytypes12) instead.
3094e41f4b71Sopenharmony_ci
3095e41f4b71Sopenharmony_ci**System API**: This is a system API.
3096e41f4b71Sopenharmony_ci
3097e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3098e41f4b71Sopenharmony_ci
3099e41f4b71Sopenharmony_ci**Return value**
3100e41f4b71Sopenharmony_ci
3101e41f4b71Sopenharmony_ci| Type               | Description                                                 |
3102e41f4b71Sopenharmony_ci| ----------          | -----------------------------                         |
3103e41f4b71Sopenharmony_ci|  Array\<[BeautyType](#beautytype)\>| Array of beauty types supported.                            |
3104e41f4b71Sopenharmony_ci
3105e41f4b71Sopenharmony_ci**Error codes**
3106e41f4b71Sopenharmony_ci
3107e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3108e41f4b71Sopenharmony_ci
3109e41f4b71Sopenharmony_ci| ID        | Error Message       |
3110e41f4b71Sopenharmony_ci| --------------- | --------------- |
3111e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
3112e41f4b71Sopenharmony_ci
3113e41f4b71Sopenharmony_ci**Example**
3114e41f4b71Sopenharmony_ci
3115e41f4b71Sopenharmony_ci```ts
3116e41f4b71Sopenharmony_cifunction getSupportedBeautyTypes(captureSession: camera.CaptureSession): Array<camera.BeautyType> {
3117e41f4b71Sopenharmony_ci  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3118e41f4b71Sopenharmony_ci  return beautyTypes;
3119e41f4b71Sopenharmony_ci}
3120e41f4b71Sopenharmony_ci```
3121e41f4b71Sopenharmony_ci
3122e41f4b71Sopenharmony_ci### getSupportedBeautyRange<sup>(deprecated)</sup>
3123e41f4b71Sopenharmony_ci
3124e41f4b71Sopenharmony_cigetSupportedBeautyRange(type: BeautyType): Array\<number\>
3125e41f4b71Sopenharmony_ci
3126e41f4b71Sopenharmony_ciObtains the levels that can be set a beauty type. The beauty levels vary according to the device type. The following table is only an example.
3127e41f4b71Sopenharmony_ci
3128e41f4b71Sopenharmony_ci| Input Parameter          | Example Return Value   | Return Value Description    |
3129e41f4b71Sopenharmony_ci| ----------------| ----  | ---------|
3130e41f4b71Sopenharmony_ci| AUTO           | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]     |Beauty levels supported when **type** is set to **AUTO**. The value **0** means that beauty mode is disabled, and other positive values mean the corresponding automatic beauty levels.   |
3131e41f4b71Sopenharmony_ci| SKIN_SMOOTH    | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]     | Beauty levels supported when **type** is set to **SKIN_SMOOTH**. The value **0** means that the skin smoothing feature is disabled, and other positive values mean the corresponding skin smoothing levels.   |
3132e41f4b71Sopenharmony_ci| FACE_SLENDER   | [0, 1, 2, 3, 4, 5]      | Beauty levels supported when **type** is set to **FACE_SLENDER**. The value **0** means that the face slimming feature is disabled, and other positive values mean the corresponding face slimming levels.  |
3133e41f4b71Sopenharmony_ci| SKIN_TONE      | [-1, 16242611]      | Beauty levels supported when **type** is set to **SKIN_TONE**. The value **-1** means that the skin tone perfection feature is disabled. Other non-negative values mean the skin tone perfection levels represented by RGB,<br> for example, 16242611, which is 0xF7D7B3 in hexadecimal format, where F7, D7, and B3 represent the values of the R channel, G channel, and B channel, respectively.   |
3134e41f4b71Sopenharmony_ci
3135e41f4b71Sopenharmony_ci> **NOTE**
3136e41f4b71Sopenharmony_ci>
3137e41f4b71Sopenharmony_ci> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [Beauty.getSupportedBeautyRange](#getsupportedbeautyrange12) instead.
3138e41f4b71Sopenharmony_ci
3139e41f4b71Sopenharmony_ci**System API**: This is a system API.
3140e41f4b71Sopenharmony_ci
3141e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3142e41f4b71Sopenharmony_ci
3143e41f4b71Sopenharmony_ci**Parameters**
3144e41f4b71Sopenharmony_ci
3145e41f4b71Sopenharmony_ci| Name     | Type                   | Mandatory| Description      |
3146e41f4b71Sopenharmony_ci| -------- | --------------------------| ---- | ----------|
3147e41f4b71Sopenharmony_ci| type     | [BeautyType](#beautytype) | Yes  | Beauty type.  |
3148e41f4b71Sopenharmony_ci
3149e41f4b71Sopenharmony_ci**Return value**
3150e41f4b71Sopenharmony_ci
3151e41f4b71Sopenharmony_ci| Type       | Description                         |
3152e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
3153e41f4b71Sopenharmony_ci|  Array\<number\>     | Array of levels supported.|
3154e41f4b71Sopenharmony_ci
3155e41f4b71Sopenharmony_ci**Error codes**
3156e41f4b71Sopenharmony_ci
3157e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3158e41f4b71Sopenharmony_ci
3159e41f4b71Sopenharmony_ci| ID        | Error Message       |
3160e41f4b71Sopenharmony_ci| --------------- | --------------- |
3161e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
3162e41f4b71Sopenharmony_ci
3163e41f4b71Sopenharmony_ci**Example**
3164e41f4b71Sopenharmony_ci
3165e41f4b71Sopenharmony_ci```ts
3166e41f4b71Sopenharmony_cifunction getSupportedBeautyRange(captureSession: camera.CaptureSession): Array<number> {
3167e41f4b71Sopenharmony_ci  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3168e41f4b71Sopenharmony_ci  if (beautyTypes === undefined || beautyTypes.length <= 0) {
3169e41f4b71Sopenharmony_ci    return [];
3170e41f4b71Sopenharmony_ci  }
3171e41f4b71Sopenharmony_ci  let beautyLevels: Array<number> = captureSession.getSupportedBeautyRange(beautyTypes[0]);
3172e41f4b71Sopenharmony_ci  return beautyLevels;
3173e41f4b71Sopenharmony_ci}
3174e41f4b71Sopenharmony_ci```
3175e41f4b71Sopenharmony_ci
3176e41f4b71Sopenharmony_ci### setBeauty<sup>(deprecated)</sup>
3177e41f4b71Sopenharmony_ci
3178e41f4b71Sopenharmony_cisetBeauty(type: BeautyType, value: number): void
3179e41f4b71Sopenharmony_ci
3180e41f4b71Sopenharmony_ciSets a beauty type and its level. Beauty mode is turned off only when all the [beauty types](#beautytype) obtained through [getSupportedBeautyTypes](#getsupportedbeautytypesdeprecated) are disabled.
3181e41f4b71Sopenharmony_ci
3182e41f4b71Sopenharmony_ci> **NOTE**
3183e41f4b71Sopenharmony_ci>
3184e41f4b71Sopenharmony_ci> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [Beauty.setBeauty](#setbeauty11) instead.
3185e41f4b71Sopenharmony_ci
3186e41f4b71Sopenharmony_ci**System API**: This is a system API.
3187e41f4b71Sopenharmony_ci
3188e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3189e41f4b71Sopenharmony_ci
3190e41f4b71Sopenharmony_ci**Parameters**
3191e41f4b71Sopenharmony_ci
3192e41f4b71Sopenharmony_ci| Name     | Type                   | Mandatory| Description                  |
3193e41f4b71Sopenharmony_ci| -------- | --------------------------| ---- | --------------------- |
3194e41f4b71Sopenharmony_ci| type     | [BeautyType](#beautytype) | Yes  | Beauty type.             |
3195e41f4b71Sopenharmony_ci| value    | number                    | Yes  | Beauty level, which is obtained through [getSupportedBeautyRange](#getsupportedbeautyrangedeprecated).|
3196e41f4b71Sopenharmony_ci
3197e41f4b71Sopenharmony_ci**Error codes**
3198e41f4b71Sopenharmony_ci
3199e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3200e41f4b71Sopenharmony_ci
3201e41f4b71Sopenharmony_ci| ID        | Error Message       |
3202e41f4b71Sopenharmony_ci| --------------- | --------------- |
3203e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
3204e41f4b71Sopenharmony_ci
3205e41f4b71Sopenharmony_ci**Example**
3206e41f4b71Sopenharmony_ci
3207e41f4b71Sopenharmony_ci```ts
3208e41f4b71Sopenharmony_cifunction setBeauty(captureSession: camera.CaptureSession): void {
3209e41f4b71Sopenharmony_ci  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3210e41f4b71Sopenharmony_ci  if (beautyTypes === undefined || beautyTypes.length <= 0) {
3211e41f4b71Sopenharmony_ci    return;
3212e41f4b71Sopenharmony_ci  }
3213e41f4b71Sopenharmony_ci  let beautyLevels: Array<number> = captureSession.getSupportedBeautyRange(beautyTypes[0]);
3214e41f4b71Sopenharmony_ci  if (beautyLevels === undefined || beautyLevels.length <= 0) {
3215e41f4b71Sopenharmony_ci    return;
3216e41f4b71Sopenharmony_ci  }
3217e41f4b71Sopenharmony_ci  captureSession.setBeauty(beautyTypes[0], beautyLevels[0]);
3218e41f4b71Sopenharmony_ci}
3219e41f4b71Sopenharmony_ci```
3220e41f4b71Sopenharmony_ci
3221e41f4b71Sopenharmony_ci### getBeauty<sup>(deprecated)</sup>
3222e41f4b71Sopenharmony_ci
3223e41f4b71Sopenharmony_cigetBeauty(type: BeautyType): number
3224e41f4b71Sopenharmony_ci
3225e41f4b71Sopenharmony_ciObtains the level of the beauty type in use.
3226e41f4b71Sopenharmony_ci
3227e41f4b71Sopenharmony_ci> **NOTE**
3228e41f4b71Sopenharmony_ci>
3229e41f4b71Sopenharmony_ci> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [Beauty.getBeauty](#getbeauty11) instead.
3230e41f4b71Sopenharmony_ci
3231e41f4b71Sopenharmony_ci**System API**: This is a system API.
3232e41f4b71Sopenharmony_ci
3233e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3234e41f4b71Sopenharmony_ci
3235e41f4b71Sopenharmony_ci**Parameters**
3236e41f4b71Sopenharmony_ci
3237e41f4b71Sopenharmony_ci| Name     | Type                                             | Mandatory| Description                   |
3238e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------- | ---- | --------------------- |
3239e41f4b71Sopenharmony_ci| type     | [BeautyType](#beautytype) | Yes  | Beauty type.  |
3240e41f4b71Sopenharmony_ci
3241e41f4b71Sopenharmony_ci**Return value**
3242e41f4b71Sopenharmony_ci| Name     | Type                                             | Mandatory| Description                   |
3243e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------- | ---- | --------------------- |
3244e41f4b71Sopenharmony_ci| value     | number | Yes  | Beauty level. |
3245e41f4b71Sopenharmony_ci
3246e41f4b71Sopenharmony_ci**Error codes**
3247e41f4b71Sopenharmony_ci
3248e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3249e41f4b71Sopenharmony_ci
3250e41f4b71Sopenharmony_ci| ID        | Error Message       |
3251e41f4b71Sopenharmony_ci| --------------- | --------------- |
3252e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
3253e41f4b71Sopenharmony_ci
3254e41f4b71Sopenharmony_ci**Example**
3255e41f4b71Sopenharmony_ci
3256e41f4b71Sopenharmony_ci```ts
3257e41f4b71Sopenharmony_cifunction getBeauty(captureSession: camera.CaptureSession): number {
3258e41f4b71Sopenharmony_ci  const invalidValue: number = -1;
3259e41f4b71Sopenharmony_ci  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3260e41f4b71Sopenharmony_ci  if (beautyTypes === undefined || beautyTypes.length <= 0) {
3261e41f4b71Sopenharmony_ci    return invalidValue;
3262e41f4b71Sopenharmony_ci  }
3263e41f4b71Sopenharmony_ci  let beautyLevels: Array<number> = captureSession.getSupportedBeautyRange(beautyTypes[0]);
3264e41f4b71Sopenharmony_ci  if (beautyLevels === undefined || beautyLevels.length <= 0) {
3265e41f4b71Sopenharmony_ci    return invalidValue;
3266e41f4b71Sopenharmony_ci  }
3267e41f4b71Sopenharmony_ci  captureSession.setBeauty(beautyTypes[0], beautyLevels[0]);
3268e41f4b71Sopenharmony_ci  let beautyLevel: number = captureSession.getBeauty(beautyTypes[0]);
3269e41f4b71Sopenharmony_ci  return beautyLevel;
3270e41f4b71Sopenharmony_ci}
3271e41f4b71Sopenharmony_ci```
3272e41f4b71Sopenharmony_ci
3273e41f4b71Sopenharmony_ci## PhotoSessionForSys<sup>11+</sup>
3274e41f4b71Sopenharmony_ci
3275e41f4b71Sopenharmony_ciPhotoSessionForSys extends PhotoSession, Beauty, ColorEffect, ColorManagement, Macro, SceneDetection
3276e41f4b71Sopenharmony_ci
3277e41f4b71Sopenharmony_ciImplements a photo session for system applications, which sets the parameters of the normal photo mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
3278e41f4b71Sopenharmony_ci
3279e41f4b71Sopenharmony_ci**System API**: This is a system API.
3280e41f4b71Sopenharmony_ci
3281e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3282e41f4b71Sopenharmony_ci
3283e41f4b71Sopenharmony_ci## PhotoSession<sup>11+</sup>
3284e41f4b71Sopenharmony_ci
3285e41f4b71Sopenharmony_ciPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorManagement
3286e41f4b71Sopenharmony_ci
3287e41f4b71Sopenharmony_ciImplements a photo session, which sets the parameters of the normal photo mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
3288e41f4b71Sopenharmony_ci
3289e41f4b71Sopenharmony_ci### on('macroStatusChanged')<sup>11+</sup>
3290e41f4b71Sopenharmony_ci
3291e41f4b71Sopenharmony_cion(type: 'macroStatusChanged', callback: AsyncCallback\<boolean\>): void
3292e41f4b71Sopenharmony_ci
3293e41f4b71Sopenharmony_ciSubscribes to macro state change events. This API uses an asynchronous callback to return the result.
3294e41f4b71Sopenharmony_ci
3295e41f4b71Sopenharmony_ci**System API**: This is a system API.
3296e41f4b71Sopenharmony_ci
3297e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3298e41f4b71Sopenharmony_ci
3299e41f4b71Sopenharmony_ci**Parameters**
3300e41f4b71Sopenharmony_ci
3301e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
3302e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
3303e41f4b71Sopenharmony_ci| type     | string      | Yes  | Event type. The value is fixed at **'macroStatusChanged'**. The event can be listened for when a session is created.|
3304e41f4b71Sopenharmony_ci| callback | AsyncCallback\<boolean\>     | Yes  | Callback used to return the macro state change. |
3305e41f4b71Sopenharmony_ci
3306e41f4b71Sopenharmony_ci**Error codes**
3307e41f4b71Sopenharmony_ci
3308e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3309e41f4b71Sopenharmony_ci
3310e41f4b71Sopenharmony_ci| ID| Error Message                     |
3311e41f4b71Sopenharmony_ci|-------|---------------------------|
3312e41f4b71Sopenharmony_ci| 202   | Not System Application.   |
3313e41f4b71Sopenharmony_ci
3314e41f4b71Sopenharmony_ci**Example**
3315e41f4b71Sopenharmony_ci
3316e41f4b71Sopenharmony_ci```ts
3317e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
3318e41f4b71Sopenharmony_ci
3319e41f4b71Sopenharmony_cifunction callback(err: BusinessError, macroStatus: boolean): void {
3320e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
3321e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
3322e41f4b71Sopenharmony_ci    return;
3323e41f4b71Sopenharmony_ci  }
3324e41f4b71Sopenharmony_ci  console.info(`Macro state: ${macroStatus}`);
3325e41f4b71Sopenharmony_ci}
3326e41f4b71Sopenharmony_ci
3327e41f4b71Sopenharmony_cifunction registerMacroStatusChanged(photoSession: camera.PhotoSession): void {
3328e41f4b71Sopenharmony_ci  photoSession.on('macroStatusChanged', callback);
3329e41f4b71Sopenharmony_ci}
3330e41f4b71Sopenharmony_ci```
3331e41f4b71Sopenharmony_ci
3332e41f4b71Sopenharmony_ci### off('macroStatusChanged')<sup>11+</sup>
3333e41f4b71Sopenharmony_ci
3334e41f4b71Sopenharmony_cioff(type: 'macroStatusChanged', callback?: AsyncCallback\<boolean\>): void
3335e41f4b71Sopenharmony_ci
3336e41f4b71Sopenharmony_ciUnsubscribes from macro state change events.
3337e41f4b71Sopenharmony_ci
3338e41f4b71Sopenharmony_ci**System API**: This is a system API.
3339e41f4b71Sopenharmony_ci
3340e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3341e41f4b71Sopenharmony_ci
3342e41f4b71Sopenharmony_ci**Parameters**
3343e41f4b71Sopenharmony_ci
3344e41f4b71Sopenharmony_ci| Name    | Type                   | Mandatory| Description                      |
3345e41f4b71Sopenharmony_ci| -------- | ------------------------ | ---- | ------------------------ |
3346e41f4b71Sopenharmony_ci| type     | string                   | Yes  | Event type. The value is fixed at **'macroStatusChanged'**. The event can be listened for when a session is created.|
3347e41f4b71Sopenharmony_ci| callback | AsyncCallback\<boolean\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('macroStatusChanged')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)|
3348e41f4b71Sopenharmony_ci
3349e41f4b71Sopenharmony_ci**Error codes**
3350e41f4b71Sopenharmony_ci
3351e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3352e41f4b71Sopenharmony_ci
3353e41f4b71Sopenharmony_ci| ID| Error Message                     |
3354e41f4b71Sopenharmony_ci|-------|---------------------------|
3355e41f4b71Sopenharmony_ci| 202   | Not System Application.   |
3356e41f4b71Sopenharmony_ci
3357e41f4b71Sopenharmony_ci**Example**
3358e41f4b71Sopenharmony_ci
3359e41f4b71Sopenharmony_ci```ts
3360e41f4b71Sopenharmony_cifunction unregisterMacroStatusChanged(photoSession: camera.PhotoSession): void {
3361e41f4b71Sopenharmony_ci  photoSession.off('macroStatusChanged');
3362e41f4b71Sopenharmony_ci}
3363e41f4b71Sopenharmony_ci```
3364e41f4b71Sopenharmony_ci
3365e41f4b71Sopenharmony_ci### on('featureDetection')<sup>12+</sup>
3366e41f4b71Sopenharmony_ci
3367e41f4b71Sopenharmony_cion(type: 'featureDetection', featureType: SceneFeatureType, callback: AsyncCallback\<SceneFeatureDetectionResult\>): void
3368e41f4b71Sopenharmony_ci
3369e41f4b71Sopenharmony_ciSubscribe to scene feature detection status change events. This API uses an asynchronous callback to return the result.
3370e41f4b71Sopenharmony_ci
3371e41f4b71Sopenharmony_ci**System API**: This is a system API.
3372e41f4b71Sopenharmony_ci
3373e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3374e41f4b71Sopenharmony_ci
3375e41f4b71Sopenharmony_ci**Parameters**
3376e41f4b71Sopenharmony_ci
3377e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
3378e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
3379e41f4b71Sopenharmony_ci| type     | string      | Yes  | Event type. The value is fixed at **'featureDetection'**. The event can be listened for when a photo session is created.|
3380e41f4b71Sopenharmony_ci| featureType     | [SceneFeatureType](#scenefeaturetype12)      | Yes  | Scene feature type.|
3381e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SceneFeatureDetectionResult](#scenefeaturedetectionresult12)\>     | Yes  | Callback used to return the status of the scene feature detection. |
3382e41f4b71Sopenharmony_ci
3383e41f4b71Sopenharmony_ci**Error codes**
3384e41f4b71Sopenharmony_ci
3385e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3386e41f4b71Sopenharmony_ci
3387e41f4b71Sopenharmony_ci| ID| Error Message                     |
3388e41f4b71Sopenharmony_ci|-------|---------------------------|
3389e41f4b71Sopenharmony_ci| 202   | Not System Application.   |
3390e41f4b71Sopenharmony_ci
3391e41f4b71Sopenharmony_ci**Example**
3392e41f4b71Sopenharmony_ci
3393e41f4b71Sopenharmony_ci```ts
3394e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
3395e41f4b71Sopenharmony_ci
3396e41f4b71Sopenharmony_cifunction callback(err: BusinessError, result: camera.SceneFeatureDetectionResult): void {
3397e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
3398e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
3399e41f4b71Sopenharmony_ci    return;
3400e41f4b71Sopenharmony_ci  }
3401e41f4b71Sopenharmony_ci  console.info(`feature type: ${result.featureType}`);
3402e41f4b71Sopenharmony_ci  console.info(`feature status: ${result.detected}`);
3403e41f4b71Sopenharmony_ci}
3404e41f4b71Sopenharmony_ci
3405e41f4b71Sopenharmony_cifunction registerFeatureDetectionStatus(photoSession: camera.PhotoSession, featureType: camera.SceneFeatureType): void {
3406e41f4b71Sopenharmony_ci  photoSession.on('featureDetection', featureType, callback);
3407e41f4b71Sopenharmony_ci}
3408e41f4b71Sopenharmony_ci```
3409e41f4b71Sopenharmony_ci
3410e41f4b71Sopenharmony_ci### off('featureDetection')<sup>12+</sup>
3411e41f4b71Sopenharmony_ci
3412e41f4b71Sopenharmony_cioff(type: 'featureDetection', featureType: SceneFeatureType, callback?: AsyncCallback\<SceneFeatureDetectionResult\>): void
3413e41f4b71Sopenharmony_ci
3414e41f4b71Sopenharmony_ciUnsubscribe from camera feature detection status change events.
3415e41f4b71Sopenharmony_ci
3416e41f4b71Sopenharmony_ci**System API**: This is a system API.
3417e41f4b71Sopenharmony_ci
3418e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3419e41f4b71Sopenharmony_ci
3420e41f4b71Sopenharmony_ci**Parameters**
3421e41f4b71Sopenharmony_ci
3422e41f4b71Sopenharmony_ci| Name   | Type                    | Mandatory| Description                      |
3423e41f4b71Sopenharmony_ci| -------- | ------------------------ | ---- | ------------------------ |
3424e41f4b71Sopenharmony_ci| type     | string                   | Yes  | Event type. The value is fixed at **'featureDetection'**. The event can be listened for when a session is created.|
3425e41f4b71Sopenharmony_ci| featureType     | [SceneFeatureType](#scenefeaturetype12)      | Yes  | Scene feature type.|
3426e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SceneFeatureDetectionResult](#scenefeaturedetectionresult12)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('featureDetection')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)|
3427e41f4b71Sopenharmony_ci
3428e41f4b71Sopenharmony_ci**Error codes**
3429e41f4b71Sopenharmony_ci
3430e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3431e41f4b71Sopenharmony_ci
3432e41f4b71Sopenharmony_ci| ID| Error Message                     |
3433e41f4b71Sopenharmony_ci|-------|---------------------------|
3434e41f4b71Sopenharmony_ci| 202   | Not System Application.   |
3435e41f4b71Sopenharmony_ci
3436e41f4b71Sopenharmony_ci**Example**
3437e41f4b71Sopenharmony_ci
3438e41f4b71Sopenharmony_ci```ts
3439e41f4b71Sopenharmony_cifunction unregisterFeatureDetectionStatus(photoSession: camera.PhotoSession, featureType: camera.SceneFeatureType): void {
3440e41f4b71Sopenharmony_ci  photoSession.off('featureDetection', featureType);
3441e41f4b71Sopenharmony_ci}
3442e41f4b71Sopenharmony_ci```
3443e41f4b71Sopenharmony_ci
3444e41f4b71Sopenharmony_ci## VideoSessionForSys<sup>11+</sup>
3445e41f4b71Sopenharmony_ci
3446e41f4b71Sopenharmony_ciVideoSessionForSys extends VideoSession, Beauty, ColorEffect, ColorManagement, Macro
3447e41f4b71Sopenharmony_ci
3448e41f4b71Sopenharmony_ciImplements a video session for system applications, which sets the parameters of the normal video mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
3449e41f4b71Sopenharmony_ci
3450e41f4b71Sopenharmony_ci**System API**: This is a system API.
3451e41f4b71Sopenharmony_ci
3452e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3453e41f4b71Sopenharmony_ci
3454e41f4b71Sopenharmony_ci## VideoSession<sup>11+</sup>
3455e41f4b71Sopenharmony_ci
3456e41f4b71Sopenharmony_ciVideoSession extends Session, Flash, AutoExposure, Focus, Zoom, Stabilization, ColorManagement
3457e41f4b71Sopenharmony_ci
3458e41f4b71Sopenharmony_ciImplements a video session, which sets the parameters of the normal video mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
3459e41f4b71Sopenharmony_ci
3460e41f4b71Sopenharmony_ci### on('macroStatusChanged')<sup>11+</sup>
3461e41f4b71Sopenharmony_ci
3462e41f4b71Sopenharmony_cion(type: 'macroStatusChanged', callback: AsyncCallback\<boolean\>): void
3463e41f4b71Sopenharmony_ci
3464e41f4b71Sopenharmony_ciSubscribes to macro state change events. This API uses an asynchronous callback to return the result.
3465e41f4b71Sopenharmony_ci
3466e41f4b71Sopenharmony_ci**System API**: This is a system API.
3467e41f4b71Sopenharmony_ci
3468e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3469e41f4b71Sopenharmony_ci
3470e41f4b71Sopenharmony_ci**Parameters**
3471e41f4b71Sopenharmony_ci
3472e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
3473e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
3474e41f4b71Sopenharmony_ci| type     | string      | Yes  | Event type. The value is fixed at **'macroStatusChanged'**. The event can be listened for when a session is created.|
3475e41f4b71Sopenharmony_ci| callback | AsyncCallback\<boolean\>     | Yes  | Callback used to return the macro state change. |
3476e41f4b71Sopenharmony_ci
3477e41f4b71Sopenharmony_ci**Error codes**
3478e41f4b71Sopenharmony_ci
3479e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3480e41f4b71Sopenharmony_ci
3481e41f4b71Sopenharmony_ci| ID| Error Message                     |
3482e41f4b71Sopenharmony_ci|-------|---------------------------|
3483e41f4b71Sopenharmony_ci| 202   | Not System Application.   |
3484e41f4b71Sopenharmony_ci
3485e41f4b71Sopenharmony_ci**Example**
3486e41f4b71Sopenharmony_ci
3487e41f4b71Sopenharmony_ci```ts
3488e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
3489e41f4b71Sopenharmony_ci
3490e41f4b71Sopenharmony_cifunction callback(err: BusinessError, macroStatus: boolean): void {
3491e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
3492e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
3493e41f4b71Sopenharmony_ci    return;
3494e41f4b71Sopenharmony_ci  }
3495e41f4b71Sopenharmony_ci  console.info(`Macro state: ${macroStatus}`);
3496e41f4b71Sopenharmony_ci}
3497e41f4b71Sopenharmony_ci
3498e41f4b71Sopenharmony_cifunction registerMacroStatusChanged(videoSession: camera.VideoSession): void {
3499e41f4b71Sopenharmony_ci  videoSession.on('macroStatusChanged', callback);
3500e41f4b71Sopenharmony_ci}
3501e41f4b71Sopenharmony_ci```
3502e41f4b71Sopenharmony_ci
3503e41f4b71Sopenharmony_ci### off('macroStatusChanged')<sup>11+</sup>
3504e41f4b71Sopenharmony_ci
3505e41f4b71Sopenharmony_cioff(type: 'macroStatusChanged', callback?: AsyncCallback\<boolean\>): void
3506e41f4b71Sopenharmony_ci
3507e41f4b71Sopenharmony_ciUnsubscribes from macro state change events.
3508e41f4b71Sopenharmony_ci
3509e41f4b71Sopenharmony_ci**System API**: This is a system API.
3510e41f4b71Sopenharmony_ci
3511e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3512e41f4b71Sopenharmony_ci
3513e41f4b71Sopenharmony_ci**Parameters**
3514e41f4b71Sopenharmony_ci
3515e41f4b71Sopenharmony_ci| Name   | Type                    | Mandatory| Description                      |
3516e41f4b71Sopenharmony_ci| -------- | ------------------------ | ---- | ------------------------ |
3517e41f4b71Sopenharmony_ci| type     | string                   | Yes  | Event type. The value is fixed at **'macroStatusChanged'**. The event can be listened for when a session is created.|
3518e41f4b71Sopenharmony_ci| callback | AsyncCallback\<boolean\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('macroStatusChanged')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)|
3519e41f4b71Sopenharmony_ci
3520e41f4b71Sopenharmony_ci**Error codes**
3521e41f4b71Sopenharmony_ci
3522e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3523e41f4b71Sopenharmony_ci
3524e41f4b71Sopenharmony_ci| ID| Error Message                     |
3525e41f4b71Sopenharmony_ci|-------|---------------------------|
3526e41f4b71Sopenharmony_ci| 202   | Not System Application.   |
3527e41f4b71Sopenharmony_ci
3528e41f4b71Sopenharmony_ci**Example**
3529e41f4b71Sopenharmony_ci
3530e41f4b71Sopenharmony_ci```ts
3531e41f4b71Sopenharmony_cifunction unregisterMacroStatusChanged(videoSession: camera.VideoSession): void {
3532e41f4b71Sopenharmony_ci  videoSession.off('macroStatusChanged');
3533e41f4b71Sopenharmony_ci}
3534e41f4b71Sopenharmony_ci```
3535e41f4b71Sopenharmony_ci
3536e41f4b71Sopenharmony_ci## PortraitPhotoSession<sup>11+</sup>
3537e41f4b71Sopenharmony_ci
3538e41f4b71Sopenharmony_ciPortraitPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty, ColorEffect, ColorManagement, Portrait, Aperture
3539e41f4b71Sopenharmony_ci
3540e41f4b71Sopenharmony_ciImplements a portrait photo session, which sets the parameters of the portrait photo mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
3541e41f4b71Sopenharmony_ci
3542e41f4b71Sopenharmony_ci### on('error')<sup>11+</sup>
3543e41f4b71Sopenharmony_ci
3544e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
3545e41f4b71Sopenharmony_ci
3546e41f4b71Sopenharmony_ciSubscribes to **PortraitSession** error events. This API uses an asynchronous callback to return the result.
3547e41f4b71Sopenharmony_ci
3548e41f4b71Sopenharmony_ci**System API**: This is a system API.
3549e41f4b71Sopenharmony_ci
3550e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3551e41f4b71Sopenharmony_ci
3552e41f4b71Sopenharmony_ci**Parameters**
3553e41f4b71Sopenharmony_ci
3554e41f4b71Sopenharmony_ci| Name    | Type       | Mandatory| Description                          |
3555e41f4b71Sopenharmony_ci| -------- | --------------------------------- | ---- | ------------------------------ |
3556e41f4b71Sopenharmony_ci| type     | string                               | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as [beginConfig](js-apis-camera.md#beginconfig11), [commitConfig](js-apis-camera.md#commitconfig11-1), and [addInput](js-apis-camera.md#addinput11).|
3557e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).       |
3558e41f4b71Sopenharmony_ci
3559e41f4b71Sopenharmony_ci**Example**
3560e41f4b71Sopenharmony_ci
3561e41f4b71Sopenharmony_ci```ts
3562e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
3563e41f4b71Sopenharmony_ci
3564e41f4b71Sopenharmony_cifunction callback(err: BusinessError): void {
3565e41f4b71Sopenharmony_ci  console.error(`Portrait photo session error code: ${err.code}`);
3566e41f4b71Sopenharmony_ci}
3567e41f4b71Sopenharmony_ci
3568e41f4b71Sopenharmony_cifunction registerSessionError(portraitPhotoSession: camera.PortraitPhotoSession): void {
3569e41f4b71Sopenharmony_ci  portraitPhotoSession.on('error', callback);
3570e41f4b71Sopenharmony_ci}
3571e41f4b71Sopenharmony_ci```
3572e41f4b71Sopenharmony_ci
3573e41f4b71Sopenharmony_ci### off('error')<sup>11+</sup>
3574e41f4b71Sopenharmony_ci
3575e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
3576e41f4b71Sopenharmony_ci
3577e41f4b71Sopenharmony_ciUnsubscribes from **PortraitSession** error events.
3578e41f4b71Sopenharmony_ci
3579e41f4b71Sopenharmony_ci**System API**: This is a system API.
3580e41f4b71Sopenharmony_ci
3581e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3582e41f4b71Sopenharmony_ci
3583e41f4b71Sopenharmony_ci**Parameters**
3584e41f4b71Sopenharmony_ci
3585e41f4b71Sopenharmony_ci| Name    | Type       | Mandatory| Description                          |
3586e41f4b71Sopenharmony_ci| -------- | -------------------------- | ---- | ------------------------------ |
3587e41f4b71Sopenharmony_ci| type     | string                     | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
3588e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('error')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)   |
3589e41f4b71Sopenharmony_ci
3590e41f4b71Sopenharmony_ci**Example**
3591e41f4b71Sopenharmony_ci
3592e41f4b71Sopenharmony_ci```ts
3593e41f4b71Sopenharmony_cifunction unregisterSessionError(portraitPhotoSession: camera.PortraitPhotoSession): void {
3594e41f4b71Sopenharmony_ci  portraitPhotoSession.off('error');
3595e41f4b71Sopenharmony_ci}
3596e41f4b71Sopenharmony_ci```
3597e41f4b71Sopenharmony_ci
3598e41f4b71Sopenharmony_ci### on('focusStateChange')<sup>11+</sup>
3599e41f4b71Sopenharmony_ci
3600e41f4b71Sopenharmony_cion(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
3601e41f4b71Sopenharmony_ci
3602e41f4b71Sopenharmony_ciSubscribes to focus state change events. This API uses an asynchronous callback to return the result.
3603e41f4b71Sopenharmony_ci
3604e41f4b71Sopenharmony_ci**System API**: This is a system API.
3605e41f4b71Sopenharmony_ci
3606e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3607e41f4b71Sopenharmony_ci
3608e41f4b71Sopenharmony_ci**Parameters**
3609e41f4b71Sopenharmony_ci
3610e41f4b71Sopenharmony_ci| Name    | Type                   | Mandatory| Description                      |
3611e41f4b71Sopenharmony_ci| -------- | ---------------- | ---- | ------------------------ |
3612e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.|
3613e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
3614e41f4b71Sopenharmony_ci
3615e41f4b71Sopenharmony_ci**Example**
3616e41f4b71Sopenharmony_ci
3617e41f4b71Sopenharmony_ci```ts
3618e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
3619e41f4b71Sopenharmony_ci
3620e41f4b71Sopenharmony_cifunction callback(err: BusinessError, focusState: camera.FocusState): void {
3621e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
3622e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
3623e41f4b71Sopenharmony_ci    return;
3624e41f4b71Sopenharmony_ci  }
3625e41f4b71Sopenharmony_ci  console.info(`Focus state: ${focusState}`);
3626e41f4b71Sopenharmony_ci}
3627e41f4b71Sopenharmony_ci
3628e41f4b71Sopenharmony_cifunction registerFocusStateChange(portraitPhotoSession: camera.PortraitPhotoSession): void {
3629e41f4b71Sopenharmony_ci  portraitPhotoSession.on('focusStateChange', callback);
3630e41f4b71Sopenharmony_ci}
3631e41f4b71Sopenharmony_ci```
3632e41f4b71Sopenharmony_ci
3633e41f4b71Sopenharmony_ci### off('focusStateChange')<sup>11+</sup>
3634e41f4b71Sopenharmony_ci
3635e41f4b71Sopenharmony_cioff(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
3636e41f4b71Sopenharmony_ci
3637e41f4b71Sopenharmony_ciUnsubscribes from focus state change events.
3638e41f4b71Sopenharmony_ci
3639e41f4b71Sopenharmony_ci**System API**: This is a system API.
3640e41f4b71Sopenharmony_ci
3641e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3642e41f4b71Sopenharmony_ci
3643e41f4b71Sopenharmony_ci**Parameters**
3644e41f4b71Sopenharmony_ci
3645e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
3646e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
3647e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
3648e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('focusStateChange')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
3649e41f4b71Sopenharmony_ci
3650e41f4b71Sopenharmony_ci**Example**
3651e41f4b71Sopenharmony_ci
3652e41f4b71Sopenharmony_ci```ts
3653e41f4b71Sopenharmony_cifunction unregisterFocusStateChange(portraitPhotoSession: camera.PortraitPhotoSession): void {
3654e41f4b71Sopenharmony_ci  portraitPhotoSession.off('focusStateChange');
3655e41f4b71Sopenharmony_ci}
3656e41f4b71Sopenharmony_ci```
3657e41f4b71Sopenharmony_ci
3658e41f4b71Sopenharmony_ci### on('smoothZoomInfoAvailable')<sup>11+</sup>
3659e41f4b71Sopenharmony_ci
3660e41f4b71Sopenharmony_cion(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
3661e41f4b71Sopenharmony_ci
3662e41f4b71Sopenharmony_ciSubscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
3663e41f4b71Sopenharmony_ci
3664e41f4b71Sopenharmony_ci**System API**: This is a system API.
3665e41f4b71Sopenharmony_ci
3666e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3667e41f4b71Sopenharmony_ci
3668e41f4b71Sopenharmony_ci**Parameters**
3669e41f4b71Sopenharmony_ci
3670e41f4b71Sopenharmony_ci| Name    | Type                  | Mandatory| Description                      |
3671e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------------ |
3672e41f4b71Sopenharmony_ci| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
3673e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
3674e41f4b71Sopenharmony_ci
3675e41f4b71Sopenharmony_ci**Example**
3676e41f4b71Sopenharmony_ci
3677e41f4b71Sopenharmony_ci```ts
3678e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
3679e41f4b71Sopenharmony_ci
3680e41f4b71Sopenharmony_cifunction callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
3681e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
3682e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
3683e41f4b71Sopenharmony_ci    return;
3684e41f4b71Sopenharmony_ci  }
3685e41f4b71Sopenharmony_ci  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
3686e41f4b71Sopenharmony_ci}
3687e41f4b71Sopenharmony_ci
3688e41f4b71Sopenharmony_cifunction registerSmoothZoomInfo(portraitPhotoSession: camera.PortraitPhotoSession): void {
3689e41f4b71Sopenharmony_ci  portraitPhotoSession.on('smoothZoomInfoAvailable', callback);
3690e41f4b71Sopenharmony_ci}
3691e41f4b71Sopenharmony_ci```
3692e41f4b71Sopenharmony_ci
3693e41f4b71Sopenharmony_ci### off('smoothZoomInfoAvailable')<sup>11+</sup>
3694e41f4b71Sopenharmony_ci
3695e41f4b71Sopenharmony_cioff(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
3696e41f4b71Sopenharmony_ci
3697e41f4b71Sopenharmony_ciUnsubscribes from smooth zoom state change events.
3698e41f4b71Sopenharmony_ci
3699e41f4b71Sopenharmony_ci**System API**: This is a system API.
3700e41f4b71Sopenharmony_ci
3701e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3702e41f4b71Sopenharmony_ci
3703e41f4b71Sopenharmony_ci**Parameters**
3704e41f4b71Sopenharmony_ci
3705e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
3706e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
3707e41f4b71Sopenharmony_ci| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
3708e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('smoothZoomInfoAvailable')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
3709e41f4b71Sopenharmony_ci
3710e41f4b71Sopenharmony_ci**Example**
3711e41f4b71Sopenharmony_ci
3712e41f4b71Sopenharmony_ci```ts
3713e41f4b71Sopenharmony_cifunction unregisterSmoothZoomInfo(portraitPhotoSession: camera.PortraitPhotoSession): void {
3714e41f4b71Sopenharmony_ci  portraitPhotoSession.off('smoothZoomInfoAvailable');
3715e41f4b71Sopenharmony_ci}
3716e41f4b71Sopenharmony_ci```
3717e41f4b71Sopenharmony_ci
3718e41f4b71Sopenharmony_ci## NightPhotoSession<sup>11+</sup>
3719e41f4b71Sopenharmony_ci
3720e41f4b71Sopenharmony_ciNightPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ColorManagement, ManualExposure
3721e41f4b71Sopenharmony_ci
3722e41f4b71Sopenharmony_ciImplements a night photo session, which sets the parameters of the night photo mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
3723e41f4b71Sopenharmony_ci
3724e41f4b71Sopenharmony_ci### on('error')<sup>11+</sup>
3725e41f4b71Sopenharmony_ci
3726e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
3727e41f4b71Sopenharmony_ci
3728e41f4b71Sopenharmony_ciSubscribes to **NightSession** error events. This API uses an asynchronous callback to return the result.
3729e41f4b71Sopenharmony_ci
3730e41f4b71Sopenharmony_ci**System API**: This is a system API.
3731e41f4b71Sopenharmony_ci
3732e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3733e41f4b71Sopenharmony_ci
3734e41f4b71Sopenharmony_ci**Parameters**
3735e41f4b71Sopenharmony_ci
3736e41f4b71Sopenharmony_ci| Name    | Type                                                         | Mandatory| Description                          |
3737e41f4b71Sopenharmony_ci| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
3738e41f4b71Sopenharmony_ci| type     | string                                                      | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as [beginConfig](js-apis-camera.md#beginconfig11), [commitConfig](js-apis-camera.md#commitconfig11-1), and [addInput](js-apis-camera.md#addinput11).|
3739e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).|
3740e41f4b71Sopenharmony_ci
3741e41f4b71Sopenharmony_ci**Example**
3742e41f4b71Sopenharmony_ci
3743e41f4b71Sopenharmony_ci```ts
3744e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
3745e41f4b71Sopenharmony_ci
3746e41f4b71Sopenharmony_cifunction callback(err: BusinessError): void {
3747e41f4b71Sopenharmony_ci  console.error(`Night photo session error code: ${err.code}`);
3748e41f4b71Sopenharmony_ci}
3749e41f4b71Sopenharmony_ci
3750e41f4b71Sopenharmony_cifunction registerSessionError(nightPhotoSession: camera.NightPhotoSession): void {
3751e41f4b71Sopenharmony_ci  nightPhotoSession.on('error', callback);
3752e41f4b71Sopenharmony_ci}
3753e41f4b71Sopenharmony_ci```
3754e41f4b71Sopenharmony_ci
3755e41f4b71Sopenharmony_ci### off('error')<sup>11+</sup>
3756e41f4b71Sopenharmony_ci
3757e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
3758e41f4b71Sopenharmony_ci
3759e41f4b71Sopenharmony_ciUnsubscribes from **NightSession** error events.
3760e41f4b71Sopenharmony_ci
3761e41f4b71Sopenharmony_ci**System API**: This is a system API.
3762e41f4b71Sopenharmony_ci
3763e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3764e41f4b71Sopenharmony_ci
3765e41f4b71Sopenharmony_ci**Parameters**
3766e41f4b71Sopenharmony_ci
3767e41f4b71Sopenharmony_ci| Name    | Type                       | Mandatory| Description                          |
3768e41f4b71Sopenharmony_ci| -------- | ------------------------ | ---- | ------------------------------ |
3769e41f4b71Sopenharmony_ci| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
3770e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('error')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)      |
3771e41f4b71Sopenharmony_ci
3772e41f4b71Sopenharmony_ci**Example**
3773e41f4b71Sopenharmony_ci
3774e41f4b71Sopenharmony_ci```ts
3775e41f4b71Sopenharmony_cifunction unregisterSessionError(nightPhotoSession: camera.NightPhotoSession): void {
3776e41f4b71Sopenharmony_ci  nightPhotoSession.off('error');
3777e41f4b71Sopenharmony_ci}
3778e41f4b71Sopenharmony_ci```
3779e41f4b71Sopenharmony_ci
3780e41f4b71Sopenharmony_ci### on('focusStateChange')<sup>11+</sup>
3781e41f4b71Sopenharmony_ci
3782e41f4b71Sopenharmony_cion(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
3783e41f4b71Sopenharmony_ci
3784e41f4b71Sopenharmony_ciSubscribes to focus state change events. This API uses an asynchronous callback to return the result.
3785e41f4b71Sopenharmony_ci
3786e41f4b71Sopenharmony_ci**System API**: This is a system API.
3787e41f4b71Sopenharmony_ci
3788e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3789e41f4b71Sopenharmony_ci
3790e41f4b71Sopenharmony_ci**Parameters**
3791e41f4b71Sopenharmony_ci
3792e41f4b71Sopenharmony_ci| Name    | Type                   | Mandatory| Description                      |
3793e41f4b71Sopenharmony_ci| -------- | ---------------- | ---- | ------------------------ |
3794e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.|
3795e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
3796e41f4b71Sopenharmony_ci
3797e41f4b71Sopenharmony_ci**Example**
3798e41f4b71Sopenharmony_ci
3799e41f4b71Sopenharmony_ci```ts
3800e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
3801e41f4b71Sopenharmony_ci
3802e41f4b71Sopenharmony_cifunction callback(err: BusinessError, focusState: camera.FocusState): void {
3803e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
3804e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
3805e41f4b71Sopenharmony_ci    return;
3806e41f4b71Sopenharmony_ci  }
3807e41f4b71Sopenharmony_ci  console.info(`Focus state: ${focusState}`);
3808e41f4b71Sopenharmony_ci}
3809e41f4b71Sopenharmony_ci
3810e41f4b71Sopenharmony_cifunction registerFocusStateChange(nightPhotoSession: camera.NightPhotoSession): void {
3811e41f4b71Sopenharmony_ci  nightPhotoSession.on('focusStateChange', callback);
3812e41f4b71Sopenharmony_ci}
3813e41f4b71Sopenharmony_ci```
3814e41f4b71Sopenharmony_ci
3815e41f4b71Sopenharmony_ci### off('focusStateChange')<sup>11+</sup>
3816e41f4b71Sopenharmony_ci
3817e41f4b71Sopenharmony_cioff(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
3818e41f4b71Sopenharmony_ci
3819e41f4b71Sopenharmony_ciUnsubscribes from focus state change events.
3820e41f4b71Sopenharmony_ci
3821e41f4b71Sopenharmony_ci**System API**: This is a system API.
3822e41f4b71Sopenharmony_ci
3823e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3824e41f4b71Sopenharmony_ci
3825e41f4b71Sopenharmony_ci**Parameters**
3826e41f4b71Sopenharmony_ci
3827e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
3828e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
3829e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
3830e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('focusStateChange')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
3831e41f4b71Sopenharmony_ci
3832e41f4b71Sopenharmony_ci**Example**
3833e41f4b71Sopenharmony_ci
3834e41f4b71Sopenharmony_ci```ts
3835e41f4b71Sopenharmony_cifunction unregisterFocusStateChange(nightPhotoSession: camera.NightPhotoSession): void {
3836e41f4b71Sopenharmony_ci  nightPhotoSession.off('focusStateChange');
3837e41f4b71Sopenharmony_ci}
3838e41f4b71Sopenharmony_ci```
3839e41f4b71Sopenharmony_ci
3840e41f4b71Sopenharmony_ci### on('smoothZoomInfoAvailable')<sup>11+</sup>
3841e41f4b71Sopenharmony_ci
3842e41f4b71Sopenharmony_cion(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
3843e41f4b71Sopenharmony_ci
3844e41f4b71Sopenharmony_ciSubscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
3845e41f4b71Sopenharmony_ci
3846e41f4b71Sopenharmony_ci**System API**: This is a system API.
3847e41f4b71Sopenharmony_ci
3848e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3849e41f4b71Sopenharmony_ci
3850e41f4b71Sopenharmony_ci**Parameters**
3851e41f4b71Sopenharmony_ci
3852e41f4b71Sopenharmony_ci| Name    | Type                  | Mandatory| Description                      |
3853e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------------ |
3854e41f4b71Sopenharmony_ci| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
3855e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
3856e41f4b71Sopenharmony_ci
3857e41f4b71Sopenharmony_ci**Example**
3858e41f4b71Sopenharmony_ci
3859e41f4b71Sopenharmony_ci```ts
3860e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
3861e41f4b71Sopenharmony_ci
3862e41f4b71Sopenharmony_cifunction callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
3863e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
3864e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
3865e41f4b71Sopenharmony_ci    return;
3866e41f4b71Sopenharmony_ci  }
3867e41f4b71Sopenharmony_ci  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
3868e41f4b71Sopenharmony_ci}
3869e41f4b71Sopenharmony_ci
3870e41f4b71Sopenharmony_cifunction registerSmoothZoomInfo(nightPhotoSession: camera.NightPhotoSession): void {
3871e41f4b71Sopenharmony_ci  nightPhotoSession.on('smoothZoomInfoAvailable', callback);
3872e41f4b71Sopenharmony_ci}
3873e41f4b71Sopenharmony_ci```
3874e41f4b71Sopenharmony_ci
3875e41f4b71Sopenharmony_ci### off('smoothZoomInfoAvailable')<sup>11+</sup>
3876e41f4b71Sopenharmony_ci
3877e41f4b71Sopenharmony_cioff(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
3878e41f4b71Sopenharmony_ci
3879e41f4b71Sopenharmony_ciUnsubscribes from smooth zoom state change events.
3880e41f4b71Sopenharmony_ci
3881e41f4b71Sopenharmony_ci**System API**: This is a system API.
3882e41f4b71Sopenharmony_ci
3883e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3884e41f4b71Sopenharmony_ci
3885e41f4b71Sopenharmony_ci**Parameters**
3886e41f4b71Sopenharmony_ci
3887e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
3888e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
3889e41f4b71Sopenharmony_ci| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
3890e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('smoothZoomInfoAvailable')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
3891e41f4b71Sopenharmony_ci
3892e41f4b71Sopenharmony_ci**Example**
3893e41f4b71Sopenharmony_ci
3894e41f4b71Sopenharmony_ci```ts
3895e41f4b71Sopenharmony_cifunction unregisterSmoothZoomInfo(nightPhotoSession: camera.NightPhotoSession): void {
3896e41f4b71Sopenharmony_ci  nightPhotoSession.off('smoothZoomInfoAvailable');
3897e41f4b71Sopenharmony_ci}
3898e41f4b71Sopenharmony_ci```
3899e41f4b71Sopenharmony_ci
3900e41f4b71Sopenharmony_ci### on('lcdFlashStatus')<sup>12+</sup>
3901e41f4b71Sopenharmony_ci
3902e41f4b71Sopenharmony_cion(type: 'lcdFlashStatus', callback: AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>): void
3903e41f4b71Sopenharmony_ci
3904e41f4b71Sopenharmony_ciSubscribes to LCD flash status change events. This API uses an asynchronous callback to return the result.
3905e41f4b71Sopenharmony_ci
3906e41f4b71Sopenharmony_ci**System API**: This is a system API.
3907e41f4b71Sopenharmony_ci
3908e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3909e41f4b71Sopenharmony_ci
3910e41f4b71Sopenharmony_ci**Parameters**
3911e41f4b71Sopenharmony_ci
3912e41f4b71Sopenharmony_ci| Name    | Type                  | Mandatory| Description                      |
3913e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------------ |
3914e41f4b71Sopenharmony_ci| type     | string                  | Yes  | Event type. The value is fixed at **'lcdFlashStatus'**. The event can be listened for when a session is created.|
3915e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\> | Yes  | Callback used to return the LCD flash status change. |
3916e41f4b71Sopenharmony_ci
3917e41f4b71Sopenharmony_ci**Error codes**
3918e41f4b71Sopenharmony_ci
3919e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3920e41f4b71Sopenharmony_ci
3921e41f4b71Sopenharmony_ci| ID| Error Message                     |
3922e41f4b71Sopenharmony_ci|-------|---------------------------|
3923e41f4b71Sopenharmony_ci| 202   | Not System Application.   |
3924e41f4b71Sopenharmony_ci
3925e41f4b71Sopenharmony_ci**Example**
3926e41f4b71Sopenharmony_ci
3927e41f4b71Sopenharmony_ci```ts
3928e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
3929e41f4b71Sopenharmony_ci
3930e41f4b71Sopenharmony_cifunction callback(err: BusinessError, lcdFlashStatus: camera.LcdFlashStatus): void {
3931e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
3932e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
3933e41f4b71Sopenharmony_ci    return;
3934e41f4b71Sopenharmony_ci  }
3935e41f4b71Sopenharmony_ci  console.info(`lcdFlashStatus: ${lcdFlashStatus}`);
3936e41f4b71Sopenharmony_ci}
3937e41f4b71Sopenharmony_ci
3938e41f4b71Sopenharmony_cifunction registerLcdFlashStatus(nightPhotoSession: camera.NightPhotoSession): void {
3939e41f4b71Sopenharmony_ci  nightPhotoSession.on('lcdFlashStatus', callback);
3940e41f4b71Sopenharmony_ci}
3941e41f4b71Sopenharmony_ci```
3942e41f4b71Sopenharmony_ci
3943e41f4b71Sopenharmony_ci### off('lcdFlashStatus')<sup>12+</sup>
3944e41f4b71Sopenharmony_ci
3945e41f4b71Sopenharmony_cioff(type: 'lcdFlashStatus', callback?: AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>): void
3946e41f4b71Sopenharmony_ci
3947e41f4b71Sopenharmony_ciUnsubscribes from LCD flash status change events.
3948e41f4b71Sopenharmony_ci
3949e41f4b71Sopenharmony_ci**System API**: This is a system API.
3950e41f4b71Sopenharmony_ci
3951e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3952e41f4b71Sopenharmony_ci
3953e41f4b71Sopenharmony_ci**Parameters**
3954e41f4b71Sopenharmony_ci
3955e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
3956e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
3957e41f4b71Sopenharmony_ci| type     | string              | Yes  | Event type. The value is fixed at **'lcdFlashStatus'**. The event can be listened for when a session is created.|
3958e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('lcdFlashStatus')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
3959e41f4b71Sopenharmony_ci
3960e41f4b71Sopenharmony_ci**Error codes**
3961e41f4b71Sopenharmony_ci
3962e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3963e41f4b71Sopenharmony_ci
3964e41f4b71Sopenharmony_ci| ID| Error Message                     |
3965e41f4b71Sopenharmony_ci|-------|---------------------------|
3966e41f4b71Sopenharmony_ci| 202   | Not System Application.   |
3967e41f4b71Sopenharmony_ci
3968e41f4b71Sopenharmony_ci**Example**
3969e41f4b71Sopenharmony_ci
3970e41f4b71Sopenharmony_ci```ts
3971e41f4b71Sopenharmony_cifunction unregisterLcdFlashStatus(nightPhotoSession: camera.NightPhotoSession): void {
3972e41f4b71Sopenharmony_ci  nightPhotoSession.off('lcdFlashStatus');
3973e41f4b71Sopenharmony_ci}
3974e41f4b71Sopenharmony_ci```
3975e41f4b71Sopenharmony_ci
3976e41f4b71Sopenharmony_ci## HighResolutionPhotoSession<sup>12+</sup>
3977e41f4b71Sopenharmony_ci
3978e41f4b71Sopenharmony_ciHighResolutionPhotoSession extends Session, AutoExposure, Focus
3979e41f4b71Sopenharmony_ci
3980e41f4b71Sopenharmony_ciImplements a high-resolution photo session, which sets the parameters of the high-resolution photo mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
3981e41f4b71Sopenharmony_ci
3982e41f4b71Sopenharmony_ci### on('error')<sup>12+</sup>
3983e41f4b71Sopenharmony_ci
3984e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
3985e41f4b71Sopenharmony_ci
3986e41f4b71Sopenharmony_ciSubscribes to **HighResolutionPhotoSession** error events. This API uses an asynchronous callback to return the result.
3987e41f4b71Sopenharmony_ci
3988e41f4b71Sopenharmony_ci**System API**: This is a system API.
3989e41f4b71Sopenharmony_ci
3990e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
3991e41f4b71Sopenharmony_ci
3992e41f4b71Sopenharmony_ci**Parameters**
3993e41f4b71Sopenharmony_ci
3994e41f4b71Sopenharmony_ci| Name    | Type       | Mandatory| Description                          |
3995e41f4b71Sopenharmony_ci| -------- | --------------------------------- | ---- | ------------------------------ |
3996e41f4b71Sopenharmony_ci| type     | string                               | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as [beginConfig](js-apis-camera.md#beginconfig11), [commitConfig](js-apis-camera.md#commitconfig11-1), and [addInput](js-apis-camera.md#addinput11).|
3997e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).       |
3998e41f4b71Sopenharmony_ci
3999e41f4b71Sopenharmony_ci**Error codes**
4000e41f4b71Sopenharmony_ci
4001e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4002e41f4b71Sopenharmony_ci
4003e41f4b71Sopenharmony_ci| ID        | Error Message       |
4004e41f4b71Sopenharmony_ci| --------------- | --------------- |
4005e41f4b71Sopenharmony_ci| 202                |   Not System Application.               |
4006e41f4b71Sopenharmony_ci
4007e41f4b71Sopenharmony_ci**Example**
4008e41f4b71Sopenharmony_ci
4009e41f4b71Sopenharmony_ci```ts
4010e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4011e41f4b71Sopenharmony_ci
4012e41f4b71Sopenharmony_cifunction callback(err: BusinessError): void {
4013e41f4b71Sopenharmony_ci  console.error(`High resolution photo session error code: ${err.code}`);
4014e41f4b71Sopenharmony_ci}
4015e41f4b71Sopenharmony_ci
4016e41f4b71Sopenharmony_cifunction registerSessionError(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4017e41f4b71Sopenharmony_ci  highResolutionPhotoSession.on('error', callback);
4018e41f4b71Sopenharmony_ci}
4019e41f4b71Sopenharmony_ci```
4020e41f4b71Sopenharmony_ci### off('error')<sup>12+</sup>
4021e41f4b71Sopenharmony_ci
4022e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
4023e41f4b71Sopenharmony_ci
4024e41f4b71Sopenharmony_ciUnsubscribes from **HighResolutionPhotoSession** error events.
4025e41f4b71Sopenharmony_ci
4026e41f4b71Sopenharmony_ci**System API**: This is a system API.
4027e41f4b71Sopenharmony_ci
4028e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4029e41f4b71Sopenharmony_ci
4030e41f4b71Sopenharmony_ci**Parameters**
4031e41f4b71Sopenharmony_ci
4032e41f4b71Sopenharmony_ci| Name    | Type                       | Mandatory| Description                          |
4033e41f4b71Sopenharmony_ci| -------- | ------------------------ | ---- | ------------------------------ |
4034e41f4b71Sopenharmony_ci| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
4035e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('error')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)      |
4036e41f4b71Sopenharmony_ci
4037e41f4b71Sopenharmony_ci**Error codes**
4038e41f4b71Sopenharmony_ci
4039e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4040e41f4b71Sopenharmony_ci
4041e41f4b71Sopenharmony_ci| ID        | Error Message       |
4042e41f4b71Sopenharmony_ci| --------------- | --------------- |
4043e41f4b71Sopenharmony_ci| 202                |   Not System Application.               |
4044e41f4b71Sopenharmony_ci
4045e41f4b71Sopenharmony_ci**Example**
4046e41f4b71Sopenharmony_ci
4047e41f4b71Sopenharmony_ci```ts
4048e41f4b71Sopenharmony_cifunction unregisterSessionError(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4049e41f4b71Sopenharmony_ci  highResolutionPhotoSession.off('error');
4050e41f4b71Sopenharmony_ci}
4051e41f4b71Sopenharmony_ci```
4052e41f4b71Sopenharmony_ci
4053e41f4b71Sopenharmony_ci### on('focusStateChange')<sup>12+</sup>
4054e41f4b71Sopenharmony_ci
4055e41f4b71Sopenharmony_cion(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4056e41f4b71Sopenharmony_ci
4057e41f4b71Sopenharmony_ciSubscribes to focus state change events. This API uses an asynchronous callback to return the result.
4058e41f4b71Sopenharmony_ci
4059e41f4b71Sopenharmony_ci**System API**: This is a system API.
4060e41f4b71Sopenharmony_ci
4061e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4062e41f4b71Sopenharmony_ci
4063e41f4b71Sopenharmony_ci**Parameters**
4064e41f4b71Sopenharmony_ci
4065e41f4b71Sopenharmony_ci| Name    | Type                   | Mandatory| Description                      |
4066e41f4b71Sopenharmony_ci| -------- | ---------------- | ---- | ------------------------ |
4067e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.|
4068e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
4069e41f4b71Sopenharmony_ci
4070e41f4b71Sopenharmony_ci**Error codes**
4071e41f4b71Sopenharmony_ci
4072e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4073e41f4b71Sopenharmony_ci
4074e41f4b71Sopenharmony_ci| ID        | Error Message       |
4075e41f4b71Sopenharmony_ci| --------------- | --------------- |
4076e41f4b71Sopenharmony_ci| 202                |   Not System Application.               |
4077e41f4b71Sopenharmony_ci
4078e41f4b71Sopenharmony_ci**Example**
4079e41f4b71Sopenharmony_ci
4080e41f4b71Sopenharmony_ci```ts
4081e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4082e41f4b71Sopenharmony_ci
4083e41f4b71Sopenharmony_cifunction callback(err: BusinessError, focusState: camera.FocusState): void {
4084e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
4085e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
4086e41f4b71Sopenharmony_ci    return;
4087e41f4b71Sopenharmony_ci  }
4088e41f4b71Sopenharmony_ci  console.info(`Focus state: ${focusState}`);
4089e41f4b71Sopenharmony_ci}
4090e41f4b71Sopenharmony_ci
4091e41f4b71Sopenharmony_cifunction registerFocusStateChange(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4092e41f4b71Sopenharmony_ci  highResolutionPhotoSession.on('focusStateChange', callback);
4093e41f4b71Sopenharmony_ci}
4094e41f4b71Sopenharmony_ci```
4095e41f4b71Sopenharmony_ci
4096e41f4b71Sopenharmony_ci### off('focusStateChange')<sup>12+</sup>
4097e41f4b71Sopenharmony_ci
4098e41f4b71Sopenharmony_cioff(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4099e41f4b71Sopenharmony_ci
4100e41f4b71Sopenharmony_ciUnsubscribes from focus state change events.
4101e41f4b71Sopenharmony_ci
4102e41f4b71Sopenharmony_ci**System API**: This is a system API.
4103e41f4b71Sopenharmony_ci
4104e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4105e41f4b71Sopenharmony_ci
4106e41f4b71Sopenharmony_ci**Error codes**
4107e41f4b71Sopenharmony_ci
4108e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4109e41f4b71Sopenharmony_ci
4110e41f4b71Sopenharmony_ci| ID        | Error Message       |
4111e41f4b71Sopenharmony_ci| --------------- | --------------- |
4112e41f4b71Sopenharmony_ci| 202                |   Not System Application.               |
4113e41f4b71Sopenharmony_ci
4114e41f4b71Sopenharmony_ci**Parameters**
4115e41f4b71Sopenharmony_ci
4116e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
4117e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
4118e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
4119e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('focusStateChange')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
4120e41f4b71Sopenharmony_ci
4121e41f4b71Sopenharmony_ci**Example**
4122e41f4b71Sopenharmony_ci
4123e41f4b71Sopenharmony_ci```ts
4124e41f4b71Sopenharmony_cifunction unregisterFocusStateChange(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4125e41f4b71Sopenharmony_ci  highResolutionPhotoSession.off('focusStateChange');
4126e41f4b71Sopenharmony_ci}
4127e41f4b71Sopenharmony_ci```
4128e41f4b71Sopenharmony_ci
4129e41f4b71Sopenharmony_ci## SketchStatusData<sup>11+</sup>
4130e41f4b71Sopenharmony_ci
4131e41f4b71Sopenharmony_ciDefines the PiP status data.
4132e41f4b71Sopenharmony_ci
4133e41f4b71Sopenharmony_ci**System API**: This is a system API.
4134e41f4b71Sopenharmony_ci
4135e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4136e41f4b71Sopenharmony_ci
4137e41f4b71Sopenharmony_ci| Name         | Type     | Read-only| Mandatory| Description       |
4138e41f4b71Sopenharmony_ci| ------------- | -------- | ---- | ---- | ---------- |
4139e41f4b71Sopenharmony_ci| status        | number   | No  | Yes  | Status of PiP. The options are 0 (stopped), 1 (started), 2 (stopping), and 3 (starting).|
4140e41f4b71Sopenharmony_ci| sketchRatio   | number   | No  | Yes  | Zoom ratio of PiP.|
4141e41f4b71Sopenharmony_ci
4142e41f4b71Sopenharmony_ci## SlowMotionVideoSession<sup>12+</sup>
4143e41f4b71Sopenharmony_ci
4144e41f4b71Sopenharmony_ciSlowMotionVideoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect
4145e41f4b71Sopenharmony_ci
4146e41f4b71Sopenharmony_ciImplements a slow-motion video session, which sets the parameters of the slow-motion video mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
4147e41f4b71Sopenharmony_ci
4148e41f4b71Sopenharmony_ci> **NOTE**
4149e41f4b71Sopenharmony_ci>
4150e41f4b71Sopenharmony_ci> In slow-motion video mode, only preview streams and video streams can be added.
4151e41f4b71Sopenharmony_ci### on('error')<sup>12+</sup>
4152e41f4b71Sopenharmony_ci
4153e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
4154e41f4b71Sopenharmony_ci
4155e41f4b71Sopenharmony_ciSubscribes to **SlowMotionVideoSession** error events. This API uses an asynchronous callback to return the result.
4156e41f4b71Sopenharmony_ci
4157e41f4b71Sopenharmony_ci**System API**: This is a system API.
4158e41f4b71Sopenharmony_ci
4159e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4160e41f4b71Sopenharmony_ci
4161e41f4b71Sopenharmony_ci**Parameters**
4162e41f4b71Sopenharmony_ci
4163e41f4b71Sopenharmony_ci| Name    | Type       | Mandatory| Description                          |
4164e41f4b71Sopenharmony_ci| -------- | --------------------------------- | ---- | ------------------------------ |
4165e41f4b71Sopenharmony_ci| type     | string                               | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as [beginConfig](js-apis-camera.md#beginconfig11), [commitConfig](js-apis-camera.md#commitconfig11-1), and [addInput](js-apis-camera.md#addinput11).|
4166e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).       |
4167e41f4b71Sopenharmony_ci
4168e41f4b71Sopenharmony_ci**Error codes**
4169e41f4b71Sopenharmony_ci
4170e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4171e41f4b71Sopenharmony_ci
4172e41f4b71Sopenharmony_ci| ID  | Error Message       |
4173e41f4b71Sopenharmony_ci|---------| --------------- |
4174e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
4175e41f4b71Sopenharmony_ci
4176e41f4b71Sopenharmony_ci**Example**
4177e41f4b71Sopenharmony_ci
4178e41f4b71Sopenharmony_ci```ts
4179e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4180e41f4b71Sopenharmony_ci
4181e41f4b71Sopenharmony_cifunction callback(err: BusinessError): void {
4182e41f4b71Sopenharmony_ci  console.error(`Portrait photo session error code: ${err.code}`);
4183e41f4b71Sopenharmony_ci}
4184e41f4b71Sopenharmony_ci
4185e41f4b71Sopenharmony_cifunction registerSessionError(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4186e41f4b71Sopenharmony_ci  slowMotionVideoSession.on('error', callback);
4187e41f4b71Sopenharmony_ci}
4188e41f4b71Sopenharmony_ci```
4189e41f4b71Sopenharmony_ci
4190e41f4b71Sopenharmony_ci### off('error')<sup>12+</sup>
4191e41f4b71Sopenharmony_ci
4192e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
4193e41f4b71Sopenharmony_ci
4194e41f4b71Sopenharmony_ciUnsubscribes from **SlowMotionVideoSession** error events.
4195e41f4b71Sopenharmony_ci
4196e41f4b71Sopenharmony_ci**System API**: This is a system API.
4197e41f4b71Sopenharmony_ci
4198e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4199e41f4b71Sopenharmony_ci
4200e41f4b71Sopenharmony_ci**Parameters**
4201e41f4b71Sopenharmony_ci
4202e41f4b71Sopenharmony_ci| Name    | Type       | Mandatory| Description                          |
4203e41f4b71Sopenharmony_ci| -------- | -------------------------- | ---- | ------------------------------ |
4204e41f4b71Sopenharmony_ci| type     | string                     | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
4205e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('error')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)   |
4206e41f4b71Sopenharmony_ci
4207e41f4b71Sopenharmony_ci**Error codes**
4208e41f4b71Sopenharmony_ci
4209e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4210e41f4b71Sopenharmony_ci
4211e41f4b71Sopenharmony_ci| ID  | Error Message       |
4212e41f4b71Sopenharmony_ci|---------| --------------- |
4213e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
4214e41f4b71Sopenharmony_ci
4215e41f4b71Sopenharmony_ci**Example**
4216e41f4b71Sopenharmony_ci
4217e41f4b71Sopenharmony_ci```ts
4218e41f4b71Sopenharmony_cifunction unregisterSessionError(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4219e41f4b71Sopenharmony_ci  slowMotionVideoSession.off('error');
4220e41f4b71Sopenharmony_ci}
4221e41f4b71Sopenharmony_ci```
4222e41f4b71Sopenharmony_ci
4223e41f4b71Sopenharmony_ci### on('focusStateChange')<sup>12+</sup>
4224e41f4b71Sopenharmony_ci
4225e41f4b71Sopenharmony_cion(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4226e41f4b71Sopenharmony_ci
4227e41f4b71Sopenharmony_ciSubscribes to focus state change events. This API uses an asynchronous callback to return the result.
4228e41f4b71Sopenharmony_ci
4229e41f4b71Sopenharmony_ci**System API**: This is a system API.
4230e41f4b71Sopenharmony_ci
4231e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4232e41f4b71Sopenharmony_ci
4233e41f4b71Sopenharmony_ci**Parameters**
4234e41f4b71Sopenharmony_ci
4235e41f4b71Sopenharmony_ci| Name    | Type                   | Mandatory| Description                      |
4236e41f4b71Sopenharmony_ci| -------- | ---------------- | ---- | ------------------------ |
4237e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.|
4238e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
4239e41f4b71Sopenharmony_ci
4240e41f4b71Sopenharmony_ci**Error codes**
4241e41f4b71Sopenharmony_ci
4242e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4243e41f4b71Sopenharmony_ci
4244e41f4b71Sopenharmony_ci| ID  | Error Message       |
4245e41f4b71Sopenharmony_ci|---------| --------------- |
4246e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
4247e41f4b71Sopenharmony_ci
4248e41f4b71Sopenharmony_ci**Example**
4249e41f4b71Sopenharmony_ci
4250e41f4b71Sopenharmony_ci```ts
4251e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4252e41f4b71Sopenharmony_ci
4253e41f4b71Sopenharmony_cifunction callback(err: BusinessError, focusState: camera.FocusState): void {
4254e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
4255e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
4256e41f4b71Sopenharmony_ci    return;
4257e41f4b71Sopenharmony_ci  }
4258e41f4b71Sopenharmony_ci  console.info(`Focus state: ${focusState}`);
4259e41f4b71Sopenharmony_ci}
4260e41f4b71Sopenharmony_ci
4261e41f4b71Sopenharmony_cifunction registerFocusStateChange(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4262e41f4b71Sopenharmony_ci  slowMotionVideoSession.on('focusStateChange', callback);
4263e41f4b71Sopenharmony_ci}
4264e41f4b71Sopenharmony_ci```
4265e41f4b71Sopenharmony_ci
4266e41f4b71Sopenharmony_ci### off('focusStateChange')<sup>12+</sup>
4267e41f4b71Sopenharmony_ci
4268e41f4b71Sopenharmony_cioff(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4269e41f4b71Sopenharmony_ci
4270e41f4b71Sopenharmony_ciUnsubscribes from focus state change events.
4271e41f4b71Sopenharmony_ci
4272e41f4b71Sopenharmony_ci**System API**: This is a system API.
4273e41f4b71Sopenharmony_ci
4274e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4275e41f4b71Sopenharmony_ci
4276e41f4b71Sopenharmony_ci**Parameters**
4277e41f4b71Sopenharmony_ci
4278e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
4279e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
4280e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
4281e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('focusStateChange')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
4282e41f4b71Sopenharmony_ci
4283e41f4b71Sopenharmony_ci**Error codes**
4284e41f4b71Sopenharmony_ci
4285e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4286e41f4b71Sopenharmony_ci
4287e41f4b71Sopenharmony_ci| ID  | Error Message       |
4288e41f4b71Sopenharmony_ci|---------| --------------- |
4289e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
4290e41f4b71Sopenharmony_ci
4291e41f4b71Sopenharmony_ci**Example**
4292e41f4b71Sopenharmony_ci
4293e41f4b71Sopenharmony_ci```ts
4294e41f4b71Sopenharmony_cifunction unregisterFocusStateChange(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4295e41f4b71Sopenharmony_ci  slowMotionVideoSession.off('focusStateChange');
4296e41f4b71Sopenharmony_ci}
4297e41f4b71Sopenharmony_ci```
4298e41f4b71Sopenharmony_ci
4299e41f4b71Sopenharmony_ci### on('smoothZoomInfoAvailable')<sup>12+</sup>
4300e41f4b71Sopenharmony_ci
4301e41f4b71Sopenharmony_cion(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
4302e41f4b71Sopenharmony_ci
4303e41f4b71Sopenharmony_ciSubscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
4304e41f4b71Sopenharmony_ci
4305e41f4b71Sopenharmony_ci**System API**: This is a system API.
4306e41f4b71Sopenharmony_ci
4307e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4308e41f4b71Sopenharmony_ci
4309e41f4b71Sopenharmony_ci**Parameters**
4310e41f4b71Sopenharmony_ci
4311e41f4b71Sopenharmony_ci| Name    | Type                  | Mandatory| Description                      |
4312e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------------ |
4313e41f4b71Sopenharmony_ci| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
4314e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
4315e41f4b71Sopenharmony_ci
4316e41f4b71Sopenharmony_ci**Error codes**
4317e41f4b71Sopenharmony_ci
4318e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4319e41f4b71Sopenharmony_ci
4320e41f4b71Sopenharmony_ci| ID  | Error Message       |
4321e41f4b71Sopenharmony_ci|---------| --------------- |
4322e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
4323e41f4b71Sopenharmony_ci
4324e41f4b71Sopenharmony_ci**Example**
4325e41f4b71Sopenharmony_ci
4326e41f4b71Sopenharmony_ci```ts
4327e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4328e41f4b71Sopenharmony_ci
4329e41f4b71Sopenharmony_cifunction callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
4330e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
4331e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
4332e41f4b71Sopenharmony_ci    return;
4333e41f4b71Sopenharmony_ci  }
4334e41f4b71Sopenharmony_ci  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
4335e41f4b71Sopenharmony_ci}
4336e41f4b71Sopenharmony_ci
4337e41f4b71Sopenharmony_cifunction registerSmoothZoomInfo(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4338e41f4b71Sopenharmony_ci  slowMotionVideoSession.on('smoothZoomInfoAvailable', callback);
4339e41f4b71Sopenharmony_ci}
4340e41f4b71Sopenharmony_ci```
4341e41f4b71Sopenharmony_ci
4342e41f4b71Sopenharmony_ci### off('smoothZoomInfoAvailable')<sup>12+</sup>
4343e41f4b71Sopenharmony_ci
4344e41f4b71Sopenharmony_cioff(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
4345e41f4b71Sopenharmony_ci
4346e41f4b71Sopenharmony_ciUnsubscribes from smooth zoom state change events.
4347e41f4b71Sopenharmony_ci
4348e41f4b71Sopenharmony_ci**System API**: This is a system API.
4349e41f4b71Sopenharmony_ci
4350e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4351e41f4b71Sopenharmony_ci
4352e41f4b71Sopenharmony_ci**Parameters**
4353e41f4b71Sopenharmony_ci
4354e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
4355e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
4356e41f4b71Sopenharmony_ci| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
4357e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('smoothZoomInfoAvailable')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
4358e41f4b71Sopenharmony_ci
4359e41f4b71Sopenharmony_ci**Error codes**
4360e41f4b71Sopenharmony_ci
4361e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4362e41f4b71Sopenharmony_ci
4363e41f4b71Sopenharmony_ci| ID  | Error Message       |
4364e41f4b71Sopenharmony_ci|---------| --------------- |
4365e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
4366e41f4b71Sopenharmony_ci
4367e41f4b71Sopenharmony_ci**Example**
4368e41f4b71Sopenharmony_ci
4369e41f4b71Sopenharmony_ci```ts
4370e41f4b71Sopenharmony_cifunction unregisterSmoothZoomInfo(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4371e41f4b71Sopenharmony_ci  slowMotionVideoSession.off('smoothZoomInfoAvailable');
4372e41f4b71Sopenharmony_ci}
4373e41f4b71Sopenharmony_ci```
4374e41f4b71Sopenharmony_ci
4375e41f4b71Sopenharmony_ci### on('slowMotionStatus')<sup>12+</sup>
4376e41f4b71Sopenharmony_ci
4377e41f4b71Sopenharmony_cion(type: 'slowMotionStatus', callback: AsyncCallback\<SlowMotionStatus\>): void
4378e41f4b71Sopenharmony_ci
4379e41f4b71Sopenharmony_ciSubscribes to slow-motion status change events. This API uses an asynchronous callback to return the result.
4380e41f4b71Sopenharmony_ci
4381e41f4b71Sopenharmony_ci**System API**: This is a system API.
4382e41f4b71Sopenharmony_ci
4383e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4384e41f4b71Sopenharmony_ci
4385e41f4b71Sopenharmony_ci**Parameters**
4386e41f4b71Sopenharmony_ci
4387e41f4b71Sopenharmony_ci| Name    | Type                                                                       | Mandatory| Description                                        |
4388e41f4b71Sopenharmony_ci| -------- |---------------------------------------------------------------------------| ---- |--------------------------------------------|
4389e41f4b71Sopenharmony_ci| type     | string                                                                    | Yes  | Event type. The value is fixed at **'slowMotionStatus'**. The event can be listened for when a session is created.|
4390e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SlowMotionStatus](#slowmotionstatus12)\> | Yes  | Callback used to return the slow-motion status change.    |
4391e41f4b71Sopenharmony_ci
4392e41f4b71Sopenharmony_ci**Error codes**
4393e41f4b71Sopenharmony_ci
4394e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4395e41f4b71Sopenharmony_ci
4396e41f4b71Sopenharmony_ci| ID  | Error Message       |
4397e41f4b71Sopenharmony_ci|---------| --------------- |
4398e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
4399e41f4b71Sopenharmony_ci
4400e41f4b71Sopenharmony_ci**Example**
4401e41f4b71Sopenharmony_ci
4402e41f4b71Sopenharmony_ci```ts
4403e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4404e41f4b71Sopenharmony_ci
4405e41f4b71Sopenharmony_cifunction callback(err: BusinessError, slowMotionStatus: camera.SlowMotionStatus): void {
4406e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
4407e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
4408e41f4b71Sopenharmony_ci    return;
4409e41f4b71Sopenharmony_ci  }
4410e41f4b71Sopenharmony_ci  console.info(`The slow motion status: ${slowMotionStatus}`);
4411e41f4b71Sopenharmony_ci}
4412e41f4b71Sopenharmony_ci
4413e41f4b71Sopenharmony_cifunction registerSlowMotionStatus(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4414e41f4b71Sopenharmony_ci  slowMotionVideoSession.on('slowMotionStatus', callback);
4415e41f4b71Sopenharmony_ci}
4416e41f4b71Sopenharmony_ci```
4417e41f4b71Sopenharmony_ci
4418e41f4b71Sopenharmony_ci### off('slowMotionStatus')<sup>12+</sup>
4419e41f4b71Sopenharmony_ci
4420e41f4b71Sopenharmony_cioff(type: 'slowMotionStatus', callback?: AsyncCallback\<SlowMotionStatus\>): void
4421e41f4b71Sopenharmony_ci
4422e41f4b71Sopenharmony_ciUnsubscribes from slow-motion status change events.
4423e41f4b71Sopenharmony_ci
4424e41f4b71Sopenharmony_ci**System API**: This is a system API.
4425e41f4b71Sopenharmony_ci
4426e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4427e41f4b71Sopenharmony_ci
4428e41f4b71Sopenharmony_ci**Parameters**
4429e41f4b71Sopenharmony_ci
4430e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
4431e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
4432e41f4b71Sopenharmony_ci| type     | string              | Yes  | Event type. The value is fixed at **'slowMotionStatus'**. The event can be listened for when a session is created.|
4433e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SlowMotionStatus](#slowmotionstatus12)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('slowMotionStatus')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned. |
4434e41f4b71Sopenharmony_ci
4435e41f4b71Sopenharmony_ci**Error codes**
4436e41f4b71Sopenharmony_ci
4437e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4438e41f4b71Sopenharmony_ci
4439e41f4b71Sopenharmony_ci| ID  | Error Message       |
4440e41f4b71Sopenharmony_ci|---------| --------------- |
4441e41f4b71Sopenharmony_ci| 202     |  Not System Application.                               |
4442e41f4b71Sopenharmony_ci
4443e41f4b71Sopenharmony_ci**Example**
4444e41f4b71Sopenharmony_ci
4445e41f4b71Sopenharmony_ci```ts
4446e41f4b71Sopenharmony_cifunction unregisterSlowMotionStatus(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4447e41f4b71Sopenharmony_ci  slowMotionVideoSession.off('slowMotionStatus');
4448e41f4b71Sopenharmony_ci}
4449e41f4b71Sopenharmony_ci```
4450e41f4b71Sopenharmony_ci### isSlowMotionDetectionSupported<sup>12+</sup>
4451e41f4b71Sopenharmony_ci
4452e41f4b71Sopenharmony_ciisSlowMotionDetectionSupported(): boolean
4453e41f4b71Sopenharmony_ci
4454e41f4b71Sopenharmony_ciChecks whether the device supports slow-motion detection.
4455e41f4b71Sopenharmony_ci
4456e41f4b71Sopenharmony_ci> **NOTE**
4457e41f4b71Sopenharmony_ci>
4458e41f4b71Sopenharmony_ci> This API must be called after [commitConfig](js-apis-camera.md#commitconfig11-1) is called.
4459e41f4b71Sopenharmony_ci
4460e41f4b71Sopenharmony_ci**System API**: This is a system API.
4461e41f4b71Sopenharmony_ci
4462e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4463e41f4b71Sopenharmony_ci
4464e41f4b71Sopenharmony_ci**Return value**
4465e41f4b71Sopenharmony_ci
4466e41f4b71Sopenharmony_ci| Type       | Description                                                                                    |
4467e41f4b71Sopenharmony_ci| ---------- |----------------------------------------------------------------------------------------|
4468e41f4b71Sopenharmony_ci| boolean    | **true**: The device supports slow-motion detection.<br>**false**: The device does not support slow-motion detection.<br>If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
4469e41f4b71Sopenharmony_ci
4470e41f4b71Sopenharmony_ci**Error codes**
4471e41f4b71Sopenharmony_ci
4472e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4473e41f4b71Sopenharmony_ci
4474e41f4b71Sopenharmony_ci| ID  | Error Message       |
4475e41f4b71Sopenharmony_ci|---------| --------------- |
4476e41f4b71Sopenharmony_ci| 202     |  Not System Application.                               |
4477e41f4b71Sopenharmony_ci| 7400103 |  Session not config.                                   |
4478e41f4b71Sopenharmony_ci
4479e41f4b71Sopenharmony_ci**Example**
4480e41f4b71Sopenharmony_ci
4481e41f4b71Sopenharmony_ci```ts
4482e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4483e41f4b71Sopenharmony_ci
4484e41f4b71Sopenharmony_cifunction isSlowMotionDetectionSupported(slowMotionVideoSession: camera.SlowMotionVideoSession): boolean {
4485e41f4b71Sopenharmony_ci  let isSupported: boolean = false;
4486e41f4b71Sopenharmony_ci  try {
4487e41f4b71Sopenharmony_ci    isSupported = slowMotionVideoSession.isSlowMotionDetectionSupported();
4488e41f4b71Sopenharmony_ci  } catch (error) {
4489e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
4490e41f4b71Sopenharmony_ci    let err = error as BusinessError;
4491e41f4b71Sopenharmony_ci    console.error(`The isFocusModeSupported call failed. error code: ${err.code}`);
4492e41f4b71Sopenharmony_ci  }
4493e41f4b71Sopenharmony_ci  return isSupported;
4494e41f4b71Sopenharmony_ci}
4495e41f4b71Sopenharmony_ci```
4496e41f4b71Sopenharmony_ci
4497e41f4b71Sopenharmony_ci### setSlowMotionDetectionArea<sup>12+</sup>
4498e41f4b71Sopenharmony_ci
4499e41f4b71Sopenharmony_cisetSlowMotionDetectionArea(area: Rect): void
4500e41f4b71Sopenharmony_ci
4501e41f4b71Sopenharmony_ciSets an area for slow-motion detection.
4502e41f4b71Sopenharmony_ci
4503e41f4b71Sopenharmony_ci> **NOTE**
4504e41f4b71Sopenharmony_ci>
4505e41f4b71Sopenharmony_ci> Before the setting, call [isSlowMotionDetectionSupported](#isslowmotiondetectionsupported12) to check whether the device supports slow-motion detection.
4506e41f4b71Sopenharmony_ciThis API must be called after [commitConfig](js-apis-camera.md#commitconfig11-1) is called.
4507e41f4b71Sopenharmony_ci
4508e41f4b71Sopenharmony_ci**System API**: This is a system API.
4509e41f4b71Sopenharmony_ci
4510e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4511e41f4b71Sopenharmony_ci
4512e41f4b71Sopenharmony_ci**Parameters**
4513e41f4b71Sopenharmony_ci
4514e41f4b71Sopenharmony_ci| Name    | Type                                           | Mandatory| Description                         |
4515e41f4b71Sopenharmony_ci| -------- | ---------------------------------------------- | ---- | --------------------------- |
4516e41f4b71Sopenharmony_ci| area  | [Rect](js-apis-camera.md#rect)      | Yes  | Area.                  |
4517e41f4b71Sopenharmony_ci
4518e41f4b71Sopenharmony_ci**Error codes**
4519e41f4b71Sopenharmony_ci
4520e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4521e41f4b71Sopenharmony_ci
4522e41f4b71Sopenharmony_ci| ID  | Error Message       |
4523e41f4b71Sopenharmony_ci|---------| --------------- |
4524e41f4b71Sopenharmony_ci| 202     |  Not System Application.                            |
4525e41f4b71Sopenharmony_ci| 7400101 |  Parameter missing or parameter type incorrect.     |
4526e41f4b71Sopenharmony_ci| 7400103 |  Session not config.                                |
4527e41f4b71Sopenharmony_ci
4528e41f4b71Sopenharmony_ci**Example**
4529e41f4b71Sopenharmony_ci
4530e41f4b71Sopenharmony_ci```ts
4531e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4532e41f4b71Sopenharmony_ci
4533e41f4b71Sopenharmony_cifunction setSlowMotionDetectionArea(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4534e41f4b71Sopenharmony_ci  try {
4535e41f4b71Sopenharmony_ci    slowMotionVideoSession.setSlowMotionDetectionArea({topLeftX: 0.1, topLeftY: 0.1, width: 0.8, height: 0.8});
4536e41f4b71Sopenharmony_ci  } catch (error) {
4537e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
4538e41f4b71Sopenharmony_ci    let err = error as BusinessError;
4539e41f4b71Sopenharmony_ci    console.error(`The setSlowMotionDetectionArea call failed. error code: ${err.code}`);
4540e41f4b71Sopenharmony_ci  }
4541e41f4b71Sopenharmony_ci}
4542e41f4b71Sopenharmony_ci```
4543e41f4b71Sopenharmony_ci
4544e41f4b71Sopenharmony_ci## PanoramaPhotoSession<sup>12+</sup>
4545e41f4b71Sopenharmony_ci
4546e41f4b71Sopenharmony_ciPanoramaPhotoSession extends Session, Focus, AutoExposure, WhiteBalance, ColorEffect
4547e41f4b71Sopenharmony_ci
4548e41f4b71Sopenharmony_ciImplements a panoramic photo session, which sets the parameters of the panoramic photo mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
4549e41f4b71Sopenharmony_ci
4550e41f4b71Sopenharmony_ci### on('error')<sup>12+</sup>
4551e41f4b71Sopenharmony_ci
4552e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
4553e41f4b71Sopenharmony_ci
4554e41f4b71Sopenharmony_ciSubscribes to **PanoramaPhotoSession** error events. This API uses an asynchronous callback to return the result.
4555e41f4b71Sopenharmony_ci
4556e41f4b71Sopenharmony_ci**System API**: This is a system API.
4557e41f4b71Sopenharmony_ci
4558e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4559e41f4b71Sopenharmony_ci
4560e41f4b71Sopenharmony_ci**Parameters**
4561e41f4b71Sopenharmony_ci
4562e41f4b71Sopenharmony_ci| Name    | Type                                                         | Mandatory| Description                          |
4563e41f4b71Sopenharmony_ci| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
4564e41f4b71Sopenharmony_ci| type     | string                                                      | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as [beginConfig](js-apis-camera.md#beginconfig11), [commitConfig](js-apis-camera.md#commitconfig11-1), and [addInput](js-apis-camera.md#addinput11).|
4565e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).|
4566e41f4b71Sopenharmony_ci
4567e41f4b71Sopenharmony_ci**Example**
4568e41f4b71Sopenharmony_ci
4569e41f4b71Sopenharmony_ci```ts
4570e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4571e41f4b71Sopenharmony_ci
4572e41f4b71Sopenharmony_cifunction callback(err: BusinessError): void {
4573e41f4b71Sopenharmony_ci  console.error(`Panorama photo session error code: ${err.code}`);
4574e41f4b71Sopenharmony_ci}
4575e41f4b71Sopenharmony_ci
4576e41f4b71Sopenharmony_cifunction registerSessionError(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
4577e41f4b71Sopenharmony_ci  panoramaPhotoSession.on('error', callback);
4578e41f4b71Sopenharmony_ci}
4579e41f4b71Sopenharmony_ci```
4580e41f4b71Sopenharmony_ci
4581e41f4b71Sopenharmony_ci### off('error')<sup>11+</sup>
4582e41f4b71Sopenharmony_ci
4583e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
4584e41f4b71Sopenharmony_ci
4585e41f4b71Sopenharmony_ciUnsubscribes from **PanoramaPhotoSession** error events.
4586e41f4b71Sopenharmony_ci
4587e41f4b71Sopenharmony_ci**System API**: This is a system API.
4588e41f4b71Sopenharmony_ci
4589e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4590e41f4b71Sopenharmony_ci
4591e41f4b71Sopenharmony_ci**Parameters**
4592e41f4b71Sopenharmony_ci
4593e41f4b71Sopenharmony_ci| Name    | Type                       | Mandatory| Description                          |
4594e41f4b71Sopenharmony_ci| -------- | ------------------------ | ---- | ------------------------------ |
4595e41f4b71Sopenharmony_ci| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
4596e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('error')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)      |
4597e41f4b71Sopenharmony_ci
4598e41f4b71Sopenharmony_ci**Example**
4599e41f4b71Sopenharmony_ci
4600e41f4b71Sopenharmony_ci```ts
4601e41f4b71Sopenharmony_cifunction unregisterSessionError(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
4602e41f4b71Sopenharmony_ci  panoramaPhotoSession.off('error');
4603e41f4b71Sopenharmony_ci}
4604e41f4b71Sopenharmony_ci```
4605e41f4b71Sopenharmony_ci
4606e41f4b71Sopenharmony_ci### on('focusStateChange')<sup>11+</sup>
4607e41f4b71Sopenharmony_ci
4608e41f4b71Sopenharmony_cion(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4609e41f4b71Sopenharmony_ci
4610e41f4b71Sopenharmony_ciSubscribes to focus state change events. This API uses an asynchronous callback to return the result.
4611e41f4b71Sopenharmony_ci
4612e41f4b71Sopenharmony_ci**System API**: This is a system API.
4613e41f4b71Sopenharmony_ci
4614e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4615e41f4b71Sopenharmony_ci
4616e41f4b71Sopenharmony_ci**Parameters**
4617e41f4b71Sopenharmony_ci
4618e41f4b71Sopenharmony_ci| Name    | Type                   | Mandatory| Description                      |
4619e41f4b71Sopenharmony_ci| -------- | ---------------- | ---- | ------------------------ |
4620e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.|
4621e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
4622e41f4b71Sopenharmony_ci
4623e41f4b71Sopenharmony_ci**Example**
4624e41f4b71Sopenharmony_ci
4625e41f4b71Sopenharmony_ci```ts
4626e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4627e41f4b71Sopenharmony_ci
4628e41f4b71Sopenharmony_cifunction callback(err: BusinessError, focusState: camera.FocusState): void {
4629e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
4630e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
4631e41f4b71Sopenharmony_ci    return;
4632e41f4b71Sopenharmony_ci  }
4633e41f4b71Sopenharmony_ci  console.info(`Focus state: ${focusState}`);
4634e41f4b71Sopenharmony_ci}
4635e41f4b71Sopenharmony_ci
4636e41f4b71Sopenharmony_cifunction registerFocusStateChange(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
4637e41f4b71Sopenharmony_ci  panoramaPhotoSession.on('focusStateChange', callback);
4638e41f4b71Sopenharmony_ci}
4639e41f4b71Sopenharmony_ci```
4640e41f4b71Sopenharmony_ci
4641e41f4b71Sopenharmony_ci### off('focusStateChange')<sup>11+</sup>
4642e41f4b71Sopenharmony_ci
4643e41f4b71Sopenharmony_cioff(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4644e41f4b71Sopenharmony_ci
4645e41f4b71Sopenharmony_ciUnsubscribes from focus state change events.
4646e41f4b71Sopenharmony_ci
4647e41f4b71Sopenharmony_ci**System API**: This is a system API.
4648e41f4b71Sopenharmony_ci
4649e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4650e41f4b71Sopenharmony_ci
4651e41f4b71Sopenharmony_ci**Parameters**
4652e41f4b71Sopenharmony_ci
4653e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
4654e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
4655e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
4656e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('focusStateChange')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
4657e41f4b71Sopenharmony_ci
4658e41f4b71Sopenharmony_ci**Example**
4659e41f4b71Sopenharmony_ci
4660e41f4b71Sopenharmony_ci```ts
4661e41f4b71Sopenharmony_cifunction unregisterFocusStateChange(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
4662e41f4b71Sopenharmony_ci  panoramaPhotoSession.off('focusStateChange');
4663e41f4b71Sopenharmony_ci}
4664e41f4b71Sopenharmony_ci```
4665e41f4b71Sopenharmony_ci
4666e41f4b71Sopenharmony_ci## IsoInfo<sup>12+</sup>
4667e41f4b71Sopenharmony_ci
4668e41f4b71Sopenharmony_ciDescribes the ISO information.
4669e41f4b71Sopenharmony_ci
4670e41f4b71Sopenharmony_ci**System API**: This is a system API.
4671e41f4b71Sopenharmony_ci
4672e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4673e41f4b71Sopenharmony_ci
4674e41f4b71Sopenharmony_ci| Name| Type   | Read-only| Optional| Description          |
4675e41f4b71Sopenharmony_ci| ---- | ------- | ---- |--| -------------- |
4676e41f4b71Sopenharmony_ci| iso  | number  | Yes  | Yes| ISO.       |
4677e41f4b71Sopenharmony_ci
4678e41f4b71Sopenharmony_ci---
4679e41f4b71Sopenharmony_ci
4680e41f4b71Sopenharmony_ci## ExposureInfo<sup>12+</sup>
4681e41f4b71Sopenharmony_ci
4682e41f4b71Sopenharmony_ciDescribes the exposure information.
4683e41f4b71Sopenharmony_ci
4684e41f4b71Sopenharmony_ci**System API**: This is a system API.
4685e41f4b71Sopenharmony_ci
4686e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4687e41f4b71Sopenharmony_ci
4688e41f4b71Sopenharmony_ci| Name             | Type   | Read-only| Optional | Description              |
4689e41f4b71Sopenharmony_ci| ----------------- | ------- | ---- |-----| ------------------ |
4690e41f4b71Sopenharmony_ci| exposureTime | number  | Yes  | Yes  | Exposure time, in ms.|
4691e41f4b71Sopenharmony_ci
4692e41f4b71Sopenharmony_ci---
4693e41f4b71Sopenharmony_ci
4694e41f4b71Sopenharmony_ci## ApertureInfo<sup>12+</sup>
4695e41f4b71Sopenharmony_ci
4696e41f4b71Sopenharmony_ciDescribes the aperture information.
4697e41f4b71Sopenharmony_ci
4698e41f4b71Sopenharmony_ci**System API**: This is a system API.
4699e41f4b71Sopenharmony_ci
4700e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4701e41f4b71Sopenharmony_ci
4702e41f4b71Sopenharmony_ci| Name     | Type   | Read-only| Optional | Description      |
4703e41f4b71Sopenharmony_ci| --------- | ------- | ---- |-----| ---------- |
4704e41f4b71Sopenharmony_ci| aperture  | number  | Yes  | Yes  | Aperture.  |
4705e41f4b71Sopenharmony_ci
4706e41f4b71Sopenharmony_ci---
4707e41f4b71Sopenharmony_ci
4708e41f4b71Sopenharmony_ci## LuminationInfo<sup>12+</sup>
4709e41f4b71Sopenharmony_ci
4710e41f4b71Sopenharmony_ciDescribes the illumination information.
4711e41f4b71Sopenharmony_ci
4712e41f4b71Sopenharmony_ci**System API**: This is a system API.
4713e41f4b71Sopenharmony_ci
4714e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4715e41f4b71Sopenharmony_ci
4716e41f4b71Sopenharmony_ci| Name       | Type   | Read-only| Optional | Description      |
4717e41f4b71Sopenharmony_ci| ----------- | ------- | ---- |-----| ---------- |
4718e41f4b71Sopenharmony_ci| lumination  | number  | Yes  | Yes  | Illumination. The value range is [0,1].|
4719e41f4b71Sopenharmony_ci
4720e41f4b71Sopenharmony_ci## CameraFormat
4721e41f4b71Sopenharmony_ci
4722e41f4b71Sopenharmony_ciEnumerates the camera output formats.
4723e41f4b71Sopenharmony_ci
4724e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4725e41f4b71Sopenharmony_ci
4726e41f4b71Sopenharmony_ci| Name                    | Value       | Description        |
4727e41f4b71Sopenharmony_ci| ----------------------- | --------- | ------------ |
4728e41f4b71Sopenharmony_ci| CAMERA_FORMAT_DNG<sup>12+</sup>  | 4         | Raw image in DNG format. **System API**: This is a system API.        |
4729e41f4b71Sopenharmony_ci
4730e41f4b71Sopenharmony_ci## ExposureMeteringMode<sup>12+</sup>
4731e41f4b71Sopenharmony_ci
4732e41f4b71Sopenharmony_ciEnumerates the exposure metering modes.
4733e41f4b71Sopenharmony_ci
4734e41f4b71Sopenharmony_ci**System API**: This is a system API.
4735e41f4b71Sopenharmony_ci
4736e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4737e41f4b71Sopenharmony_ci
4738e41f4b71Sopenharmony_ci| Name                          | Value  | Description        |
4739e41f4b71Sopenharmony_ci| ----------------------------- | ---- | ----------- |
4740e41f4b71Sopenharmony_ci| MATRIX          | 0    | Performs metering on a wide area of the image.|
4741e41f4b71Sopenharmony_ci| CENTER          | 1    | Performs metering on the entire image, with the center allocated with the maximum weight.|
4742e41f4b71Sopenharmony_ci| SPOT            | 2    | Performs metering around 2.5% of the metering points.|
4743e41f4b71Sopenharmony_ci
4744e41f4b71Sopenharmony_ci## AutoExposureQuery<sup>12+</sup>
4745e41f4b71Sopenharmony_ci
4746e41f4b71Sopenharmony_ciProvides APIs to check whether a device supports an exposure mode or exposure metering mode and obtain the exposure compensation range.
4747e41f4b71Sopenharmony_ci
4748e41f4b71Sopenharmony_ci### isExposureMeteringModeSupported<sup>12+</sup>
4749e41f4b71Sopenharmony_ci
4750e41f4b71Sopenharmony_ciisExposureMeteringModeSupported(aeMeteringMode: ExposureMeteringMode): boolean
4751e41f4b71Sopenharmony_ci
4752e41f4b71Sopenharmony_ciChecks whether an exposure metering mode is supported.
4753e41f4b71Sopenharmony_ci
4754e41f4b71Sopenharmony_ci**System API**: This is a system API.
4755e41f4b71Sopenharmony_ci
4756e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4757e41f4b71Sopenharmony_ci
4758e41f4b71Sopenharmony_ci**Parameters**
4759e41f4b71Sopenharmony_ci
4760e41f4b71Sopenharmony_ci| Name     | Type                          | Mandatory | Description                          |
4761e41f4b71Sopenharmony_ci| -------- | -------------------------------| ---- | ----------------------------- |
4762e41f4b71Sopenharmony_ci| aeMeteringMode   | [ExposureMeteringMode](#exposuremeteringmode12)  | Yes  | Metering mode.                     |
4763e41f4b71Sopenharmony_ci
4764e41f4b71Sopenharmony_ci**Return value**
4765e41f4b71Sopenharmony_ci
4766e41f4b71Sopenharmony_ci| Type       | Description                         |
4767e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
4768e41f4b71Sopenharmony_ci| boolean    | **true**: The exposure metering mode is supported.<br>**false**: The exposure metering mode is not supported. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
4769e41f4b71Sopenharmony_ci
4770e41f4b71Sopenharmony_ci**Error codes**
4771e41f4b71Sopenharmony_ci
4772e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4773e41f4b71Sopenharmony_ci
4774e41f4b71Sopenharmony_ci| ID        | Error Message       |
4775e41f4b71Sopenharmony_ci| --------------- | --------------- |
4776e41f4b71Sopenharmony_ci| 202     | Not System Application. |
4777e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.                                   |
4778e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
4779e41f4b71Sopenharmony_ci
4780e41f4b71Sopenharmony_ci
4781e41f4b71Sopenharmony_ci**Example**
4782e41f4b71Sopenharmony_ci
4783e41f4b71Sopenharmony_ci```ts
4784e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4785e41f4b71Sopenharmony_ci
4786e41f4b71Sopenharmony_cifunction isExposureMeteringModeSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
4787e41f4b71Sopenharmony_ci  let isSupported: boolean = false;
4788e41f4b71Sopenharmony_ci  try {
4789e41f4b71Sopenharmony_ci    isSupported = professionalPhotoSession.isExposureModeSupported(camera.ExposureMeteringMode.CENTER);
4790e41f4b71Sopenharmony_ci  } catch (error) {
4791e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
4792e41f4b71Sopenharmony_ci    let err = error as BusinessError;
4793e41f4b71Sopenharmony_ci    console.error(`The isExposureMeteringModeSupported call failed. error code: ${err.code}`);
4794e41f4b71Sopenharmony_ci  }
4795e41f4b71Sopenharmony_ci  return isSupported;
4796e41f4b71Sopenharmony_ci}
4797e41f4b71Sopenharmony_ci```
4798e41f4b71Sopenharmony_ci
4799e41f4b71Sopenharmony_ci## AutoExposure
4800e41f4b71Sopenharmony_ci
4801e41f4b71Sopenharmony_ciAutoExposure extends [AutoExposureQuery](#autoexposurequery12)
4802e41f4b71Sopenharmony_ci
4803e41f4b71Sopenharmony_ciProvides APIs related to automatic exposure of a camera device, including obtaining and setting the exposure mode and measurement point, obtaining the compensation range, setting the exposure compensation, and obtaining the exposure metering mode.
4804e41f4b71Sopenharmony_ci
4805e41f4b71Sopenharmony_ci### getExposureMeteringMode<sup>12+</sup>
4806e41f4b71Sopenharmony_ci
4807e41f4b71Sopenharmony_cigetExposureMeteringMode(): ExposureMeteringMode
4808e41f4b71Sopenharmony_ci
4809e41f4b71Sopenharmony_ciObtains the exposure metering mode in use.
4810e41f4b71Sopenharmony_ci
4811e41f4b71Sopenharmony_ci**System API**: This is a system API.
4812e41f4b71Sopenharmony_ci
4813e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4814e41f4b71Sopenharmony_ci
4815e41f4b71Sopenharmony_ci**Return value**
4816e41f4b71Sopenharmony_ci
4817e41f4b71Sopenharmony_ci| Type       | Description                         |
4818e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
4819e41f4b71Sopenharmony_ci| [ExposureMeteringMode](#exposuremeteringmode12)    | Exposure metering mode obtained. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
4820e41f4b71Sopenharmony_ci
4821e41f4b71Sopenharmony_ci**Error codes**
4822e41f4b71Sopenharmony_ci
4823e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4824e41f4b71Sopenharmony_ci
4825e41f4b71Sopenharmony_ci| ID        | Error Message       |
4826e41f4b71Sopenharmony_ci| --------------- | --------------- |
4827e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
4828e41f4b71Sopenharmony_ci| 202     | Not System Application. |
4829e41f4b71Sopenharmony_ci
4830e41f4b71Sopenharmony_ci**Example**
4831e41f4b71Sopenharmony_ci
4832e41f4b71Sopenharmony_ci```ts
4833e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4834e41f4b71Sopenharmony_ci
4835e41f4b71Sopenharmony_cifunction getExposureMeteringMode(professionalPhotoSession: camera.ProfessionalPhotoSession): camera.ExposureMeteringMode | undefined {
4836e41f4b71Sopenharmony_ci  let exposureMeteringMode: camera.ExposureMeteringMode | undefined = undefined;
4837e41f4b71Sopenharmony_ci  try {
4838e41f4b71Sopenharmony_ci    exposureMeteringMode = professionalPhotoSession.getExposureMeteringMode();
4839e41f4b71Sopenharmony_ci  } catch (error) {
4840e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
4841e41f4b71Sopenharmony_ci    let err = error as BusinessError;
4842e41f4b71Sopenharmony_ci    console.error(`The getExposureMeteringMode call failed. error code: ${err.code}`);
4843e41f4b71Sopenharmony_ci  }
4844e41f4b71Sopenharmony_ci  return exposureMeteringMode;
4845e41f4b71Sopenharmony_ci}
4846e41f4b71Sopenharmony_ci```
4847e41f4b71Sopenharmony_ci
4848e41f4b71Sopenharmony_ci### setExposureMeteringMode<sup>12+</sup>
4849e41f4b71Sopenharmony_ci
4850e41f4b71Sopenharmony_cisetExposureMeteringMode(aeMeteringMode: ExposureMeteringMode): void
4851e41f4b71Sopenharmony_ci
4852e41f4b71Sopenharmony_ciSets an exposure metering mode. 
4853e41f4b71Sopenharmony_ci
4854e41f4b71Sopenharmony_ciBefore the setting, call [isExposureMeteringModeSupported](#isexposuremeteringmodesupported12) to check whether the target exposure metering mode is supported.
4855e41f4b71Sopenharmony_ci
4856e41f4b71Sopenharmony_ci**System API**: This is a system API.
4857e41f4b71Sopenharmony_ci
4858e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4859e41f4b71Sopenharmony_ci
4860e41f4b71Sopenharmony_ci**Parameters**
4861e41f4b71Sopenharmony_ci
4862e41f4b71Sopenharmony_ci| Name     | Type                           | Mandatory| Description                   |
4863e41f4b71Sopenharmony_ci| -------- | -------------------------------| ---- | ----------------------- |
4864e41f4b71Sopenharmony_ci| aeMeteringMode   | [ExposureMeteringMode](#exposuremeteringmode12)  | Yes  | Metering mode.               |
4865e41f4b71Sopenharmony_ci
4866e41f4b71Sopenharmony_ci**Error codes**
4867e41f4b71Sopenharmony_ci
4868e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4869e41f4b71Sopenharmony_ci
4870e41f4b71Sopenharmony_ci| ID        | Error Message       |
4871e41f4b71Sopenharmony_ci| --------------- | --------------- |
4872e41f4b71Sopenharmony_ci| 202     | Not System Application. |
4873e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
4874e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
4875e41f4b71Sopenharmony_ci
4876e41f4b71Sopenharmony_ci**Example**
4877e41f4b71Sopenharmony_ci
4878e41f4b71Sopenharmony_ci```ts
4879e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4880e41f4b71Sopenharmony_ci
4881e41f4b71Sopenharmony_cifunction setExposureMeteringMode(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
4882e41f4b71Sopenharmony_ci  try {
4883e41f4b71Sopenharmony_ci    professionalPhotoSession.setExposureMeteringMode(camera.ExposureMeteringMode.CENTER);
4884e41f4b71Sopenharmony_ci  } catch (error) {
4885e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
4886e41f4b71Sopenharmony_ci    let err = error as BusinessError;
4887e41f4b71Sopenharmony_ci    console.error(`The setExposureMeteringMode call failed. error code: ${err.code}`);
4888e41f4b71Sopenharmony_ci  }
4889e41f4b71Sopenharmony_ci}
4890e41f4b71Sopenharmony_ci```
4891e41f4b71Sopenharmony_ci
4892e41f4b71Sopenharmony_ci## FocusQuery<sup>12+</sup>
4893e41f4b71Sopenharmony_ci
4894e41f4b71Sopenharmony_ciProvides the API to check whether the focus assist is supported.
4895e41f4b71Sopenharmony_ci
4896e41f4b71Sopenharmony_ci### isFocusAssistSupported<sup>12+</sup>
4897e41f4b71Sopenharmony_ci
4898e41f4b71Sopenharmony_ciisFocusAssistSupported(): boolean
4899e41f4b71Sopenharmony_ci
4900e41f4b71Sopenharmony_ciChecks whether the focus assist is supported.
4901e41f4b71Sopenharmony_ci
4902e41f4b71Sopenharmony_ci**System API**: This is a system API.
4903e41f4b71Sopenharmony_ci
4904e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4905e41f4b71Sopenharmony_ci
4906e41f4b71Sopenharmony_ci**Return value**
4907e41f4b71Sopenharmony_ci
4908e41f4b71Sopenharmony_ci| Type       | Description                         |
4909e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
4910e41f4b71Sopenharmony_ci| boolean    | **true**: The focus assist is supported.<br>**false**: The focus assist is not supported. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
4911e41f4b71Sopenharmony_ci
4912e41f4b71Sopenharmony_ci**Error codes**
4913e41f4b71Sopenharmony_ci
4914e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4915e41f4b71Sopenharmony_ci
4916e41f4b71Sopenharmony_ci| ID        | Error Message       |
4917e41f4b71Sopenharmony_ci| --------------- | --------------- |
4918e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
4919e41f4b71Sopenharmony_ci| 202     | Not System Application. |
4920e41f4b71Sopenharmony_ci
4921e41f4b71Sopenharmony_ci**Example**
4922e41f4b71Sopenharmony_ci
4923e41f4b71Sopenharmony_ci```ts
4924e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4925e41f4b71Sopenharmony_ci
4926e41f4b71Sopenharmony_cifunction isFocusAssistSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
4927e41f4b71Sopenharmony_ci  let status: boolean = false;
4928e41f4b71Sopenharmony_ci  try {
4929e41f4b71Sopenharmony_ci    status = professionalPhotoSession.isFocusAssistSupported();
4930e41f4b71Sopenharmony_ci  } catch (error) {
4931e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
4932e41f4b71Sopenharmony_ci    let err = error as BusinessError;
4933e41f4b71Sopenharmony_ci    console.error(`The isFocusAssistSupported call failed. error code: ${err.code}`);
4934e41f4b71Sopenharmony_ci  }
4935e41f4b71Sopenharmony_ci  return status;
4936e41f4b71Sopenharmony_ci}
4937e41f4b71Sopenharmony_ci```
4938e41f4b71Sopenharmony_ci
4939e41f4b71Sopenharmony_ci## Focus
4940e41f4b71Sopenharmony_ci
4941e41f4b71Sopenharmony_ciFocus extends [FocusQuery](#focusquery12)
4942e41f4b71Sopenharmony_ci
4943e41f4b71Sopenharmony_ciProvides APIs to obtain and set the camera focus mode and focus position.
4944e41f4b71Sopenharmony_ci
4945e41f4b71Sopenharmony_ci### setFocusAssist<sup>12+</sup>
4946e41f4b71Sopenharmony_ci
4947e41f4b71Sopenharmony_cisetFocusAssist(enabled: boolean): void
4948e41f4b71Sopenharmony_ci
4949e41f4b71Sopenharmony_ciSets the focus assist. 
4950e41f4b71Sopenharmony_ci
4951e41f4b71Sopenharmony_ciBefore the setting, call [isFocusAssistSupported](#isfocusassistsupported12) to check whether the device supports the focus assist.
4952e41f4b71Sopenharmony_ci
4953e41f4b71Sopenharmony_ci**System API**: This is a system API.
4954e41f4b71Sopenharmony_ci
4955e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4956e41f4b71Sopenharmony_ci
4957e41f4b71Sopenharmony_ci**Parameters**
4958e41f4b71Sopenharmony_ci
4959e41f4b71Sopenharmony_ci| Name     | Type                    | Mandatory| Description                |
4960e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------- |
4961e41f4b71Sopenharmony_ci| enabled | boolean | Yes  | **true**: Enables the focus assist.<br>**false**: Disables the focus assist.|
4962e41f4b71Sopenharmony_ci
4963e41f4b71Sopenharmony_ci**Error codes**
4964e41f4b71Sopenharmony_ci
4965e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4966e41f4b71Sopenharmony_ci
4967e41f4b71Sopenharmony_ci| ID        | Error Message       |
4968e41f4b71Sopenharmony_ci| --------------- | --------------- |
4969e41f4b71Sopenharmony_ci| 202     | Not System Application. |
4970e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
4971e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
4972e41f4b71Sopenharmony_ci
4973e41f4b71Sopenharmony_ci
4974e41f4b71Sopenharmony_ci**Example**
4975e41f4b71Sopenharmony_ci
4976e41f4b71Sopenharmony_ci```ts
4977e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
4978e41f4b71Sopenharmony_ci
4979e41f4b71Sopenharmony_cifunction setFocusAssist(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
4980e41f4b71Sopenharmony_ci  try {
4981e41f4b71Sopenharmony_ci    professionalPhotoSession.setFocusAssist(false);
4982e41f4b71Sopenharmony_ci  } catch (error) {
4983e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
4984e41f4b71Sopenharmony_ci    let err = error as BusinessError;
4985e41f4b71Sopenharmony_ci    console.error(`The setFocusAssist call failed. error code: ${err.code}`);
4986e41f4b71Sopenharmony_ci  }
4987e41f4b71Sopenharmony_ci}
4988e41f4b71Sopenharmony_ci```
4989e41f4b71Sopenharmony_ci
4990e41f4b71Sopenharmony_ci### getFocusAssist<sup>12+</sup>
4991e41f4b71Sopenharmony_ci
4992e41f4b71Sopenharmony_cigetFocusAssist(): boolean
4993e41f4b71Sopenharmony_ci
4994e41f4b71Sopenharmony_ciChecks whether the focus assist is enabled.
4995e41f4b71Sopenharmony_ci
4996e41f4b71Sopenharmony_ci**System API**: This is a system API.
4997e41f4b71Sopenharmony_ci
4998e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
4999e41f4b71Sopenharmony_ci
5000e41f4b71Sopenharmony_ci**Return value**
5001e41f4b71Sopenharmony_ci
5002e41f4b71Sopenharmony_ci| Type       | Description                         |
5003e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
5004e41f4b71Sopenharmony_ci| boolean    | **true**: The focus assist is enabled.<br>**false**: The focus assist is disabled.|
5005e41f4b71Sopenharmony_ci
5006e41f4b71Sopenharmony_ci**Error codes**
5007e41f4b71Sopenharmony_ci
5008e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5009e41f4b71Sopenharmony_ci
5010e41f4b71Sopenharmony_ci| ID        | Error Message       |
5011e41f4b71Sopenharmony_ci| --------------- | --------------- |
5012e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5013e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5014e41f4b71Sopenharmony_ci
5015e41f4b71Sopenharmony_ci**Example**
5016e41f4b71Sopenharmony_ci
5017e41f4b71Sopenharmony_ci```ts
5018e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5019e41f4b71Sopenharmony_ci
5020e41f4b71Sopenharmony_cifunction getFocusAssist(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5021e41f4b71Sopenharmony_ci  let isFocusAssistOpened: boolean;
5022e41f4b71Sopenharmony_ci  try {
5023e41f4b71Sopenharmony_ci    isFocusAssistOpened = professionalPhotoSession.getFocusAssist();
5024e41f4b71Sopenharmony_ci  } catch (error) {
5025e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5026e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5027e41f4b71Sopenharmony_ci    console.error(`The getFocusAssist call failed. error code: ${err.code}`);
5028e41f4b71Sopenharmony_ci  }
5029e41f4b71Sopenharmony_ci  return isFocusAssistOpened;
5030e41f4b71Sopenharmony_ci}
5031e41f4b71Sopenharmony_ci```
5032e41f4b71Sopenharmony_ci
5033e41f4b71Sopenharmony_ci## ManualFocus<sup>12+</sup>
5034e41f4b71Sopenharmony_ci
5035e41f4b71Sopenharmony_ciProvides APIs related to manual focus operations.
5036e41f4b71Sopenharmony_ci
5037e41f4b71Sopenharmony_ci### setFocusDistance<sup>12+</sup>
5038e41f4b71Sopenharmony_ci
5039e41f4b71Sopenharmony_cisetFocusDistance(distance: number): void
5040e41f4b71Sopenharmony_ci
5041e41f4b71Sopenharmony_ciSets the manual focus distance.
5042e41f4b71Sopenharmony_ci
5043e41f4b71Sopenharmony_ci**System API**: This is a system API.
5044e41f4b71Sopenharmony_ci
5045e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5046e41f4b71Sopenharmony_ci
5047e41f4b71Sopenharmony_ci**Parameters**
5048e41f4b71Sopenharmony_ci
5049e41f4b71Sopenharmony_ci| Name     | Type                    | Mandatory| Description                |
5050e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------- |
5051e41f4b71Sopenharmony_ci| distance | number | Yes  | Manual focus distance. The value is a floating point number in the range [0, 1]. The value **0** indicates a close-up shot, and **1** indicates a long shot.<br> |
5052e41f4b71Sopenharmony_ci
5053e41f4b71Sopenharmony_ci**Error codes**
5054e41f4b71Sopenharmony_ci
5055e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5056e41f4b71Sopenharmony_ci
5057e41f4b71Sopenharmony_ci| ID        | Error Message       |
5058e41f4b71Sopenharmony_ci| --------------- | --------------- |
5059e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5060e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
5061e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5062e41f4b71Sopenharmony_ci
5063e41f4b71Sopenharmony_ci**Example**
5064e41f4b71Sopenharmony_ci
5065e41f4b71Sopenharmony_ci```ts
5066e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5067e41f4b71Sopenharmony_ci
5068e41f4b71Sopenharmony_cifunction setFocusDistance(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5069e41f4b71Sopenharmony_ci  try {
5070e41f4b71Sopenharmony_ci    let distance: number = 0.5;
5071e41f4b71Sopenharmony_ci    professionalPhotoSession.setFocusDistance(distance);
5072e41f4b71Sopenharmony_ci  } catch (error) {
5073e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5074e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5075e41f4b71Sopenharmony_ci    console.error(`The setFocusDistance call failed. error code: ${err.code}`);
5076e41f4b71Sopenharmony_ci  }
5077e41f4b71Sopenharmony_ci}
5078e41f4b71Sopenharmony_ci```
5079e41f4b71Sopenharmony_ci
5080e41f4b71Sopenharmony_ci### getFocusDistance<sup>12+</sup>
5081e41f4b71Sopenharmony_ci
5082e41f4b71Sopenharmony_cigetFocusDistance(): number
5083e41f4b71Sopenharmony_ci
5084e41f4b71Sopenharmony_ciObtains the focus distance in use.
5085e41f4b71Sopenharmony_ci
5086e41f4b71Sopenharmony_ci**System API**: This is a system API.
5087e41f4b71Sopenharmony_ci
5088e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5089e41f4b71Sopenharmony_ci
5090e41f4b71Sopenharmony_ci**Return value**
5091e41f4b71Sopenharmony_ci
5092e41f4b71Sopenharmony_ci| Type       | Description                         |
5093e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
5094e41f4b71Sopenharmony_ci| number    | Normalized value of the focus distance.|
5095e41f4b71Sopenharmony_ci
5096e41f4b71Sopenharmony_ci**Error codes**
5097e41f4b71Sopenharmony_ci
5098e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5099e41f4b71Sopenharmony_ci
5100e41f4b71Sopenharmony_ci| ID        | Error Message       |
5101e41f4b71Sopenharmony_ci| --------------- | --------------- |
5102e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5103e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5104e41f4b71Sopenharmony_ci
5105e41f4b71Sopenharmony_ci**Example**
5106e41f4b71Sopenharmony_ci
5107e41f4b71Sopenharmony_ci```ts
5108e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5109e41f4b71Sopenharmony_ci
5110e41f4b71Sopenharmony_cifunction getFocusDistance(professionalPhotoSession: camera.ProfessionalPhotoSession): number {
5111e41f4b71Sopenharmony_ci  let distance: number = 0;
5112e41f4b71Sopenharmony_ci  try {
5113e41f4b71Sopenharmony_ci    distance = professionalPhotoSession.getFocusDistance();
5114e41f4b71Sopenharmony_ci  } catch (error) {
5115e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5116e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5117e41f4b71Sopenharmony_ci    console.error(`The getFocusDistance call failed. error code: ${err.code}`);
5118e41f4b71Sopenharmony_ci  }
5119e41f4b71Sopenharmony_ci  return distance;
5120e41f4b71Sopenharmony_ci}
5121e41f4b71Sopenharmony_ci```
5122e41f4b71Sopenharmony_ci
5123e41f4b71Sopenharmony_ci## ManualIsoQuery<sup>12+</sup>
5124e41f4b71Sopenharmony_ci
5125e41f4b71Sopenharmony_ciProvides APIs to check whether a camera device supports manual ISO setting and obtain the ISO range supported by the device.
5126e41f4b71Sopenharmony_ci
5127e41f4b71Sopenharmony_ci### isManualIsoSupported<sup>12+</sup>
5128e41f4b71Sopenharmony_ci
5129e41f4b71Sopenharmony_ciisManualIsoSupported(): boolean
5130e41f4b71Sopenharmony_ci
5131e41f4b71Sopenharmony_ciChecks whether manual ISO setting is supported.
5132e41f4b71Sopenharmony_ci
5133e41f4b71Sopenharmony_ci**System API**: This is a system API.
5134e41f4b71Sopenharmony_ci
5135e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5136e41f4b71Sopenharmony_ci
5137e41f4b71Sopenharmony_ci**Return value**
5138e41f4b71Sopenharmony_ci
5139e41f4b71Sopenharmony_ci| Type       | Description                         |
5140e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
5141e41f4b71Sopenharmony_ci| boolean    | **true**: Manual ISO setting is supported.<br>**false**: Manual ISO setting is not supported. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5142e41f4b71Sopenharmony_ci
5143e41f4b71Sopenharmony_ci**Error codes**
5144e41f4b71Sopenharmony_ci
5145e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5146e41f4b71Sopenharmony_ci
5147e41f4b71Sopenharmony_ci| ID        | Error Message       |
5148e41f4b71Sopenharmony_ci| --------------- | --------------- |
5149e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5150e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5151e41f4b71Sopenharmony_ci
5152e41f4b71Sopenharmony_ci**Example**
5153e41f4b71Sopenharmony_ci
5154e41f4b71Sopenharmony_ci```ts
5155e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5156e41f4b71Sopenharmony_ci
5157e41f4b71Sopenharmony_cifunction isManualIsoSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5158e41f4b71Sopenharmony_ci  let status: boolean = false;
5159e41f4b71Sopenharmony_ci  try {
5160e41f4b71Sopenharmony_ci    status = professionalPhotoSession.isManualIsoSupported();
5161e41f4b71Sopenharmony_ci  } catch (error) {
5162e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5163e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5164e41f4b71Sopenharmony_ci    console.error(`The isManualIsoSupported call failed. error code: ${err.code}`);
5165e41f4b71Sopenharmony_ci  }
5166e41f4b71Sopenharmony_ci  return status;
5167e41f4b71Sopenharmony_ci}
5168e41f4b71Sopenharmony_ci```
5169e41f4b71Sopenharmony_ci
5170e41f4b71Sopenharmony_ci### getIsoRange<sup>12+</sup>
5171e41f4b71Sopenharmony_ci
5172e41f4b71Sopenharmony_cigetIsoRange(): Array\<number\>
5173e41f4b71Sopenharmony_ci
5174e41f4b71Sopenharmony_ciObtains the supported ISO range.
5175e41f4b71Sopenharmony_ci
5176e41f4b71Sopenharmony_ci**System API**: This is a system API.
5177e41f4b71Sopenharmony_ci
5178e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5179e41f4b71Sopenharmony_ci
5180e41f4b71Sopenharmony_ci**Return value**
5181e41f4b71Sopenharmony_ci
5182e41f4b71Sopenharmony_ci| Type       | Description                         |
5183e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
5184e41f4b71Sopenharmony_ci| Array\<number\>   | ISO range. The value range is [50, 100, ..., 6400]. The actual value depends on the bottom-layer capability. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5185e41f4b71Sopenharmony_ci
5186e41f4b71Sopenharmony_ci**Error codes**
5187e41f4b71Sopenharmony_ci
5188e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5189e41f4b71Sopenharmony_ci
5190e41f4b71Sopenharmony_ci| ID        | Error Message       |
5191e41f4b71Sopenharmony_ci| --------------- | --------------- |
5192e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5193e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5194e41f4b71Sopenharmony_ci
5195e41f4b71Sopenharmony_ci**Example**
5196e41f4b71Sopenharmony_ci
5197e41f4b71Sopenharmony_ci```ts
5198e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5199e41f4b71Sopenharmony_ci
5200e41f4b71Sopenharmony_cifunction getIsoRange(professionalPhotoSession: camera.ProfessionalPhotoSession): Array<number> {
5201e41f4b71Sopenharmony_ci  let isoRange: Array<number> = [];
5202e41f4b71Sopenharmony_ci  try {
5203e41f4b71Sopenharmony_ci    isoRange = professionalPhotoSession.getIsoRange();
5204e41f4b71Sopenharmony_ci  } catch (error) {
5205e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5206e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5207e41f4b71Sopenharmony_ci    console.error(`The getIsoRange call failed. error code: ${err.code}`);
5208e41f4b71Sopenharmony_ci  }
5209e41f4b71Sopenharmony_ci  return isoRange;
5210e41f4b71Sopenharmony_ci}
5211e41f4b71Sopenharmony_ci```
5212e41f4b71Sopenharmony_ci
5213e41f4b71Sopenharmony_ci## ManualIso<sup>12+</sup>
5214e41f4b71Sopenharmony_ci
5215e41f4b71Sopenharmony_ciManualIso extends [ManualIsoQuery](#manualisoquery12)
5216e41f4b71Sopenharmony_ci
5217e41f4b71Sopenharmony_ciProvides APIs for obtaining and setting the manual ISO (sensitivity) of a camera device.
5218e41f4b71Sopenharmony_ci
5219e41f4b71Sopenharmony_ci### setIso<sup>12+</sup>
5220e41f4b71Sopenharmony_cisetIso(iso: number): void
5221e41f4b71Sopenharmony_ci
5222e41f4b71Sopenharmony_ciSets the ISO.
5223e41f4b71Sopenharmony_ci
5224e41f4b71Sopenharmony_ci**NOTE**: When the ISO is set to 0, automatic ISO is used.
5225e41f4b71Sopenharmony_ci
5226e41f4b71Sopenharmony_ci**System API**: This is a system API.
5227e41f4b71Sopenharmony_ci
5228e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5229e41f4b71Sopenharmony_ci
5230e41f4b71Sopenharmony_ci**Parameters**
5231e41f4b71Sopenharmony_ci
5232e41f4b71Sopenharmony_ci| Name     | Type                    | Mandatory| Description                |
5233e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------- |
5234e41f4b71Sopenharmony_ci| iso | number | Yes  | ISO.|
5235e41f4b71Sopenharmony_ci
5236e41f4b71Sopenharmony_ci**Error codes**
5237e41f4b71Sopenharmony_ci
5238e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5239e41f4b71Sopenharmony_ci
5240e41f4b71Sopenharmony_ci| ID        | Error Message       |
5241e41f4b71Sopenharmony_ci| --------------- | --------------- |
5242e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5243e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
5244e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5245e41f4b71Sopenharmony_ci
5246e41f4b71Sopenharmony_ci**Example**
5247e41f4b71Sopenharmony_ci
5248e41f4b71Sopenharmony_ci```ts
5249e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5250e41f4b71Sopenharmony_ci
5251e41f4b71Sopenharmony_cifunction setIso(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5252e41f4b71Sopenharmony_ci  try {
5253e41f4b71Sopenharmony_ci    let iso: number = 200;
5254e41f4b71Sopenharmony_ci    professionalPhotoSession.setIso(iso);
5255e41f4b71Sopenharmony_ci  } catch (error) {
5256e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5257e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5258e41f4b71Sopenharmony_ci    console.error(`The setIso call failed. error code: ${err.code}`);
5259e41f4b71Sopenharmony_ci  }
5260e41f4b71Sopenharmony_ci}
5261e41f4b71Sopenharmony_ci```
5262e41f4b71Sopenharmony_ci
5263e41f4b71Sopenharmony_ci### getIso<sup>12+</sup>
5264e41f4b71Sopenharmony_ci
5265e41f4b71Sopenharmony_cigetIso(): number
5266e41f4b71Sopenharmony_ci
5267e41f4b71Sopenharmony_ciObtains the ISO in use.
5268e41f4b71Sopenharmony_ci
5269e41f4b71Sopenharmony_ci**System API**: This is a system API.
5270e41f4b71Sopenharmony_ci
5271e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5272e41f4b71Sopenharmony_ci
5273e41f4b71Sopenharmony_ci**Return value**
5274e41f4b71Sopenharmony_ci
5275e41f4b71Sopenharmony_ci| Type       | Description                         |
5276e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
5277e41f4b71Sopenharmony_ci| number    | ISO.|
5278e41f4b71Sopenharmony_ci
5279e41f4b71Sopenharmony_ci**Error codes**
5280e41f4b71Sopenharmony_ci
5281e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5282e41f4b71Sopenharmony_ci
5283e41f4b71Sopenharmony_ci| ID        | Error Message       |
5284e41f4b71Sopenharmony_ci| --------------- | --------------- |
5285e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5286e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5287e41f4b71Sopenharmony_ci
5288e41f4b71Sopenharmony_ci**Example**
5289e41f4b71Sopenharmony_ci
5290e41f4b71Sopenharmony_ci```ts
5291e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5292e41f4b71Sopenharmony_ci
5293e41f4b71Sopenharmony_cifunction getIso(professionalPhotoSession: camera.ProfessionalPhotoSession): number {
5294e41f4b71Sopenharmony_ci  let iso: number = 0;
5295e41f4b71Sopenharmony_ci  try {
5296e41f4b71Sopenharmony_ci    iso = professionalPhotoSession.getIso();
5297e41f4b71Sopenharmony_ci  } catch (error) {
5298e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5299e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5300e41f4b71Sopenharmony_ci    console.error(`The getIso call failed. error code: ${err.code}`);
5301e41f4b71Sopenharmony_ci  }
5302e41f4b71Sopenharmony_ci  return iso;
5303e41f4b71Sopenharmony_ci}
5304e41f4b71Sopenharmony_ci```
5305e41f4b71Sopenharmony_ci
5306e41f4b71Sopenharmony_ci## WhiteBalanceMode<sup>12+</sup>
5307e41f4b71Sopenharmony_ci
5308e41f4b71Sopenharmony_ciEnumerates the white balance modes.
5309e41f4b71Sopenharmony_ci
5310e41f4b71Sopenharmony_ci**System API**: This is a system API.
5311e41f4b71Sopenharmony_ci
5312e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5313e41f4b71Sopenharmony_ci
5314e41f4b71Sopenharmony_ci| Name                          | Value  | Description        |
5315e41f4b71Sopenharmony_ci| ----------------------------- | ---- | ----------- |
5316e41f4b71Sopenharmony_ci| AUTO          | 0    | Automatic.|
5317e41f4b71Sopenharmony_ci| CLOUDY        | 1    | Cloudy.|
5318e41f4b71Sopenharmony_ci| INCANDESCENT  | 2    | Incandescent light.|
5319e41f4b71Sopenharmony_ci| FLUORESCENT   | 3    | Fluorescence light.|
5320e41f4b71Sopenharmony_ci| DAYLIGHT     	| 4    | Daylight.|
5321e41f4b71Sopenharmony_ci| MANUAL        | 5    | Manual.|
5322e41f4b71Sopenharmony_ci
5323e41f4b71Sopenharmony_ci## WhiteBalanceQuery<sup>12+</sup>
5324e41f4b71Sopenharmony_ci
5325e41f4b71Sopenharmony_ciProvides APIs to check whether a white balance mode is supported and obtain the white balance mode range supported.
5326e41f4b71Sopenharmony_ci
5327e41f4b71Sopenharmony_ci### isWhiteBalanceModeSupported<sup>12+</sup>
5328e41f4b71Sopenharmony_ci
5329e41f4b71Sopenharmony_ciisWhiteBalanceModeSupported(mode: WhiteBalanceMode): boolean
5330e41f4b71Sopenharmony_ci
5331e41f4b71Sopenharmony_ciChecks whether a white balance mode is supported.
5332e41f4b71Sopenharmony_ci
5333e41f4b71Sopenharmony_ci**System API**: This is a system API.
5334e41f4b71Sopenharmony_ci
5335e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5336e41f4b71Sopenharmony_ci**Parameters**
5337e41f4b71Sopenharmony_ci
5338e41f4b71Sopenharmony_ci| Name     | Type                          | Mandatory | Description                          |
5339e41f4b71Sopenharmony_ci| -------- | -------------------------------| ---- | ----------------------------- |
5340e41f4b71Sopenharmony_ci| mode   | [WhiteBalanceMode](#whitebalancemode12)  | Yes  | White balance mode.                     |
5341e41f4b71Sopenharmony_ci
5342e41f4b71Sopenharmony_ci**Return value**
5343e41f4b71Sopenharmony_ci
5344e41f4b71Sopenharmony_ci| Type       | Description                         |
5345e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
5346e41f4b71Sopenharmony_ci| boolean    | **true**: The white balance mode is supported.<br>**false**: The white balance mode is not supported. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5347e41f4b71Sopenharmony_ci
5348e41f4b71Sopenharmony_ci**Error codes**
5349e41f4b71Sopenharmony_ci
5350e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5351e41f4b71Sopenharmony_ci
5352e41f4b71Sopenharmony_ci| ID        | Error Message       |
5353e41f4b71Sopenharmony_ci| --------------- | --------------- |
5354e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5355e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
5356e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5357e41f4b71Sopenharmony_ci
5358e41f4b71Sopenharmony_ci**Example**
5359e41f4b71Sopenharmony_ci
5360e41f4b71Sopenharmony_ci```ts
5361e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5362e41f4b71Sopenharmony_ci
5363e41f4b71Sopenharmony_cifunction isWhiteBalanceModeSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5364e41f4b71Sopenharmony_ci  let status: boolean = false;
5365e41f4b71Sopenharmony_ci  try {
5366e41f4b71Sopenharmony_ci	let mode: WhiteBalanceMode = camera.WhiteBalanceMode.DAYLIGHT;
5367e41f4b71Sopenharmony_ci    status = professionalPhotoSession.isWhiteBalanceModeSupported(mode);
5368e41f4b71Sopenharmony_ci  } catch (error) {
5369e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5370e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5371e41f4b71Sopenharmony_ci    console.error(`The isWhiteBalanceModeSupported call failed. error code: ${err.code}`);
5372e41f4b71Sopenharmony_ci  }
5373e41f4b71Sopenharmony_ci  return status;
5374e41f4b71Sopenharmony_ci}
5375e41f4b71Sopenharmony_ci```
5376e41f4b71Sopenharmony_ci
5377e41f4b71Sopenharmony_ci### getWhiteBalanceRange<sup>12+</sup>
5378e41f4b71Sopenharmony_ci
5379e41f4b71Sopenharmony_cigetWhiteBalanceRange(): Array\<number\>
5380e41f4b71Sopenharmony_ci
5381e41f4b71Sopenharmony_ciObtains the white balance range, in which users can manually adjust the white balance.
5382e41f4b71Sopenharmony_ci
5383e41f4b71Sopenharmony_ci**System API**: This is a system API.
5384e41f4b71Sopenharmony_ci
5385e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5386e41f4b71Sopenharmony_ci
5387e41f4b71Sopenharmony_ci**Return value**
5388e41f4b71Sopenharmony_ci
5389e41f4b71Sopenharmony_ci| Type       | Description                         |
5390e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
5391e41f4b71Sopenharmony_ci| Array\<number\>   | White balance range, for example, [2800, ...,10000], in units of K (Kelvin). The actual value depends on the bottom-layer capability. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5392e41f4b71Sopenharmony_ci
5393e41f4b71Sopenharmony_ci**Error codes**
5394e41f4b71Sopenharmony_ci
5395e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5396e41f4b71Sopenharmony_ci
5397e41f4b71Sopenharmony_ci| ID        | Error Message       |
5398e41f4b71Sopenharmony_ci| --------------- | --------------- |
5399e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5400e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5401e41f4b71Sopenharmony_ci
5402e41f4b71Sopenharmony_ci**Example**
5403e41f4b71Sopenharmony_ci
5404e41f4b71Sopenharmony_ci```ts
5405e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5406e41f4b71Sopenharmony_ci
5407e41f4b71Sopenharmony_cifunction getWhiteBalanceRange(professionalPhotoSession: camera.ProfessionalPhotoSession): Array<number> {
5408e41f4b71Sopenharmony_ci  let range: Array<number> = [];
5409e41f4b71Sopenharmony_ci  try {
5410e41f4b71Sopenharmony_ci    range = professionalPhotoSession.getWhiteBalanceRange();
5411e41f4b71Sopenharmony_ci  } catch (error) {
5412e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5413e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5414e41f4b71Sopenharmony_ci    console.error(`The getWhiteBalanceRange call failed. error code: ${err.code}`);
5415e41f4b71Sopenharmony_ci  }
5416e41f4b71Sopenharmony_ci  return range;
5417e41f4b71Sopenharmony_ci}
5418e41f4b71Sopenharmony_ci```
5419e41f4b71Sopenharmony_ci
5420e41f4b71Sopenharmony_ci## WhiteBalance<sup>12+</sup>
5421e41f4b71Sopenharmony_ci
5422e41f4b71Sopenharmony_ciWhiteBalance extends [WhiteBalanceQuery](#whitebalancequery12)
5423e41f4b71Sopenharmony_ci
5424e41f4b71Sopenharmony_ciProvides APIs to process white balance, including obtaining and setting the white balance mode and white balance value.
5425e41f4b71Sopenharmony_ci
5426e41f4b71Sopenharmony_ci### setWhiteBalanceMode<sup>12+</sup>
5427e41f4b71Sopenharmony_ci
5428e41f4b71Sopenharmony_cisetWhiteBalanceMode(mode: WhiteBalanceMode): void
5429e41f4b71Sopenharmony_ci
5430e41f4b71Sopenharmony_ciSets a white balance mode. 
5431e41f4b71Sopenharmony_ci
5432e41f4b71Sopenharmony_ciBefore the setting, call [isWhiteBalanceModeSupported](#iswhitebalancemodesupported12) to check whether the target white balance mode is supported.
5433e41f4b71Sopenharmony_ci
5434e41f4b71Sopenharmony_ci**System API**: This is a system API.
5435e41f4b71Sopenharmony_ci
5436e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5437e41f4b71Sopenharmony_ci
5438e41f4b71Sopenharmony_ci**Parameters**
5439e41f4b71Sopenharmony_ci
5440e41f4b71Sopenharmony_ci| Name     | Type                           | Mandatory| Description                   |
5441e41f4b71Sopenharmony_ci| -------- | -------------------------------| ---- | ----------------------- |
5442e41f4b71Sopenharmony_ci| mode   | [WhiteBalanceMode](#whitebalancemode12)  | Yes  | White balance mode.               |
5443e41f4b71Sopenharmony_ci
5444e41f4b71Sopenharmony_ci**Error codes**
5445e41f4b71Sopenharmony_ci
5446e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5447e41f4b71Sopenharmony_ci
5448e41f4b71Sopenharmony_ci| ID        | Error Message       |
5449e41f4b71Sopenharmony_ci| --------------- | --------------- |
5450e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5451e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
5452e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5453e41f4b71Sopenharmony_ci
5454e41f4b71Sopenharmony_ci**Example**
5455e41f4b71Sopenharmony_ci
5456e41f4b71Sopenharmony_ci```ts
5457e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5458e41f4b71Sopenharmony_ci
5459e41f4b71Sopenharmony_cifunction setWhiteBalanceMode(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5460e41f4b71Sopenharmony_ci  try {
5461e41f4b71Sopenharmony_ci    professionalPhotoSession.setWhiteBalanceMode(camera.WhiteBalanceMode.DAYLIGHT);
5462e41f4b71Sopenharmony_ci  } catch (error) {
5463e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5464e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5465e41f4b71Sopenharmony_ci    console.error(`The setWhiteBalanceMode call failed. error code: ${err.code}`);
5466e41f4b71Sopenharmony_ci  }
5467e41f4b71Sopenharmony_ci}
5468e41f4b71Sopenharmony_ci```
5469e41f4b71Sopenharmony_ci
5470e41f4b71Sopenharmony_ci### getWhiteBalanceMode<sup>12+</sup>
5471e41f4b71Sopenharmony_ci
5472e41f4b71Sopenharmony_cigetWhiteBalanceMode(): WhiteBalanceMode
5473e41f4b71Sopenharmony_ci
5474e41f4b71Sopenharmony_ciObtains the white balance mode in use.
5475e41f4b71Sopenharmony_ci
5476e41f4b71Sopenharmony_ci**System API**: This is a system API.
5477e41f4b71Sopenharmony_ci
5478e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5479e41f4b71Sopenharmony_ci
5480e41f4b71Sopenharmony_ci**Return value**
5481e41f4b71Sopenharmony_ci
5482e41f4b71Sopenharmony_ci| Type       | Description                         |
5483e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
5484e41f4b71Sopenharmony_ci| [WhiteBalanceMode](#whitebalancemode12)    | White balance mode in use. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5485e41f4b71Sopenharmony_ci
5486e41f4b71Sopenharmony_ci**Error codes**
5487e41f4b71Sopenharmony_ci
5488e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5489e41f4b71Sopenharmony_ci
5490e41f4b71Sopenharmony_ci| ID        | Error Message       |
5491e41f4b71Sopenharmony_ci| --------------- | --------------- |
5492e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5493e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5494e41f4b71Sopenharmony_ci
5495e41f4b71Sopenharmony_ci**Example**
5496e41f4b71Sopenharmony_ci
5497e41f4b71Sopenharmony_ci```ts
5498e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5499e41f4b71Sopenharmony_ci
5500e41f4b71Sopenharmony_cifunction getWhiteBalanceMode(professionalPhotoSession: camera.ProfessionalPhotoSession): camera.WhiteBalanceMode | undefined {
5501e41f4b71Sopenharmony_ci  let whiteBalanceMode: camera.WhiteBalanceMode | undefined = undefined;
5502e41f4b71Sopenharmony_ci  try {
5503e41f4b71Sopenharmony_ci    whiteBalanceMode = professionalPhotoSession.getWhiteBalanceMode();
5504e41f4b71Sopenharmony_ci  } catch (error) {
5505e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5506e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5507e41f4b71Sopenharmony_ci    console.error(`The getWhiteBalanceMode call failed. error code: ${err.code}`);
5508e41f4b71Sopenharmony_ci  }
5509e41f4b71Sopenharmony_ci  return whiteBalanceMode;
5510e41f4b71Sopenharmony_ci}
5511e41f4b71Sopenharmony_ci```
5512e41f4b71Sopenharmony_ci
5513e41f4b71Sopenharmony_ci### setWhiteBalance<sup>12+</sup>
5514e41f4b71Sopenharmony_ci
5515e41f4b71Sopenharmony_cisetWhiteBalance(whiteBalance: number): void
5516e41f4b71Sopenharmony_ci
5517e41f4b71Sopenharmony_ciSets a white balance value.
5518e41f4b71Sopenharmony_ci
5519e41f4b71Sopenharmony_ci**System API**: This is a system API.
5520e41f4b71Sopenharmony_ci
5521e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5522e41f4b71Sopenharmony_ci
5523e41f4b71Sopenharmony_ci**Parameters**
5524e41f4b71Sopenharmony_ci
5525e41f4b71Sopenharmony_ci| Name     | Type                    | Mandatory| Description                |
5526e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------- |
5527e41f4b71Sopenharmony_ci| whiteBalance | number | Yes  | White balance value.|
5528e41f4b71Sopenharmony_ci
5529e41f4b71Sopenharmony_ci**Error codes**
5530e41f4b71Sopenharmony_ci
5531e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5532e41f4b71Sopenharmony_ci
5533e41f4b71Sopenharmony_ci| ID        | Error Message       |
5534e41f4b71Sopenharmony_ci| --------------- | --------------- |
5535e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5536e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
5537e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5538e41f4b71Sopenharmony_ci
5539e41f4b71Sopenharmony_ci**Example**
5540e41f4b71Sopenharmony_ci
5541e41f4b71Sopenharmony_ci```ts
5542e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5543e41f4b71Sopenharmony_ci
5544e41f4b71Sopenharmony_cifunction setWhiteBalance(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5545e41f4b71Sopenharmony_ci  try {
5546e41f4b71Sopenharmony_ci    let whiteBalance: number = 1000;
5547e41f4b71Sopenharmony_ci    professionalPhotoSession.setWhiteBalance(whiteBalance);
5548e41f4b71Sopenharmony_ci  } catch (error) {
5549e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5550e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5551e41f4b71Sopenharmony_ci    console.error(`The setWhiteBalance call failed. error code: ${err.code}`);
5552e41f4b71Sopenharmony_ci  }
5553e41f4b71Sopenharmony_ci}
5554e41f4b71Sopenharmony_ci```
5555e41f4b71Sopenharmony_ci
5556e41f4b71Sopenharmony_ci### getWhiteBalance<sup>12+</sup>
5557e41f4b71Sopenharmony_ci
5558e41f4b71Sopenharmony_cigetWhiteBalance(): number
5559e41f4b71Sopenharmony_ci
5560e41f4b71Sopenharmony_ciObtains the current white balance value.
5561e41f4b71Sopenharmony_ci
5562e41f4b71Sopenharmony_ci**System API**: This is a system API.
5563e41f4b71Sopenharmony_ci
5564e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5565e41f4b71Sopenharmony_ci
5566e41f4b71Sopenharmony_ci**Return value**
5567e41f4b71Sopenharmony_ci
5568e41f4b71Sopenharmony_ci| Type       | Description                         |
5569e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
5570e41f4b71Sopenharmony_ci| number    | White balance value.|
5571e41f4b71Sopenharmony_ci
5572e41f4b71Sopenharmony_ci**Error codes**
5573e41f4b71Sopenharmony_ci
5574e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5575e41f4b71Sopenharmony_ci
5576e41f4b71Sopenharmony_ci| ID        | Error Message       |
5577e41f4b71Sopenharmony_ci| --------------- | --------------- |
5578e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5579e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
5580e41f4b71Sopenharmony_ci
5581e41f4b71Sopenharmony_ci**Example**
5582e41f4b71Sopenharmony_ci
5583e41f4b71Sopenharmony_ci```ts
5584e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5585e41f4b71Sopenharmony_ci
5586e41f4b71Sopenharmony_cifunction getWhiteBalance(professionalPhotoSession: camera.ProfessionalPhotoSession): number {
5587e41f4b71Sopenharmony_ci  let whiteBalance: number = 0;
5588e41f4b71Sopenharmony_ci  try {
5589e41f4b71Sopenharmony_ci    whiteBalance = professionalPhotoSession.getWhiteBalance();
5590e41f4b71Sopenharmony_ci  } catch (error) {
5591e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
5592e41f4b71Sopenharmony_ci    let err = error as BusinessError;
5593e41f4b71Sopenharmony_ci    console.error(`The getWhiteBalance call failed. error code: ${err.code}`);
5594e41f4b71Sopenharmony_ci  }
5595e41f4b71Sopenharmony_ci  return whiteBalance;
5596e41f4b71Sopenharmony_ci}
5597e41f4b71Sopenharmony_ci```
5598e41f4b71Sopenharmony_ci
5599e41f4b71Sopenharmony_ci## ProfessionalPhotoSession<sup>12+</sup>
5600e41f4b71Sopenharmony_ci
5601e41f4b71Sopenharmony_ciProfessionalPhotoSession extends Session, AutoExposure, ManualExposure, Focus, ManualFocus, WhiteBalance, ManualIso, Flash, Zoom, ColorEffect, Aperture
5602e41f4b71Sopenharmony_ci
5603e41f4b71Sopenharmony_ciImplements a professional photo session, which sets the parameters of the professional photo mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session12).
5604e41f4b71Sopenharmony_ci
5605e41f4b71Sopenharmony_ci### on('error')<sup>12+</sup>
5606e41f4b71Sopenharmony_ci
5607e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
5608e41f4b71Sopenharmony_ci
5609e41f4b71Sopenharmony_ciSubscribes to **ProfessionalPhotoSession** error events. This API uses an asynchronous callback to return the result.
5610e41f4b71Sopenharmony_ci
5611e41f4b71Sopenharmony_ci**System API**: This is a system API.
5612e41f4b71Sopenharmony_ci
5613e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5614e41f4b71Sopenharmony_ci
5615e41f4b71Sopenharmony_ci**Parameters**
5616e41f4b71Sopenharmony_ci
5617e41f4b71Sopenharmony_ci| Name    | Type                                                         | Mandatory| Description                          |
5618e41f4b71Sopenharmony_ci| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
5619e41f4b71Sopenharmony_ci| type     | string                                                      | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as [beginConfig](js-apis-camera.md#beginconfig11), [commitConfig](js-apis-camera.md#commitconfig11-1), and [addInput](js-apis-camera.md#addinput11).|
5620e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).|
5621e41f4b71Sopenharmony_ci
5622e41f4b71Sopenharmony_ci**Error codes**
5623e41f4b71Sopenharmony_ci
5624e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5625e41f4b71Sopenharmony_ci
5626e41f4b71Sopenharmony_ci| ID  | Error Message       |
5627e41f4b71Sopenharmony_ci|---------| --------------- |
5628e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
5629e41f4b71Sopenharmony_ci
5630e41f4b71Sopenharmony_ci**Example**
5631e41f4b71Sopenharmony_ci
5632e41f4b71Sopenharmony_ci```ts
5633e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5634e41f4b71Sopenharmony_ci
5635e41f4b71Sopenharmony_cifunction callback(err: BusinessError): void {
5636e41f4b71Sopenharmony_ci  console.error(`Professional photo session error code: ${err.code}`);
5637e41f4b71Sopenharmony_ci}
5638e41f4b71Sopenharmony_ci
5639e41f4b71Sopenharmony_cifunction registerSessionError(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5640e41f4b71Sopenharmony_ci  professionalPhotoSession.on('error', callback);
5641e41f4b71Sopenharmony_ci}
5642e41f4b71Sopenharmony_ci```
5643e41f4b71Sopenharmony_ci
5644e41f4b71Sopenharmony_ci### off('error')<sup>12+</sup>
5645e41f4b71Sopenharmony_ci
5646e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
5647e41f4b71Sopenharmony_ci
5648e41f4b71Sopenharmony_ciUnsubscribes from **ProfessionalPhotoSession** error events.
5649e41f4b71Sopenharmony_ci
5650e41f4b71Sopenharmony_ci**System API**: This is a system API.
5651e41f4b71Sopenharmony_ci
5652e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5653e41f4b71Sopenharmony_ci
5654e41f4b71Sopenharmony_ci**Parameters**
5655e41f4b71Sopenharmony_ci
5656e41f4b71Sopenharmony_ci| Name    | Type                       | Mandatory| Description                          |
5657e41f4b71Sopenharmony_ci| -------- | ------------------------ | ---- | ------------------------------ |
5658e41f4b71Sopenharmony_ci| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
5659e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| No  | Callback, which is optional. If a callback function is passed in, it is an anonymous function.      |
5660e41f4b71Sopenharmony_ci
5661e41f4b71Sopenharmony_ci**Error codes**
5662e41f4b71Sopenharmony_ci
5663e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5664e41f4b71Sopenharmony_ci
5665e41f4b71Sopenharmony_ci| ID  | Error Message       |
5666e41f4b71Sopenharmony_ci|---------| --------------- |
5667e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
5668e41f4b71Sopenharmony_ci
5669e41f4b71Sopenharmony_ci**Example**
5670e41f4b71Sopenharmony_ci
5671e41f4b71Sopenharmony_ci```ts
5672e41f4b71Sopenharmony_cifunction unregisterSessionError(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5673e41f4b71Sopenharmony_ci  professionalPhotoSession.off('error');
5674e41f4b71Sopenharmony_ci}
5675e41f4b71Sopenharmony_ci```
5676e41f4b71Sopenharmony_ci
5677e41f4b71Sopenharmony_ci### on('focusStateChange')<sup>12+</sup>
5678e41f4b71Sopenharmony_ci
5679e41f4b71Sopenharmony_cion(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
5680e41f4b71Sopenharmony_ci
5681e41f4b71Sopenharmony_ciSubscribes to focus state change events. This API uses an asynchronous callback to return the result.
5682e41f4b71Sopenharmony_ci
5683e41f4b71Sopenharmony_ci**System API**: This is a system API.
5684e41f4b71Sopenharmony_ci
5685e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5686e41f4b71Sopenharmony_ci
5687e41f4b71Sopenharmony_ci**Parameters**
5688e41f4b71Sopenharmony_ci
5689e41f4b71Sopenharmony_ci| Name    | Type                   | Mandatory| Description                      |
5690e41f4b71Sopenharmony_ci| -------- | ---------------- | ---- | ------------------------ |
5691e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.|
5692e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
5693e41f4b71Sopenharmony_ci
5694e41f4b71Sopenharmony_ci**Error codes**
5695e41f4b71Sopenharmony_ci
5696e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5697e41f4b71Sopenharmony_ci
5698e41f4b71Sopenharmony_ci| ID  | Error Message       |
5699e41f4b71Sopenharmony_ci|---------| --------------- |
5700e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
5701e41f4b71Sopenharmony_ci
5702e41f4b71Sopenharmony_ci**Example**
5703e41f4b71Sopenharmony_ci
5704e41f4b71Sopenharmony_ci```ts
5705e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5706e41f4b71Sopenharmony_ci
5707e41f4b71Sopenharmony_cifunction callback(err: BusinessError, focusState: camera.FocusState): void {
5708e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
5709e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
5710e41f4b71Sopenharmony_ci    return;
5711e41f4b71Sopenharmony_ci  }
5712e41f4b71Sopenharmony_ci  console.info(`Focus state: ${focusState}`);
5713e41f4b71Sopenharmony_ci}
5714e41f4b71Sopenharmony_ci
5715e41f4b71Sopenharmony_cifunction registerFocusStateChange(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5716e41f4b71Sopenharmony_ci  professionalPhotoSession.on('focusStateChange', callback);
5717e41f4b71Sopenharmony_ci}
5718e41f4b71Sopenharmony_ci```
5719e41f4b71Sopenharmony_ci
5720e41f4b71Sopenharmony_ci### off('focusStateChange')<sup>12+</sup>
5721e41f4b71Sopenharmony_ci
5722e41f4b71Sopenharmony_cioff(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
5723e41f4b71Sopenharmony_ci
5724e41f4b71Sopenharmony_ciUnsubscribes from focus state change events.
5725e41f4b71Sopenharmony_ci
5726e41f4b71Sopenharmony_ci**System API**: This is a system API.
5727e41f4b71Sopenharmony_ci
5728e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5729e41f4b71Sopenharmony_ci
5730e41f4b71Sopenharmony_ci**Parameters**
5731e41f4b71Sopenharmony_ci
5732e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
5733e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
5734e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
5735e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('focusStateChange')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
5736e41f4b71Sopenharmony_ci
5737e41f4b71Sopenharmony_ci**Error codes**
5738e41f4b71Sopenharmony_ci
5739e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5740e41f4b71Sopenharmony_ci
5741e41f4b71Sopenharmony_ci| ID  | Error Message       |
5742e41f4b71Sopenharmony_ci|---------| --------------- |
5743e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
5744e41f4b71Sopenharmony_ci
5745e41f4b71Sopenharmony_ci**Example**
5746e41f4b71Sopenharmony_ci
5747e41f4b71Sopenharmony_ci```ts
5748e41f4b71Sopenharmony_cifunction unregisterFocusStateChange(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5749e41f4b71Sopenharmony_ci  professionalPhotoSession.off('focusStateChange');
5750e41f4b71Sopenharmony_ci}
5751e41f4b71Sopenharmony_ci```
5752e41f4b71Sopenharmony_ci
5753e41f4b71Sopenharmony_ci### on('smoothZoomInfoAvailable')<sup>12+</sup>
5754e41f4b71Sopenharmony_ci
5755e41f4b71Sopenharmony_cion(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
5756e41f4b71Sopenharmony_ci
5757e41f4b71Sopenharmony_ciSubscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
5758e41f4b71Sopenharmony_ci
5759e41f4b71Sopenharmony_ci**System API**: This is a system API.
5760e41f4b71Sopenharmony_ci
5761e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5762e41f4b71Sopenharmony_ci
5763e41f4b71Sopenharmony_ci**Parameters**
5764e41f4b71Sopenharmony_ci
5765e41f4b71Sopenharmony_ci| Name    | Type                  | Mandatory| Description                      |
5766e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------------ |
5767e41f4b71Sopenharmony_ci| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
5768e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
5769e41f4b71Sopenharmony_ci
5770e41f4b71Sopenharmony_ci**Error codes**
5771e41f4b71Sopenharmony_ci
5772e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5773e41f4b71Sopenharmony_ci
5774e41f4b71Sopenharmony_ci| ID  | Error Message       |
5775e41f4b71Sopenharmony_ci|---------| --------------- |
5776e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
5777e41f4b71Sopenharmony_ci
5778e41f4b71Sopenharmony_ci**Example**
5779e41f4b71Sopenharmony_ci
5780e41f4b71Sopenharmony_ci```ts
5781e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5782e41f4b71Sopenharmony_ci
5783e41f4b71Sopenharmony_cifunction callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
5784e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
5785e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
5786e41f4b71Sopenharmony_ci    return;
5787e41f4b71Sopenharmony_ci  }
5788e41f4b71Sopenharmony_ci  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
5789e41f4b71Sopenharmony_ci}
5790e41f4b71Sopenharmony_ci
5791e41f4b71Sopenharmony_cifunction registerSmoothZoomInfo(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5792e41f4b71Sopenharmony_ci  professionalPhotoSession.on('smoothZoomInfoAvailable', callback);
5793e41f4b71Sopenharmony_ci}
5794e41f4b71Sopenharmony_ci```
5795e41f4b71Sopenharmony_ci
5796e41f4b71Sopenharmony_ci### off('smoothZoomInfoAvailable')<sup>12+</sup>
5797e41f4b71Sopenharmony_ci
5798e41f4b71Sopenharmony_cioff(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
5799e41f4b71Sopenharmony_ci
5800e41f4b71Sopenharmony_ciUnsubscribes from smooth zoom state change events.
5801e41f4b71Sopenharmony_ci
5802e41f4b71Sopenharmony_ci**System API**: This is a system API.
5803e41f4b71Sopenharmony_ci
5804e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5805e41f4b71Sopenharmony_ci
5806e41f4b71Sopenharmony_ci**Parameters**
5807e41f4b71Sopenharmony_ci
5808e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
5809e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
5810e41f4b71Sopenharmony_ci| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
5811e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('smoothZoomInfoAvailable')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
5812e41f4b71Sopenharmony_ci
5813e41f4b71Sopenharmony_ci**Error codes**
5814e41f4b71Sopenharmony_ci
5815e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5816e41f4b71Sopenharmony_ci
5817e41f4b71Sopenharmony_ci| ID  | Error Message       |
5818e41f4b71Sopenharmony_ci|---------| --------------- |
5819e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
5820e41f4b71Sopenharmony_ci
5821e41f4b71Sopenharmony_ci**Example**
5822e41f4b71Sopenharmony_ci
5823e41f4b71Sopenharmony_ci```ts
5824e41f4b71Sopenharmony_cifunction unregisterSmoothZoomInfo(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5825e41f4b71Sopenharmony_ci  professionalPhotoSession.off('smoothZoomInfoAvailable');
5826e41f4b71Sopenharmony_ci}
5827e41f4b71Sopenharmony_ci```
5828e41f4b71Sopenharmony_ci
5829e41f4b71Sopenharmony_ci### on('isoInfoChange')<sup>12+</sup>
5830e41f4b71Sopenharmony_ci
5831e41f4b71Sopenharmony_cion(type: 'isoInfoChange', callback: AsyncCallback\<IsoInfo\>): void
5832e41f4b71Sopenharmony_ci
5833e41f4b71Sopenharmony_ciSubscribes to automatic ISO change events to obtain real-time ISO information. This API uses an asynchronous callback to return the result.
5834e41f4b71Sopenharmony_ci
5835e41f4b71Sopenharmony_ci**System API**: This is a system API.
5836e41f4b71Sopenharmony_ci
5837e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5838e41f4b71Sopenharmony_ci
5839e41f4b71Sopenharmony_ci**Parameters**
5840e41f4b71Sopenharmony_ci
5841e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
5842e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
5843e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
5844e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[IsoInfo](js-apis-camera-sys.md#isoinfo12)\>| Yes  | Callback used to return the ISO information.        |
5845e41f4b71Sopenharmony_ci
5846e41f4b71Sopenharmony_ci**Error codes**
5847e41f4b71Sopenharmony_ci
5848e41f4b71Sopenharmony_ci| ID| Error Message                    |
5849e41f4b71Sopenharmony_ci| ------- | ---------------------- |
5850e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5851e41f4b71Sopenharmony_ci
5852e41f4b71Sopenharmony_ci**Example**
5853e41f4b71Sopenharmony_ci
5854e41f4b71Sopenharmony_ci```ts
5855e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5856e41f4b71Sopenharmony_ci
5857e41f4b71Sopenharmony_cifunction isoInfoCallback(err: BusinessError, info: camera.IsoInfo): void {
5858e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
5859e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
5860e41f4b71Sopenharmony_ci    return;
5861e41f4b71Sopenharmony_ci  }
5862e41f4b71Sopenharmony_ci  console.log(`ISO value: ${info.iso}`);
5863e41f4b71Sopenharmony_ci}
5864e41f4b71Sopenharmony_ci
5865e41f4b71Sopenharmony_cifunction registerIsoInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5866e41f4b71Sopenharmony_ci  professionalPhotoSession.on('isoInfoChange', isoInfoCallback);
5867e41f4b71Sopenharmony_ci}
5868e41f4b71Sopenharmony_ci```
5869e41f4b71Sopenharmony_ci
5870e41f4b71Sopenharmony_ci### off('isoInfoChange')<sup>12+</sup>
5871e41f4b71Sopenharmony_ci
5872e41f4b71Sopenharmony_cioff(type: 'isoInfoChange', callback?: AsyncCallback\<IsoInfo\>): void
5873e41f4b71Sopenharmony_ci
5874e41f4b71Sopenharmony_ciUnsubscribes from automatic ISO change events.
5875e41f4b71Sopenharmony_ci
5876e41f4b71Sopenharmony_ci**System API**: This is a system API.
5877e41f4b71Sopenharmony_ci
5878e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5879e41f4b71Sopenharmony_ci
5880e41f4b71Sopenharmony_ci**Parameters**
5881e41f4b71Sopenharmony_ci
5882e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
5883e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
5884e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
5885e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[IsoInfo](js-apis-camera-sys.md#isoinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('isoInfoChange')**.|
5886e41f4b71Sopenharmony_ci
5887e41f4b71Sopenharmony_ci**Error codes**
5888e41f4b71Sopenharmony_ci
5889e41f4b71Sopenharmony_ci| ID| Error Message                   |
5890e41f4b71Sopenharmony_ci| ------- | ---------------------- |
5891e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5892e41f4b71Sopenharmony_ci
5893e41f4b71Sopenharmony_ci**Example**
5894e41f4b71Sopenharmony_ci
5895e41f4b71Sopenharmony_ci```ts
5896e41f4b71Sopenharmony_cifunction unregisterIsoInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5897e41f4b71Sopenharmony_ci  professionalPhotoSession.off('isoInfoChange');
5898e41f4b71Sopenharmony_ci}
5899e41f4b71Sopenharmony_ci```
5900e41f4b71Sopenharmony_ci
5901e41f4b71Sopenharmony_ci### on('exposureInfoChange')<sup>12+</sup>
5902e41f4b71Sopenharmony_ci
5903e41f4b71Sopenharmony_cion(type: 'exposureInfoChange', callback: AsyncCallback\<[ExposureInfo](js-apis-camera-sys.md#exposureinfo12)\>): void
5904e41f4b71Sopenharmony_ci
5905e41f4b71Sopenharmony_ciSubscribes to exposure information change events to obtain the exposure information. This API uses an asynchronous callback to return the result.
5906e41f4b71Sopenharmony_ci
5907e41f4b71Sopenharmony_ci**System API**: This is a system API.
5908e41f4b71Sopenharmony_ci
5909e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5910e41f4b71Sopenharmony_ci
5911e41f4b71Sopenharmony_ci**Parameters**
5912e41f4b71Sopenharmony_ci
5913e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
5914e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
5915e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
5916e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ExposureInfo](js-apis-camera-sys.md#exposureinfo12)\>| Yes  | Callback used to return the exposure information.        |
5917e41f4b71Sopenharmony_ci
5918e41f4b71Sopenharmony_ci**Error codes**
5919e41f4b71Sopenharmony_ci
5920e41f4b71Sopenharmony_ci| ID| Error Message                    |
5921e41f4b71Sopenharmony_ci| ------- | ---------------------- |
5922e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5923e41f4b71Sopenharmony_ci
5924e41f4b71Sopenharmony_ci**Example**
5925e41f4b71Sopenharmony_ci
5926e41f4b71Sopenharmony_ci```ts
5927e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
5928e41f4b71Sopenharmony_ci
5929e41f4b71Sopenharmony_cifunction exposureInfoCallback(err: BusinessError, info: camera.ExposureInfo): void {
5930e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
5931e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
5932e41f4b71Sopenharmony_ci    return;
5933e41f4b71Sopenharmony_ci  }
5934e41f4b71Sopenharmony_ci  console.log(`exposureTimeValue: ${info.exposureTime}`);
5935e41f4b71Sopenharmony_ci}
5936e41f4b71Sopenharmony_ci
5937e41f4b71Sopenharmony_cifunction registerExposureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5938e41f4b71Sopenharmony_ci  professionalPhotoSession.on('exposureInfoChange', exposureInfoCallback);
5939e41f4b71Sopenharmony_ci}
5940e41f4b71Sopenharmony_ci```
5941e41f4b71Sopenharmony_ci
5942e41f4b71Sopenharmony_ci### off('exposureInfoChange')<sup>12+</sup>
5943e41f4b71Sopenharmony_ci
5944e41f4b71Sopenharmony_cioff(type: 'exposureInfoChange', callback?: AsyncCallback\<[ExposureInfo](js-apis-camera-sys.md#exposureinfo12)\>): void
5945e41f4b71Sopenharmony_ci
5946e41f4b71Sopenharmony_ciUnsubscribes from exposure information change events.
5947e41f4b71Sopenharmony_ci
5948e41f4b71Sopenharmony_ci**System API**: This is a system API.
5949e41f4b71Sopenharmony_ci
5950e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5951e41f4b71Sopenharmony_ci
5952e41f4b71Sopenharmony_ci**Parameters**
5953e41f4b71Sopenharmony_ci
5954e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
5955e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
5956e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
5957e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ExposureInfo](js-apis-camera-sys.md#exposureinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('exposureInfoChange')**.|
5958e41f4b71Sopenharmony_ci
5959e41f4b71Sopenharmony_ci**Error codes**
5960e41f4b71Sopenharmony_ci
5961e41f4b71Sopenharmony_ci| ID| Error Message                    |
5962e41f4b71Sopenharmony_ci| ------- | ---------------------- |
5963e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5964e41f4b71Sopenharmony_ci
5965e41f4b71Sopenharmony_ci**Example**
5966e41f4b71Sopenharmony_ci
5967e41f4b71Sopenharmony_ci```ts
5968e41f4b71Sopenharmony_cifunction unregisterExposureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5969e41f4b71Sopenharmony_ci  professionalPhotoSession.off('exposureInfoChange');
5970e41f4b71Sopenharmony_ci}
5971e41f4b71Sopenharmony_ci```
5972e41f4b71Sopenharmony_ci
5973e41f4b71Sopenharmony_ci### on('apertureInfoChange')<sup>12+</sup>
5974e41f4b71Sopenharmony_ci
5975e41f4b71Sopenharmony_cion(type: 'apertureInfoChange', callback: AsyncCallback\<[ApertureInfo](js-apis-camera-sys.md#apertureinfo12)\>): void
5976e41f4b71Sopenharmony_ci
5977e41f4b71Sopenharmony_ciSubscribes to aperture change events to obtain the real-time aperture information. This API uses an asynchronous callback to return the result.
5978e41f4b71Sopenharmony_ci
5979e41f4b71Sopenharmony_ci**System API**: This is a system API.
5980e41f4b71Sopenharmony_ci
5981e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
5982e41f4b71Sopenharmony_ci
5983e41f4b71Sopenharmony_ci**Parameters**
5984e41f4b71Sopenharmony_ci
5985e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
5986e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
5987e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'apertureInfoChange'**.        |
5988e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ApertureInfo](js-apis-camera-sys.md#apertureinfo12)\>| Yes  | Callback used to return the aperture information.        |
5989e41f4b71Sopenharmony_ci
5990e41f4b71Sopenharmony_ci**Error codes**
5991e41f4b71Sopenharmony_ci
5992e41f4b71Sopenharmony_ci| ID| Error Message                    |
5993e41f4b71Sopenharmony_ci| ------- | ---------------------- |
5994e41f4b71Sopenharmony_ci| 202     | Not System Application. |
5995e41f4b71Sopenharmony_ci
5996e41f4b71Sopenharmony_ci**Example**
5997e41f4b71Sopenharmony_ci
5998e41f4b71Sopenharmony_ci```ts
5999e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6000e41f4b71Sopenharmony_ci
6001e41f4b71Sopenharmony_cifunction apertureInfoCallback(err: BusinessError, info: camera.ApertureInfo): void {
6002e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6003e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6004e41f4b71Sopenharmony_ci    return;
6005e41f4b71Sopenharmony_ci  }
6006e41f4b71Sopenharmony_ci  console.log(`Aperture value: ${info.aperture}`);
6007e41f4b71Sopenharmony_ci}
6008e41f4b71Sopenharmony_ci
6009e41f4b71Sopenharmony_cifunction registerApertureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6010e41f4b71Sopenharmony_ci  professionalPhotoSession.on('apertureInfoChange', apertureInfoCallback);
6011e41f4b71Sopenharmony_ci}
6012e41f4b71Sopenharmony_ci```
6013e41f4b71Sopenharmony_ci
6014e41f4b71Sopenharmony_ci### off('apertureInfoChange')<sup>12+</sup>
6015e41f4b71Sopenharmony_ci
6016e41f4b71Sopenharmony_cioff(type: 'apertureInfoChange', callback?: AsyncCallback\<[ApertureInfo](js-apis-camera-sys.md#apertureinfo12)\>): void
6017e41f4b71Sopenharmony_ci
6018e41f4b71Sopenharmony_ciUnsubscribes from aperture change events.
6019e41f4b71Sopenharmony_ci
6020e41f4b71Sopenharmony_ci**System API**: This is a system API.
6021e41f4b71Sopenharmony_ci
6022e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6023e41f4b71Sopenharmony_ci
6024e41f4b71Sopenharmony_ci**Parameters**
6025e41f4b71Sopenharmony_ci
6026e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6027e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6028e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'apertureInfoChange'**.        |
6029e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ApertureInfo](js-apis-camera-sys.md#apertureinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('apertureInfoChange')**.|
6030e41f4b71Sopenharmony_ci
6031e41f4b71Sopenharmony_ci**Error codes**
6032e41f4b71Sopenharmony_ci
6033e41f4b71Sopenharmony_ci| ID| Error Message                    |
6034e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6035e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6036e41f4b71Sopenharmony_ci
6037e41f4b71Sopenharmony_ci**Example**
6038e41f4b71Sopenharmony_ci
6039e41f4b71Sopenharmony_ci```ts
6040e41f4b71Sopenharmony_cifunction unregisterApertureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6041e41f4b71Sopenharmony_ci  professionalPhotoSession.off('apertureInfoChange');
6042e41f4b71Sopenharmony_ci}
6043e41f4b71Sopenharmony_ci```
6044e41f4b71Sopenharmony_ci
6045e41f4b71Sopenharmony_ci### on('luminationInfoChange')<sup>12+</sup>
6046e41f4b71Sopenharmony_ci
6047e41f4b71Sopenharmony_cion(type: 'luminationInfoChange', callback: AsyncCallback\<[LuminationInfo](js-apis-camera-sys.md#luminationinfo12)\>): void
6048e41f4b71Sopenharmony_ci
6049e41f4b71Sopenharmony_ciSubscribes to illumination change events to obtain real-time illumination information. This API uses an asynchronous callback to return the result.
6050e41f4b71Sopenharmony_ci
6051e41f4b71Sopenharmony_ci**System API**: This is a system API.
6052e41f4b71Sopenharmony_ci
6053e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6054e41f4b71Sopenharmony_ci
6055e41f4b71Sopenharmony_ci**Parameters**
6056e41f4b71Sopenharmony_ci
6057e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6058e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6059e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
6060e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[LuminationInfo](js-apis-camera-sys.md#luminationinfo12)\>| Yes  | Callback used to return the illumination information.        |
6061e41f4b71Sopenharmony_ci
6062e41f4b71Sopenharmony_ci**Error codes**
6063e41f4b71Sopenharmony_ci
6064e41f4b71Sopenharmony_ci| ID| Error Message                    |
6065e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6066e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6067e41f4b71Sopenharmony_ci
6068e41f4b71Sopenharmony_ci**Example**
6069e41f4b71Sopenharmony_ci
6070e41f4b71Sopenharmony_ci```ts
6071e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6072e41f4b71Sopenharmony_ci
6073e41f4b71Sopenharmony_cifunction luminationInfoCallback(err: BusinessError, info: camera.LuminationInfo): void {
6074e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6075e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6076e41f4b71Sopenharmony_ci    return;
6077e41f4b71Sopenharmony_ci  }
6078e41f4b71Sopenharmony_ci  console.log(`Lumination: ${info.lumination}`);
6079e41f4b71Sopenharmony_ci}
6080e41f4b71Sopenharmony_ci
6081e41f4b71Sopenharmony_cifunction registerLuminationInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6082e41f4b71Sopenharmony_ci  professionalPhotoSession.on('luminationInfoChange', luminationInfoCallback);
6083e41f4b71Sopenharmony_ci}
6084e41f4b71Sopenharmony_ci```
6085e41f4b71Sopenharmony_ci
6086e41f4b71Sopenharmony_ci### off('luminationInfoChange')<sup>12+</sup>
6087e41f4b71Sopenharmony_ci
6088e41f4b71Sopenharmony_cioff(type: 'luminationInfoChange', callback?: AsyncCallback\<[LuminationInfo](js-apis-camera-sys.md#luminationinfo12)\>): void
6089e41f4b71Sopenharmony_ci
6090e41f4b71Sopenharmony_ciUnsubscribes from illumination change events.
6091e41f4b71Sopenharmony_ci
6092e41f4b71Sopenharmony_ci**System API**: This is a system API.
6093e41f4b71Sopenharmony_ci
6094e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6095e41f4b71Sopenharmony_ci
6096e41f4b71Sopenharmony_ci**Parameters**
6097e41f4b71Sopenharmony_ci
6098e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6099e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6100e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
6101e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[LuminationInfo](js-apis-camera-sys.md#luminationinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('luminationInfoChange')**.|
6102e41f4b71Sopenharmony_ci
6103e41f4b71Sopenharmony_ci**Error codes**
6104e41f4b71Sopenharmony_ci
6105e41f4b71Sopenharmony_ci| ID| Error Message                    |
6106e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6107e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6108e41f4b71Sopenharmony_ci
6109e41f4b71Sopenharmony_ci**Example**
6110e41f4b71Sopenharmony_ci
6111e41f4b71Sopenharmony_ci```ts
6112e41f4b71Sopenharmony_cifunction unregisterLuminationInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6113e41f4b71Sopenharmony_ci  professionalPhotoSession.off('luminationInfoChange');
6114e41f4b71Sopenharmony_ci}
6115e41f4b71Sopenharmony_ci```
6116e41f4b71Sopenharmony_ci
6117e41f4b71Sopenharmony_ci## ProfessionalVideoSession<sup>12+</sup>
6118e41f4b71Sopenharmony_ci
6119e41f4b71Sopenharmony_ciProfessionalVideoSession extends Session, AutoExposure, ManualExposure, Focus, ManualFocus, WhiteBalance, ManualIso, Flash, Zoom, ColorEffect, Aperture
6120e41f4b71Sopenharmony_ci
6121e41f4b71Sopenharmony_ciImplements a professional video session, which sets the parameters of the professional video mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session12).
6122e41f4b71Sopenharmony_ci
6123e41f4b71Sopenharmony_ci### on('error')<sup>12+</sup>
6124e41f4b71Sopenharmony_ci
6125e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
6126e41f4b71Sopenharmony_ci
6127e41f4b71Sopenharmony_ciSubscribes to **ProfessionalVideo** error events. This API uses an asynchronous callback to return the result.
6128e41f4b71Sopenharmony_ci
6129e41f4b71Sopenharmony_ci**System API**: This is a system API.
6130e41f4b71Sopenharmony_ci
6131e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6132e41f4b71Sopenharmony_ci
6133e41f4b71Sopenharmony_ci**Parameters**
6134e41f4b71Sopenharmony_ci
6135e41f4b71Sopenharmony_ci| Name    | Type                                                         | Mandatory| Description                          |
6136e41f4b71Sopenharmony_ci| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
6137e41f4b71Sopenharmony_ci| type     | string                                                      | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as [beginConfig](js-apis-camera.md#beginconfig11), [commitConfig](js-apis-camera.md#commitconfig11-1), and [addInput](js-apis-camera.md#addinput11).|
6138e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).|
6139e41f4b71Sopenharmony_ci
6140e41f4b71Sopenharmony_ci**Error codes**
6141e41f4b71Sopenharmony_ci
6142e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6143e41f4b71Sopenharmony_ci
6144e41f4b71Sopenharmony_ci| ID  | Error Message       |
6145e41f4b71Sopenharmony_ci|---------| --------------- |
6146e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
6147e41f4b71Sopenharmony_ci
6148e41f4b71Sopenharmony_ci**Example**
6149e41f4b71Sopenharmony_ci
6150e41f4b71Sopenharmony_ci```ts
6151e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6152e41f4b71Sopenharmony_ci
6153e41f4b71Sopenharmony_cifunction callback(err: BusinessError): void {
6154e41f4b71Sopenharmony_ci  console.error(`Professional video session error code: ${err.code}`);
6155e41f4b71Sopenharmony_ci}
6156e41f4b71Sopenharmony_ci
6157e41f4b71Sopenharmony_cifunction registerSessionError(professionalVideoSession: camera.ProfessionalVideoSession): void {
6158e41f4b71Sopenharmony_ci  professionalVideoSession.on('error', callback);
6159e41f4b71Sopenharmony_ci}
6160e41f4b71Sopenharmony_ci```
6161e41f4b71Sopenharmony_ci
6162e41f4b71Sopenharmony_ci### off('error')<sup>12+</sup>
6163e41f4b71Sopenharmony_ci
6164e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
6165e41f4b71Sopenharmony_ci
6166e41f4b71Sopenharmony_ciUnsubscribes from **ProfessionalVideo** error events.
6167e41f4b71Sopenharmony_ci
6168e41f4b71Sopenharmony_ci**System API**: This is a system API.
6169e41f4b71Sopenharmony_ci
6170e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6171e41f4b71Sopenharmony_ci
6172e41f4b71Sopenharmony_ci**Parameters**
6173e41f4b71Sopenharmony_ci
6174e41f4b71Sopenharmony_ci| Name    | Type                       | Mandatory| Description                          |
6175e41f4b71Sopenharmony_ci| -------- | ------------------------ | ---- | ------------------------------ |
6176e41f4b71Sopenharmony_ci| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
6177e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| No  | Callback, which is optional. If a callback function is passed in, it is an anonymous function.      |
6178e41f4b71Sopenharmony_ci
6179e41f4b71Sopenharmony_ci**Error codes**
6180e41f4b71Sopenharmony_ci
6181e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6182e41f4b71Sopenharmony_ci
6183e41f4b71Sopenharmony_ci| ID  | Error Message       |
6184e41f4b71Sopenharmony_ci|---------| --------------- |
6185e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
6186e41f4b71Sopenharmony_ci
6187e41f4b71Sopenharmony_ci**Example**
6188e41f4b71Sopenharmony_ci
6189e41f4b71Sopenharmony_ci```ts
6190e41f4b71Sopenharmony_cifunction unregisterSessionError(professionalVideoSession: camera.ProfessionalVideoSession): void {
6191e41f4b71Sopenharmony_ci  professionalVideoSession.off('error');
6192e41f4b71Sopenharmony_ci}
6193e41f4b71Sopenharmony_ci```
6194e41f4b71Sopenharmony_ci
6195e41f4b71Sopenharmony_ci### on('focusStateChange')<sup>12+</sup>
6196e41f4b71Sopenharmony_ci
6197e41f4b71Sopenharmony_cion(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
6198e41f4b71Sopenharmony_ci
6199e41f4b71Sopenharmony_ciSubscribes to focus state change events. This API uses an asynchronous callback to return the result.
6200e41f4b71Sopenharmony_ci
6201e41f4b71Sopenharmony_ci**System API**: This is a system API.
6202e41f4b71Sopenharmony_ci
6203e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6204e41f4b71Sopenharmony_ci
6205e41f4b71Sopenharmony_ci**Parameters**
6206e41f4b71Sopenharmony_ci
6207e41f4b71Sopenharmony_ci| Name    | Type                   | Mandatory| Description                      |
6208e41f4b71Sopenharmony_ci| -------- | ---------------- | ---- | ------------------------ |
6209e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.|
6210e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
6211e41f4b71Sopenharmony_ci
6212e41f4b71Sopenharmony_ci**Error codes**
6213e41f4b71Sopenharmony_ci
6214e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6215e41f4b71Sopenharmony_ci
6216e41f4b71Sopenharmony_ci| ID  | Error Message       |
6217e41f4b71Sopenharmony_ci|---------| --------------- |
6218e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
6219e41f4b71Sopenharmony_ci
6220e41f4b71Sopenharmony_ci**Example**
6221e41f4b71Sopenharmony_ci
6222e41f4b71Sopenharmony_ci```ts
6223e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6224e41f4b71Sopenharmony_ci
6225e41f4b71Sopenharmony_cifunction callback(err: BusinessError, focusState: camera.FocusState): void {
6226e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6227e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6228e41f4b71Sopenharmony_ci    return;
6229e41f4b71Sopenharmony_ci  }
6230e41f4b71Sopenharmony_ci  console.info(`Focus state: ${focusState}`);
6231e41f4b71Sopenharmony_ci}
6232e41f4b71Sopenharmony_ci
6233e41f4b71Sopenharmony_cifunction registerFocusStateChange(professionalVideoSession: camera.ProfessionalVideoSession): void {
6234e41f4b71Sopenharmony_ci  professionalVideoSession.on('focusStateChange', callback);
6235e41f4b71Sopenharmony_ci}
6236e41f4b71Sopenharmony_ci```
6237e41f4b71Sopenharmony_ci
6238e41f4b71Sopenharmony_ci### off('focusStateChange')<sup>12+</sup>
6239e41f4b71Sopenharmony_ci
6240e41f4b71Sopenharmony_cioff(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
6241e41f4b71Sopenharmony_ci
6242e41f4b71Sopenharmony_ciUnsubscribes from focus state change events.
6243e41f4b71Sopenharmony_ci
6244e41f4b71Sopenharmony_ci**System API**: This is a system API.
6245e41f4b71Sopenharmony_ci
6246e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6247e41f4b71Sopenharmony_ci
6248e41f4b71Sopenharmony_ci**Parameters**
6249e41f4b71Sopenharmony_ci
6250e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
6251e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
6252e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
6253e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('focusStateChange')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
6254e41f4b71Sopenharmony_ci
6255e41f4b71Sopenharmony_ci**Error codes**
6256e41f4b71Sopenharmony_ci
6257e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6258e41f4b71Sopenharmony_ci
6259e41f4b71Sopenharmony_ci| ID  | Error Message       |
6260e41f4b71Sopenharmony_ci|---------| --------------- |
6261e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
6262e41f4b71Sopenharmony_ci
6263e41f4b71Sopenharmony_ci**Example**
6264e41f4b71Sopenharmony_ci
6265e41f4b71Sopenharmony_ci```ts
6266e41f4b71Sopenharmony_cifunction unregisterFocusStateChange(professionalVideoSession: camera.ProfessionalVideoSession): void {
6267e41f4b71Sopenharmony_ci  professionalVideoSession.off('focusStateChange');
6268e41f4b71Sopenharmony_ci}
6269e41f4b71Sopenharmony_ci```
6270e41f4b71Sopenharmony_ci
6271e41f4b71Sopenharmony_ci### on('smoothZoomInfoAvailable')<sup>12+</sup>
6272e41f4b71Sopenharmony_ci
6273e41f4b71Sopenharmony_cion(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
6274e41f4b71Sopenharmony_ci
6275e41f4b71Sopenharmony_ciSubscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
6276e41f4b71Sopenharmony_ci
6277e41f4b71Sopenharmony_ci**System API**: This is a system API.
6278e41f4b71Sopenharmony_ci
6279e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6280e41f4b71Sopenharmony_ci
6281e41f4b71Sopenharmony_ci**Parameters**
6282e41f4b71Sopenharmony_ci
6283e41f4b71Sopenharmony_ci| Name    | Type                  | Mandatory| Description                      |
6284e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------------ |
6285e41f4b71Sopenharmony_ci| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
6286e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
6287e41f4b71Sopenharmony_ci
6288e41f4b71Sopenharmony_ci**Error codes**
6289e41f4b71Sopenharmony_ci
6290e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6291e41f4b71Sopenharmony_ci
6292e41f4b71Sopenharmony_ci| ID  | Error Message       |
6293e41f4b71Sopenharmony_ci|---------| --------------- |
6294e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
6295e41f4b71Sopenharmony_ci
6296e41f4b71Sopenharmony_ci**Example**
6297e41f4b71Sopenharmony_ci
6298e41f4b71Sopenharmony_ci```ts
6299e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6300e41f4b71Sopenharmony_ci
6301e41f4b71Sopenharmony_cifunction callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
6302e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6303e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6304e41f4b71Sopenharmony_ci    return;
6305e41f4b71Sopenharmony_ci  }
6306e41f4b71Sopenharmony_ci  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
6307e41f4b71Sopenharmony_ci}
6308e41f4b71Sopenharmony_ci
6309e41f4b71Sopenharmony_cifunction registerSmoothZoomInfo(professionalVideoSession: camera.ProfessionalVideoSession): void {
6310e41f4b71Sopenharmony_ci  professionalVideoSession.on('smoothZoomInfoAvailable', callback);
6311e41f4b71Sopenharmony_ci}
6312e41f4b71Sopenharmony_ci```
6313e41f4b71Sopenharmony_ci
6314e41f4b71Sopenharmony_ci### off('smoothZoomInfoAvailable')<sup>12+</sup>
6315e41f4b71Sopenharmony_ci
6316e41f4b71Sopenharmony_cioff(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
6317e41f4b71Sopenharmony_ci
6318e41f4b71Sopenharmony_ciUnsubscribes from smooth zoom state change events.
6319e41f4b71Sopenharmony_ci
6320e41f4b71Sopenharmony_ci**System API**: This is a system API.
6321e41f4b71Sopenharmony_ci
6322e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6323e41f4b71Sopenharmony_ci
6324e41f4b71Sopenharmony_ci**Parameters**
6325e41f4b71Sopenharmony_ci
6326e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
6327e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
6328e41f4b71Sopenharmony_ci| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
6329e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('smoothZoomInfoAvailable')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
6330e41f4b71Sopenharmony_ci
6331e41f4b71Sopenharmony_ci**Error codes**
6332e41f4b71Sopenharmony_ci
6333e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6334e41f4b71Sopenharmony_ci
6335e41f4b71Sopenharmony_ci| ID  | Error Message       |
6336e41f4b71Sopenharmony_ci|---------| --------------- |
6337e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
6338e41f4b71Sopenharmony_ci
6339e41f4b71Sopenharmony_ci**Example**
6340e41f4b71Sopenharmony_ci
6341e41f4b71Sopenharmony_ci```ts
6342e41f4b71Sopenharmony_cifunction unregisterSmoothZoomInfo(professionalVideoSession: camera.ProfessionalVideoSession): void {
6343e41f4b71Sopenharmony_ci  professionalVideoSession.off('smoothZoomInfoAvailable');
6344e41f4b71Sopenharmony_ci}
6345e41f4b71Sopenharmony_ci```
6346e41f4b71Sopenharmony_ci
6347e41f4b71Sopenharmony_ci### on('isoInfoChange')<sup>12+</sup>
6348e41f4b71Sopenharmony_ci
6349e41f4b71Sopenharmony_cion(type: 'isoInfoChange', callback: AsyncCallback\<[IsoInfo](js-apis-camera-sys.md#isoinfo12)\>): void
6350e41f4b71Sopenharmony_ci
6351e41f4b71Sopenharmony_ciSubscribes to automatic ISO change events to obtain real-time ISO information. This API uses an asynchronous callback to return the result.
6352e41f4b71Sopenharmony_ci
6353e41f4b71Sopenharmony_ci**System API**: This is a system API.
6354e41f4b71Sopenharmony_ci
6355e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6356e41f4b71Sopenharmony_ci
6357e41f4b71Sopenharmony_ci**Parameters**
6358e41f4b71Sopenharmony_ci
6359e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6360e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6361e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
6362e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[IsoInfo](js-apis-camera-sys.md#isoinfo12)\>| Yes  | Callback used to return the ISO information.        |
6363e41f4b71Sopenharmony_ci
6364e41f4b71Sopenharmony_ci**Error codes**
6365e41f4b71Sopenharmony_ci
6366e41f4b71Sopenharmony_ci| ID| Error Message                    |
6367e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6368e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6369e41f4b71Sopenharmony_ci
6370e41f4b71Sopenharmony_ci**Example**
6371e41f4b71Sopenharmony_ci
6372e41f4b71Sopenharmony_ci```ts
6373e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6374e41f4b71Sopenharmony_ci
6375e41f4b71Sopenharmony_cifunction isoInfoCallback(err: BusinessError, info: camera.IsoInfo): void {
6376e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6377e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6378e41f4b71Sopenharmony_ci    return;
6379e41f4b71Sopenharmony_ci  }
6380e41f4b71Sopenharmony_ci  console.log(`ISO value: ${info.iso}`);
6381e41f4b71Sopenharmony_ci}
6382e41f4b71Sopenharmony_ci
6383e41f4b71Sopenharmony_cifunction registerIsoInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6384e41f4b71Sopenharmony_ci  professionalVideoSession.on('isoInfoChange', isoInfoCallback);
6385e41f4b71Sopenharmony_ci}
6386e41f4b71Sopenharmony_ci```
6387e41f4b71Sopenharmony_ci
6388e41f4b71Sopenharmony_ci### off('isoInfoChange')<sup>12+</sup>
6389e41f4b71Sopenharmony_ci
6390e41f4b71Sopenharmony_cioff(type: 'isoInfoChange', callback?: AsyncCallback\<[IsoInfo](js-apis-camera-sys.md#isoinfo12)\>): void
6391e41f4b71Sopenharmony_ci
6392e41f4b71Sopenharmony_ciUnsubscribes from automatic ISO change events.
6393e41f4b71Sopenharmony_ci
6394e41f4b71Sopenharmony_ci**System API**: This is a system API.
6395e41f4b71Sopenharmony_ci
6396e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6397e41f4b71Sopenharmony_ci
6398e41f4b71Sopenharmony_ci**Parameters**
6399e41f4b71Sopenharmony_ci
6400e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6401e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6402e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
6403e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[IsoInfo](js-apis-camera-sys.md#isoinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('isoInfoChange')**.|
6404e41f4b71Sopenharmony_ci
6405e41f4b71Sopenharmony_ci**Error codes**
6406e41f4b71Sopenharmony_ci
6407e41f4b71Sopenharmony_ci| ID| Error Message                    |
6408e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6409e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6410e41f4b71Sopenharmony_ci
6411e41f4b71Sopenharmony_ci**Example**
6412e41f4b71Sopenharmony_ci
6413e41f4b71Sopenharmony_ci```ts
6414e41f4b71Sopenharmony_cifunction unregisterIsoInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6415e41f4b71Sopenharmony_ci  professionalVideoSession.off('isoInfoChange');
6416e41f4b71Sopenharmony_ci}
6417e41f4b71Sopenharmony_ci```
6418e41f4b71Sopenharmony_ci
6419e41f4b71Sopenharmony_ci### on('exposureInfoChange')<sup>12+</sup>
6420e41f4b71Sopenharmony_ci
6421e41f4b71Sopenharmony_cion(type: 'exposureInfoChange', callback: AsyncCallback\<[ExposureInfo]((js-apis-camera-sys.md#exposureinfo12))\>): void
6422e41f4b71Sopenharmony_ci
6423e41f4b71Sopenharmony_ciSubscribes to exposure information change events to obtain the exposure information. This API uses an asynchronous callback to return the result.
6424e41f4b71Sopenharmony_ci
6425e41f4b71Sopenharmony_ci**System API**: This is a system API.
6426e41f4b71Sopenharmony_ci
6427e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6428e41f4b71Sopenharmony_ci
6429e41f4b71Sopenharmony_ci**Parameters**
6430e41f4b71Sopenharmony_ci
6431e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6432e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6433e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
6434e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ExposureInfo]((js-apis-camera-sys.md#exposureinfo12))\>| Yes  | Callback used to return the exposure information.        |
6435e41f4b71Sopenharmony_ci
6436e41f4b71Sopenharmony_ci**Error codes**
6437e41f4b71Sopenharmony_ci
6438e41f4b71Sopenharmony_ci| ID| Error Message                    |
6439e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6440e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6441e41f4b71Sopenharmony_ci
6442e41f4b71Sopenharmony_ci**Example**
6443e41f4b71Sopenharmony_ci
6444e41f4b71Sopenharmony_ci```ts
6445e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6446e41f4b71Sopenharmony_ci
6447e41f4b71Sopenharmony_cifunction exposureInfoCallback(err: BusinessError, info: camera.ExposureInfo): void {
6448e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6449e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6450e41f4b71Sopenharmony_ci    return;
6451e41f4b71Sopenharmony_ci  }
6452e41f4b71Sopenharmony_ci  console.log(`exposureTimeValue: ${info.exposureTime}`);
6453e41f4b71Sopenharmony_ci}
6454e41f4b71Sopenharmony_ci
6455e41f4b71Sopenharmony_cifunction registerExposureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6456e41f4b71Sopenharmony_ci  professionalVideoSession.on('exposureInfoChange', exposureInfoCallback);
6457e41f4b71Sopenharmony_ci}
6458e41f4b71Sopenharmony_ci```
6459e41f4b71Sopenharmony_ci
6460e41f4b71Sopenharmony_ci### off('exposureInfoChange')<sup>12+</sup>
6461e41f4b71Sopenharmony_ci
6462e41f4b71Sopenharmony_cioff(type: 'exposureInfoChange', callback?: AsyncCallback\<[ExposureInfo]((js-apis-camera-sys.md#exposureinfo12))\>): void
6463e41f4b71Sopenharmony_ci
6464e41f4b71Sopenharmony_ciUnsubscribes from exposure information change events.
6465e41f4b71Sopenharmony_ci
6466e41f4b71Sopenharmony_ci**System API**: This is a system API.
6467e41f4b71Sopenharmony_ci
6468e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6469e41f4b71Sopenharmony_ci
6470e41f4b71Sopenharmony_ci**Parameters**
6471e41f4b71Sopenharmony_ci
6472e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6473e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6474e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
6475e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ExposureInfo](js-apis-camera-sys.md#exposureinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('exposureInfoChange')**.|
6476e41f4b71Sopenharmony_ci
6477e41f4b71Sopenharmony_ci**Error codes**
6478e41f4b71Sopenharmony_ci
6479e41f4b71Sopenharmony_ci| ID| Error Message                    |
6480e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6481e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6482e41f4b71Sopenharmony_ci
6483e41f4b71Sopenharmony_ci**Example**
6484e41f4b71Sopenharmony_ci
6485e41f4b71Sopenharmony_ci```ts
6486e41f4b71Sopenharmony_cifunction unregisterExposureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6487e41f4b71Sopenharmony_ci  professionalVideoSession.off('exposureInfoChange');
6488e41f4b71Sopenharmony_ci}
6489e41f4b71Sopenharmony_ci```
6490e41f4b71Sopenharmony_ci
6491e41f4b71Sopenharmony_ci### on('apertureInfoChange')<sup>12+</sup>
6492e41f4b71Sopenharmony_ci
6493e41f4b71Sopenharmony_cion(type: 'apertureInfoChange', callback: AsyncCallback\<[ApertureInfo](js-apis-camera-sys.md#apertureinfo12)\>): void
6494e41f4b71Sopenharmony_ci
6495e41f4b71Sopenharmony_ciSubscribes to aperture change events to obtain the aperture information. This API uses an asynchronous callback to return the result.
6496e41f4b71Sopenharmony_ci
6497e41f4b71Sopenharmony_ci**System API**: This is a system API.
6498e41f4b71Sopenharmony_ci
6499e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6500e41f4b71Sopenharmony_ci
6501e41f4b71Sopenharmony_ci**Parameters**
6502e41f4b71Sopenharmony_ci
6503e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6504e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6505e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'apertureInfoChange'**.        |
6506e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ApertureInfo](js-apis-camera-sys.md#apertureinfo12)\>| Yes  | Callback used to return the aperture information.        |
6507e41f4b71Sopenharmony_ci
6508e41f4b71Sopenharmony_ci**Error codes**
6509e41f4b71Sopenharmony_ci
6510e41f4b71Sopenharmony_ci| ID| Error Message                    |
6511e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6512e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6513e41f4b71Sopenharmony_ci
6514e41f4b71Sopenharmony_ci**Example**
6515e41f4b71Sopenharmony_ci
6516e41f4b71Sopenharmony_ci```ts
6517e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6518e41f4b71Sopenharmony_ci
6519e41f4b71Sopenharmony_cifunction apertureInfoCallback(err: BusinessError, info: camera.ApertureInfo): void {
6520e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6521e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6522e41f4b71Sopenharmony_ci    return;
6523e41f4b71Sopenharmony_ci  }
6524e41f4b71Sopenharmony_ci  console.log(`Aperture value: ${info.aperture}`);
6525e41f4b71Sopenharmony_ci}
6526e41f4b71Sopenharmony_ci
6527e41f4b71Sopenharmony_cifunction registerApertureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6528e41f4b71Sopenharmony_ci  professionalVideoSession.on('apertureInfoChange', apertureInfoCallback);
6529e41f4b71Sopenharmony_ci}
6530e41f4b71Sopenharmony_ci```
6531e41f4b71Sopenharmony_ci
6532e41f4b71Sopenharmony_ci### off('apertureInfoChange')<sup>12+</sup>
6533e41f4b71Sopenharmony_ci
6534e41f4b71Sopenharmony_cioff(type: 'apertureInfoChange', callback?: AsyncCallback\<[ApertureInfo](js-apis-camera-sys.md#apertureinfo12)\>): void
6535e41f4b71Sopenharmony_ci
6536e41f4b71Sopenharmony_ciUnsubscribes from aperture change events.
6537e41f4b71Sopenharmony_ci
6538e41f4b71Sopenharmony_ci**System API**: This is a system API.
6539e41f4b71Sopenharmony_ci
6540e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6541e41f4b71Sopenharmony_ci
6542e41f4b71Sopenharmony_ci**Parameters**
6543e41f4b71Sopenharmony_ci
6544e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6545e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6546e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'apertureInfoChange'**.        |
6547e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ApertureInfo](js-apis-camera-sys.md#apertureinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('apertureInfoChange')**.|
6548e41f4b71Sopenharmony_ci
6549e41f4b71Sopenharmony_ci**Error codes**
6550e41f4b71Sopenharmony_ci
6551e41f4b71Sopenharmony_ci| ID| Error Message                    |
6552e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6553e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6554e41f4b71Sopenharmony_ci
6555e41f4b71Sopenharmony_ci**Example**
6556e41f4b71Sopenharmony_ci
6557e41f4b71Sopenharmony_ci```ts
6558e41f4b71Sopenharmony_cifunction unregisterApertureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6559e41f4b71Sopenharmony_ci  professionalVideoSession.off('apertureInfoChange');
6560e41f4b71Sopenharmony_ci}
6561e41f4b71Sopenharmony_ci```
6562e41f4b71Sopenharmony_ci
6563e41f4b71Sopenharmony_ci### on('luminationInfoChange')<sup>12+</sup>
6564e41f4b71Sopenharmony_ci
6565e41f4b71Sopenharmony_cion(type: 'luminationInfoChange', callback: AsyncCallback\<[LuminationInfo]((js-apis-camera-sys.md#luminationinfo12))\>): void
6566e41f4b71Sopenharmony_ci
6567e41f4b71Sopenharmony_ciSubscribes to illumination change events to obtain illumination information. This API uses an asynchronous callback to return the result.
6568e41f4b71Sopenharmony_ci
6569e41f4b71Sopenharmony_ci**System API**: This is a system API.
6570e41f4b71Sopenharmony_ci
6571e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6572e41f4b71Sopenharmony_ci
6573e41f4b71Sopenharmony_ci**Parameters**
6574e41f4b71Sopenharmony_ci
6575e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6576e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6577e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
6578e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[LuminationInfo]((js-apis-camera-sys.md#luminationinfo12))\>| Yes  | Callback used to return the illumination information.        |
6579e41f4b71Sopenharmony_ci
6580e41f4b71Sopenharmony_ci**Error codes**
6581e41f4b71Sopenharmony_ci
6582e41f4b71Sopenharmony_ci| ID| Error Message                    |
6583e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6584e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6585e41f4b71Sopenharmony_ci
6586e41f4b71Sopenharmony_ci**Example**
6587e41f4b71Sopenharmony_ci
6588e41f4b71Sopenharmony_ci```ts
6589e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6590e41f4b71Sopenharmony_ci
6591e41f4b71Sopenharmony_cifunction luminationInfoCallback(err: BusinessError, info: camera.LuminationInfo): void {
6592e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6593e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6594e41f4b71Sopenharmony_ci    return;
6595e41f4b71Sopenharmony_ci  }
6596e41f4b71Sopenharmony_ci  console.log(`Lumination: ${info.lumination}`);
6597e41f4b71Sopenharmony_ci}
6598e41f4b71Sopenharmony_ci
6599e41f4b71Sopenharmony_cifunction registerLuminationInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6600e41f4b71Sopenharmony_ci  professionalVideoSession.on('luminationInfoChange', luminationInfoCallback);
6601e41f4b71Sopenharmony_ci}
6602e41f4b71Sopenharmony_ci```
6603e41f4b71Sopenharmony_ci
6604e41f4b71Sopenharmony_ci### off('luminationInfoChange')<sup>12+</sup>
6605e41f4b71Sopenharmony_ci
6606e41f4b71Sopenharmony_cioff(type: 'luminationInfoChange', callback?: AsyncCallback\<[LuminationInfo]((js-apis-camera-sys.md#luminationinfo12))\>): void
6607e41f4b71Sopenharmony_ci
6608e41f4b71Sopenharmony_ciUnsubscribes from illumination change events.
6609e41f4b71Sopenharmony_ci
6610e41f4b71Sopenharmony_ci**System API**: This is a system API.
6611e41f4b71Sopenharmony_ci
6612e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6613e41f4b71Sopenharmony_ci
6614e41f4b71Sopenharmony_ci**Parameters**
6615e41f4b71Sopenharmony_ci
6616e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
6617e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6618e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
6619e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[LuminationInfo](js-apis-camera-sys.md#luminationinfo12))\>| No  | Callback, which is optional and is used to match **callback** in **on('luminationInfoChange')**.|
6620e41f4b71Sopenharmony_ci
6621e41f4b71Sopenharmony_ci**Error codes**
6622e41f4b71Sopenharmony_ci
6623e41f4b71Sopenharmony_ci| ID| Error Message                    |
6624e41f4b71Sopenharmony_ci| ------- | ---------------------- |
6625e41f4b71Sopenharmony_ci| 202     | Not System Application. |
6626e41f4b71Sopenharmony_ci
6627e41f4b71Sopenharmony_ci**Example**
6628e41f4b71Sopenharmony_ci
6629e41f4b71Sopenharmony_ci```ts
6630e41f4b71Sopenharmony_cifunction unregisterLuminationInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6631e41f4b71Sopenharmony_ci  professionalVideoSession.off('luminationInfoChange');
6632e41f4b71Sopenharmony_ci}
6633e41f4b71Sopenharmony_ci```
6634e41f4b71Sopenharmony_ci
6635e41f4b71Sopenharmony_ci## MacroPhotoSession<sup>12+</sup>
6636e41f4b71Sopenharmony_ci
6637e41f4b71Sopenharmony_ciMacroPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ManualFocus
6638e41f4b71Sopenharmony_ci
6639e41f4b71Sopenharmony_ciImplements a macro photo session, which sets the parameters of the macro photo mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
6640e41f4b71Sopenharmony_ci
6641e41f4b71Sopenharmony_ci### on('error')<sup>12+</sup>
6642e41f4b71Sopenharmony_ci
6643e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
6644e41f4b71Sopenharmony_ci
6645e41f4b71Sopenharmony_ciSubscribes to **MacroPhotoSession** error events. This API uses an asynchronous callback to return the result.
6646e41f4b71Sopenharmony_ci
6647e41f4b71Sopenharmony_ci**System API**: This is a system API.
6648e41f4b71Sopenharmony_ci
6649e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6650e41f4b71Sopenharmony_ci
6651e41f4b71Sopenharmony_ci**Parameters**
6652e41f4b71Sopenharmony_ci
6653e41f4b71Sopenharmony_ci| Name     | Type                                                                       | Mandatory | Description                                                                                                                                                                     |
6654e41f4b71Sopenharmony_ci|----------|---------------------------------------------------------------------------|-----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
6655e41f4b71Sopenharmony_ci| type     | string                                                                    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as [beginConfig](js-apis-camera.md#beginconfig11), [commitConfig](js-apis-camera.md#commitconfig11-1), and [addInput](js-apis-camera.md#addinput11).|
6656e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).                                                                                                          |
6657e41f4b71Sopenharmony_ci
6658e41f4b71Sopenharmony_ci**Error codes**
6659e41f4b71Sopenharmony_ci
6660e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6661e41f4b71Sopenharmony_ci
6662e41f4b71Sopenharmony_ci| ID| Error Message                      |
6663e41f4b71Sopenharmony_ci|-------|----------------------------|
6664e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
6665e41f4b71Sopenharmony_ci
6666e41f4b71Sopenharmony_ci**Example**
6667e41f4b71Sopenharmony_ci
6668e41f4b71Sopenharmony_ci```ts
6669e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6670e41f4b71Sopenharmony_ci
6671e41f4b71Sopenharmony_cifunction callback(err: BusinessError): void {
6672e41f4b71Sopenharmony_ci  console.error(`MacroPhotoSession error code: ${err.code}`);
6673e41f4b71Sopenharmony_ci}
6674e41f4b71Sopenharmony_ci
6675e41f4b71Sopenharmony_cifunction registerSessionError(macroPhotoSession: camera.MacroPhotoSession): void {
6676e41f4b71Sopenharmony_ci  macroPhotoSession.on('error', callback);
6677e41f4b71Sopenharmony_ci}
6678e41f4b71Sopenharmony_ci```
6679e41f4b71Sopenharmony_ci
6680e41f4b71Sopenharmony_ci### off('error')<sup>12+</sup>
6681e41f4b71Sopenharmony_ci
6682e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
6683e41f4b71Sopenharmony_ci
6684e41f4b71Sopenharmony_ciUnsubscribes from **MacroPhotoSession** error events.
6685e41f4b71Sopenharmony_ci
6686e41f4b71Sopenharmony_ci**System API**: This is a system API.
6687e41f4b71Sopenharmony_ci
6688e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6689e41f4b71Sopenharmony_ci
6690e41f4b71Sopenharmony_ci**Parameters**
6691e41f4b71Sopenharmony_ci
6692e41f4b71Sopenharmony_ci| Name     | Type                                                                       | Mandatory| Description                                                         |
6693e41f4b71Sopenharmony_ci|----------|---------------------------------------------------------------------------|----|-------------------------------------------------------------|
6694e41f4b71Sopenharmony_ci| type     | string                                                                    | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.                       |
6695e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | No | Callback used to return the result. If this parameter is specified, the subscription to the specified event with the specified callback is canceled. (The callback object cannot be an anonymous function.) Otherwise, the subscriptions to the specified event with all the callbacks are canceled.|
6696e41f4b71Sopenharmony_ci
6697e41f4b71Sopenharmony_ci**Error codes**
6698e41f4b71Sopenharmony_ci
6699e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6700e41f4b71Sopenharmony_ci
6701e41f4b71Sopenharmony_ci| ID| Error Message                      |
6702e41f4b71Sopenharmony_ci|-------|----------------------------|
6703e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
6704e41f4b71Sopenharmony_ci
6705e41f4b71Sopenharmony_ci**Example**
6706e41f4b71Sopenharmony_ci
6707e41f4b71Sopenharmony_ci```ts
6708e41f4b71Sopenharmony_cifunction unregisterSessionError(macroPhotoSession: camera.MacroPhotoSession): void {
6709e41f4b71Sopenharmony_ci  macroPhotoSession.off('error');
6710e41f4b71Sopenharmony_ci}
6711e41f4b71Sopenharmony_ci```
6712e41f4b71Sopenharmony_ci
6713e41f4b71Sopenharmony_ci### on('focusStateChange')<sup>12+</sup>
6714e41f4b71Sopenharmony_ci
6715e41f4b71Sopenharmony_cion(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
6716e41f4b71Sopenharmony_ci
6717e41f4b71Sopenharmony_ciSubscribes to focus state change events. This API uses an asynchronous callback to return the result.
6718e41f4b71Sopenharmony_ci
6719e41f4b71Sopenharmony_ci**System API**: This is a system API.
6720e41f4b71Sopenharmony_ci
6721e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6722e41f4b71Sopenharmony_ci
6723e41f4b71Sopenharmony_ci**Parameters**
6724e41f4b71Sopenharmony_ci
6725e41f4b71Sopenharmony_ci| Name      | Type                                         | Mandatory| Description                                                                     |
6726e41f4b71Sopenharmony_ci|-----------|---------------------------------------------|----|-------------------------------------------------------------------------|
6727e41f4b71Sopenharmony_ci| type      | string                                      | Yes | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.|
6728e41f4b71Sopenharmony_ci| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | Yes | Callback used to return the focus state change.                                                       |
6729e41f4b71Sopenharmony_ci
6730e41f4b71Sopenharmony_ci**Error codes**
6731e41f4b71Sopenharmony_ci
6732e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6733e41f4b71Sopenharmony_ci
6734e41f4b71Sopenharmony_ci| ID| Error Message                      |
6735e41f4b71Sopenharmony_ci|-------|----------------------------|
6736e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
6737e41f4b71Sopenharmony_ci
6738e41f4b71Sopenharmony_ci**Example**
6739e41f4b71Sopenharmony_ci
6740e41f4b71Sopenharmony_ci```ts
6741e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6742e41f4b71Sopenharmony_ci
6743e41f4b71Sopenharmony_cifunction callback(err: BusinessError, focusState: camera.FocusState): void {
6744e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6745e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6746e41f4b71Sopenharmony_ci    return;
6747e41f4b71Sopenharmony_ci  }
6748e41f4b71Sopenharmony_ci  console.info(`Focus state: ${focusState}`);
6749e41f4b71Sopenharmony_ci}
6750e41f4b71Sopenharmony_ci
6751e41f4b71Sopenharmony_cifunction registerFocusStateChange(macroPhotoSession: camera.MacroPhotoSession): void {
6752e41f4b71Sopenharmony_ci  macroPhotoSession.on('focusStateChange', callback);
6753e41f4b71Sopenharmony_ci}
6754e41f4b71Sopenharmony_ci```
6755e41f4b71Sopenharmony_ci
6756e41f4b71Sopenharmony_ci### off('focusStateChange')<sup>12+</sup>
6757e41f4b71Sopenharmony_ci
6758e41f4b71Sopenharmony_cioff(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
6759e41f4b71Sopenharmony_ci
6760e41f4b71Sopenharmony_ciUnsubscribes from focus state change events.
6761e41f4b71Sopenharmony_ci
6762e41f4b71Sopenharmony_ci**System API**: This is a system API.
6763e41f4b71Sopenharmony_ci
6764e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6765e41f4b71Sopenharmony_ci
6766e41f4b71Sopenharmony_ci**Parameters**
6767e41f4b71Sopenharmony_ci
6768e41f4b71Sopenharmony_ci| Name      | Type                                         | Mandatory| Description                                                          |
6769e41f4b71Sopenharmony_ci|-----------|---------------------------------------------|----|--------------------------------------------------------------|
6770e41f4b71Sopenharmony_ci| type      | string                                      | Yes | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.                  |
6771e41f4b71Sopenharmony_ci| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | No | Callback used to return the result. If this parameter is specified, the subscription to the specified event with the specified callback is canceled. (The callback object cannot be an anonymous function.) Otherwise, the subscriptions to the specified event with all the callbacks are canceled. |
6772e41f4b71Sopenharmony_ci
6773e41f4b71Sopenharmony_ci**Error codes**
6774e41f4b71Sopenharmony_ci
6775e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6776e41f4b71Sopenharmony_ci
6777e41f4b71Sopenharmony_ci| ID| Error Message                      |
6778e41f4b71Sopenharmony_ci|-------|----------------------------|
6779e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
6780e41f4b71Sopenharmony_ci
6781e41f4b71Sopenharmony_ci**Example**
6782e41f4b71Sopenharmony_ci
6783e41f4b71Sopenharmony_ci```ts
6784e41f4b71Sopenharmony_cifunction unregisterFocusStateChange(macroPhotoSession: camera.MacroPhotoSession): void {
6785e41f4b71Sopenharmony_ci  macroPhotoSession.off('focusStateChange');
6786e41f4b71Sopenharmony_ci}
6787e41f4b71Sopenharmony_ci```
6788e41f4b71Sopenharmony_ci
6789e41f4b71Sopenharmony_ci### on('smoothZoomInfoAvailable')<sup>12+</sup>
6790e41f4b71Sopenharmony_ci
6791e41f4b71Sopenharmony_cion(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
6792e41f4b71Sopenharmony_ci
6793e41f4b71Sopenharmony_ciSubscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
6794e41f4b71Sopenharmony_ci
6795e41f4b71Sopenharmony_ci**System API**: This is a system API.
6796e41f4b71Sopenharmony_ci
6797e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6798e41f4b71Sopenharmony_ci
6799e41f4b71Sopenharmony_ci**Parameters**
6800e41f4b71Sopenharmony_ci
6801e41f4b71Sopenharmony_ci| Name    | Type                  | Mandatory| Description                      |
6802e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------------ |
6803e41f4b71Sopenharmony_ci| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
6804e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
6805e41f4b71Sopenharmony_ci
6806e41f4b71Sopenharmony_ci**Error codes**
6807e41f4b71Sopenharmony_ci
6808e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6809e41f4b71Sopenharmony_ci
6810e41f4b71Sopenharmony_ci| ID| Error Message                      |
6811e41f4b71Sopenharmony_ci|-------|----------------------------|
6812e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
6813e41f4b71Sopenharmony_ci
6814e41f4b71Sopenharmony_ci**Example**
6815e41f4b71Sopenharmony_ci
6816e41f4b71Sopenharmony_ci```ts
6817e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6818e41f4b71Sopenharmony_ci
6819e41f4b71Sopenharmony_cifunction callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
6820e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6821e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6822e41f4b71Sopenharmony_ci    return;
6823e41f4b71Sopenharmony_ci  }
6824e41f4b71Sopenharmony_ci  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
6825e41f4b71Sopenharmony_ci}
6826e41f4b71Sopenharmony_ci
6827e41f4b71Sopenharmony_cifunction registerSmoothZoomInfo(macroPhotoSession: camera.MacroPhotoSession): void {
6828e41f4b71Sopenharmony_ci  macroPhotoSession.on('smoothZoomInfoAvailable', callback);
6829e41f4b71Sopenharmony_ci}
6830e41f4b71Sopenharmony_ci```
6831e41f4b71Sopenharmony_ci
6832e41f4b71Sopenharmony_ci### off('smoothZoomInfoAvailable')<sup>12+</sup>
6833e41f4b71Sopenharmony_ci
6834e41f4b71Sopenharmony_cioff(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
6835e41f4b71Sopenharmony_ci
6836e41f4b71Sopenharmony_ciUnsubscribes from smooth zoom state change events.
6837e41f4b71Sopenharmony_ci
6838e41f4b71Sopenharmony_ci**System API**: This is a system API.
6839e41f4b71Sopenharmony_ci
6840e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6841e41f4b71Sopenharmony_ci
6842e41f4b71Sopenharmony_ci**Parameters**
6843e41f4b71Sopenharmony_ci
6844e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
6845e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
6846e41f4b71Sopenharmony_ci| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
6847e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | No  | Callback used to return the result. If this parameter is specified, the subscription to the specified event with the specified callback is canceled. (The callback object cannot be an anonymous function.) Otherwise, the subscriptions to the specified event with all the callbacks are canceled.|
6848e41f4b71Sopenharmony_ci
6849e41f4b71Sopenharmony_ci**Error codes**
6850e41f4b71Sopenharmony_ci
6851e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6852e41f4b71Sopenharmony_ci
6853e41f4b71Sopenharmony_ci| ID| Error Message                      |
6854e41f4b71Sopenharmony_ci|-------|----------------------------|
6855e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
6856e41f4b71Sopenharmony_ci
6857e41f4b71Sopenharmony_ci**Example**
6858e41f4b71Sopenharmony_ci
6859e41f4b71Sopenharmony_ci```ts
6860e41f4b71Sopenharmony_cifunction unregisterSmoothZoomInfo(macroPhotoSession: camera.MacroPhotoSession): void {
6861e41f4b71Sopenharmony_ci  macroPhotoSession.off('smoothZoomInfoAvailable');
6862e41f4b71Sopenharmony_ci}
6863e41f4b71Sopenharmony_ci```
6864e41f4b71Sopenharmony_ci
6865e41f4b71Sopenharmony_ci## MacroVideoSession<sup>12+</sup>
6866e41f4b71Sopenharmony_ci
6867e41f4b71Sopenharmony_ciMacroVideoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ManualFocus
6868e41f4b71Sopenharmony_ci
6869e41f4b71Sopenharmony_ciImplements a macro video session, which sets the parameters of the macro video mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session11).
6870e41f4b71Sopenharmony_ci
6871e41f4b71Sopenharmony_ci### on('error')<sup>12+</sup>
6872e41f4b71Sopenharmony_ci
6873e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
6874e41f4b71Sopenharmony_ci
6875e41f4b71Sopenharmony_ciSubscribes to **MacroVideoSession** error events. This API uses an asynchronous callback to return the result.
6876e41f4b71Sopenharmony_ci
6877e41f4b71Sopenharmony_ci**System API**: This is a system API.
6878e41f4b71Sopenharmony_ci
6879e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6880e41f4b71Sopenharmony_ci
6881e41f4b71Sopenharmony_ci**Parameters**
6882e41f4b71Sopenharmony_ci
6883e41f4b71Sopenharmony_ci| Name     | Type                                                                       | Mandatory | Description                                                                                                                                                                     |
6884e41f4b71Sopenharmony_ci|----------|---------------------------------------------------------------------------|-----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
6885e41f4b71Sopenharmony_ci| type     | string                                                                    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as [beginConfig](js-apis-camera.md#beginconfig11), [commitConfig](js-apis-camera.md#commitconfig11-1), and [addInput](js-apis-camera.md#addinput11).|
6886e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).                                                                                                          |
6887e41f4b71Sopenharmony_ci
6888e41f4b71Sopenharmony_ci**Error codes**
6889e41f4b71Sopenharmony_ci
6890e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6891e41f4b71Sopenharmony_ci
6892e41f4b71Sopenharmony_ci| ID| Error Message                      |
6893e41f4b71Sopenharmony_ci|-------|----------------------------|
6894e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
6895e41f4b71Sopenharmony_ci
6896e41f4b71Sopenharmony_ci**Example**
6897e41f4b71Sopenharmony_ci
6898e41f4b71Sopenharmony_ci```ts
6899e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6900e41f4b71Sopenharmony_ci
6901e41f4b71Sopenharmony_cifunction callback(err: BusinessError): void {
6902e41f4b71Sopenharmony_ci  console.error(`MacroPhotoSession error code: ${err.code}`);
6903e41f4b71Sopenharmony_ci}
6904e41f4b71Sopenharmony_ci
6905e41f4b71Sopenharmony_cifunction registerSessionError(macroVideoSession: camera.MacroVideoSession): void {
6906e41f4b71Sopenharmony_ci  macroVideoSession.on('error', callback);
6907e41f4b71Sopenharmony_ci}
6908e41f4b71Sopenharmony_ci```
6909e41f4b71Sopenharmony_ci
6910e41f4b71Sopenharmony_ci### off('error')<sup>12+</sup>
6911e41f4b71Sopenharmony_ci
6912e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
6913e41f4b71Sopenharmony_ci
6914e41f4b71Sopenharmony_ciUnsubscribes from **MacroVideoSession** error events.
6915e41f4b71Sopenharmony_ci
6916e41f4b71Sopenharmony_ci**System API**: This is a system API.
6917e41f4b71Sopenharmony_ci
6918e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6919e41f4b71Sopenharmony_ci
6920e41f4b71Sopenharmony_ci**Parameters**
6921e41f4b71Sopenharmony_ci
6922e41f4b71Sopenharmony_ci| Name     | Type                                                                       | Mandatory| Description                                                         |
6923e41f4b71Sopenharmony_ci|----------|---------------------------------------------------------------------------|----|-------------------------------------------------------------|
6924e41f4b71Sopenharmony_ci| type     | string                                                                    | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.                       |
6925e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | No | Callback used to return the result. If this parameter is specified, the subscription to the specified event with the specified callback is canceled. (The callback object cannot be an anonymous function.) Otherwise, the subscriptions to the specified event with all the callbacks are canceled.|
6926e41f4b71Sopenharmony_ci
6927e41f4b71Sopenharmony_ci**Error codes**
6928e41f4b71Sopenharmony_ci
6929e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6930e41f4b71Sopenharmony_ci
6931e41f4b71Sopenharmony_ci| ID| Error Message                      |
6932e41f4b71Sopenharmony_ci|-------|----------------------------|
6933e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
6934e41f4b71Sopenharmony_ci
6935e41f4b71Sopenharmony_ci**Example**
6936e41f4b71Sopenharmony_ci
6937e41f4b71Sopenharmony_ci```ts
6938e41f4b71Sopenharmony_cifunction unregisterSessionError(macroVideoSession: camera.MacroVideoSession): void {
6939e41f4b71Sopenharmony_ci  macroVideoSession.off('error');
6940e41f4b71Sopenharmony_ci}
6941e41f4b71Sopenharmony_ci```
6942e41f4b71Sopenharmony_ci
6943e41f4b71Sopenharmony_ci### on('focusStateChange')<sup>12+</sup>
6944e41f4b71Sopenharmony_ci
6945e41f4b71Sopenharmony_cion(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
6946e41f4b71Sopenharmony_ci
6947e41f4b71Sopenharmony_ciSubscribes to focus state change events. This API uses an asynchronous callback to return the result.
6948e41f4b71Sopenharmony_ci
6949e41f4b71Sopenharmony_ci**System API**: This is a system API.
6950e41f4b71Sopenharmony_ci
6951e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6952e41f4b71Sopenharmony_ci
6953e41f4b71Sopenharmony_ci**Parameters**
6954e41f4b71Sopenharmony_ci
6955e41f4b71Sopenharmony_ci| Name      | Type                                         | Mandatory| Description                                                                     |
6956e41f4b71Sopenharmony_ci|-----------|---------------------------------------------|----|-------------------------------------------------------------------------|
6957e41f4b71Sopenharmony_ci| type      | string                                      | Yes | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.|
6958e41f4b71Sopenharmony_ci| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | Yes | Callback used to return the focus state change.                                                       |
6959e41f4b71Sopenharmony_ci
6960e41f4b71Sopenharmony_ci**Error codes**
6961e41f4b71Sopenharmony_ci
6962e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6963e41f4b71Sopenharmony_ci
6964e41f4b71Sopenharmony_ci| ID| Error Message                      |
6965e41f4b71Sopenharmony_ci|-------|----------------------------|
6966e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
6967e41f4b71Sopenharmony_ci
6968e41f4b71Sopenharmony_ci**Example**
6969e41f4b71Sopenharmony_ci
6970e41f4b71Sopenharmony_ci```ts
6971e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
6972e41f4b71Sopenharmony_ci
6973e41f4b71Sopenharmony_cifunction callback(err: BusinessError, focusState: camera.FocusState): void {
6974e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
6975e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
6976e41f4b71Sopenharmony_ci    return;
6977e41f4b71Sopenharmony_ci  }
6978e41f4b71Sopenharmony_ci  console.info(`Focus state: ${focusState}`);
6979e41f4b71Sopenharmony_ci}
6980e41f4b71Sopenharmony_ci
6981e41f4b71Sopenharmony_cifunction registerFocusStateChange(macroVideoSession: camera.MacroVideoSession): void {
6982e41f4b71Sopenharmony_ci  macroVideoSession.on('focusStateChange', callback);
6983e41f4b71Sopenharmony_ci}
6984e41f4b71Sopenharmony_ci```
6985e41f4b71Sopenharmony_ci
6986e41f4b71Sopenharmony_ci### off('focusStateChange')<sup>12+</sup>
6987e41f4b71Sopenharmony_ci
6988e41f4b71Sopenharmony_cioff(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
6989e41f4b71Sopenharmony_ci
6990e41f4b71Sopenharmony_ciUnsubscribes from focus state change events.
6991e41f4b71Sopenharmony_ci
6992e41f4b71Sopenharmony_ci**System API**: This is a system API.
6993e41f4b71Sopenharmony_ci
6994e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
6995e41f4b71Sopenharmony_ci
6996e41f4b71Sopenharmony_ci**Parameters**
6997e41f4b71Sopenharmony_ci
6998e41f4b71Sopenharmony_ci| Name      | Type                                         | Mandatory| Description                                                          |
6999e41f4b71Sopenharmony_ci|-----------|---------------------------------------------|----|--------------------------------------------------------------|
7000e41f4b71Sopenharmony_ci| type      | string                                      | Yes | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.                  |
7001e41f4b71Sopenharmony_ci| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | No | Callback used to return the result. If this parameter is specified, the subscription to the specified event with the specified callback is canceled. (The callback object cannot be an anonymous function.) Otherwise, the subscriptions to the specified event with all the callbacks are canceled. |
7002e41f4b71Sopenharmony_ci
7003e41f4b71Sopenharmony_ci**Error codes**
7004e41f4b71Sopenharmony_ci
7005e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7006e41f4b71Sopenharmony_ci
7007e41f4b71Sopenharmony_ci| ID| Error Message                      |
7008e41f4b71Sopenharmony_ci|-------|----------------------------|
7009e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
7010e41f4b71Sopenharmony_ci
7011e41f4b71Sopenharmony_ci**Example**
7012e41f4b71Sopenharmony_ci
7013e41f4b71Sopenharmony_ci```ts
7014e41f4b71Sopenharmony_cifunction unregisterFocusStateChange(macroVideoSession: camera.MacroVideoSession): void {
7015e41f4b71Sopenharmony_ci  macroVideoSession.off('focusStateChange');
7016e41f4b71Sopenharmony_ci}
7017e41f4b71Sopenharmony_ci```
7018e41f4b71Sopenharmony_ci
7019e41f4b71Sopenharmony_ci### on('smoothZoomInfoAvailable')<sup>12+</sup>
7020e41f4b71Sopenharmony_ci
7021e41f4b71Sopenharmony_cion(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
7022e41f4b71Sopenharmony_ci
7023e41f4b71Sopenharmony_ciSubscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
7024e41f4b71Sopenharmony_ci
7025e41f4b71Sopenharmony_ci**System API**: This is a system API.
7026e41f4b71Sopenharmony_ci
7027e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7028e41f4b71Sopenharmony_ci
7029e41f4b71Sopenharmony_ci**Parameters**
7030e41f4b71Sopenharmony_ci
7031e41f4b71Sopenharmony_ci| Name    | Type                  | Mandatory| Description                      |
7032e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------------ |
7033e41f4b71Sopenharmony_ci| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
7034e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
7035e41f4b71Sopenharmony_ci
7036e41f4b71Sopenharmony_ci**Error codes**
7037e41f4b71Sopenharmony_ci
7038e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7039e41f4b71Sopenharmony_ci
7040e41f4b71Sopenharmony_ci| ID| Error Message                      |
7041e41f4b71Sopenharmony_ci|-------|----------------------------|
7042e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
7043e41f4b71Sopenharmony_ci
7044e41f4b71Sopenharmony_ci**Example**
7045e41f4b71Sopenharmony_ci
7046e41f4b71Sopenharmony_ci```ts
7047e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7048e41f4b71Sopenharmony_ci
7049e41f4b71Sopenharmony_cifunction callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
7050e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
7051e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
7052e41f4b71Sopenharmony_ci    return;
7053e41f4b71Sopenharmony_ci  }
7054e41f4b71Sopenharmony_ci  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
7055e41f4b71Sopenharmony_ci}
7056e41f4b71Sopenharmony_ci
7057e41f4b71Sopenharmony_cifunction registerSmoothZoomInfo(macroVideoSession: camera.MacroVideoSession): void {
7058e41f4b71Sopenharmony_ci  macroVideoSession.on('smoothZoomInfoAvailable', callback);
7059e41f4b71Sopenharmony_ci}
7060e41f4b71Sopenharmony_ci```
7061e41f4b71Sopenharmony_ci
7062e41f4b71Sopenharmony_ci### off('smoothZoomInfoAvailable')<sup>12+</sup>
7063e41f4b71Sopenharmony_ci
7064e41f4b71Sopenharmony_cioff(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
7065e41f4b71Sopenharmony_ci
7066e41f4b71Sopenharmony_ciUnsubscribes from smooth zoom state change events.
7067e41f4b71Sopenharmony_ci
7068e41f4b71Sopenharmony_ci**System API**: This is a system API.
7069e41f4b71Sopenharmony_ci
7070e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7071e41f4b71Sopenharmony_ci
7072e41f4b71Sopenharmony_ci**Parameters**
7073e41f4b71Sopenharmony_ci
7074e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
7075e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
7076e41f4b71Sopenharmony_ci| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
7077e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | No  | Callback used to return the result. If this parameter is specified, the subscription to the specified event with the specified callback is canceled. (The callback object cannot be an anonymous function.) Otherwise, the subscriptions to the specified event with all the callbacks are canceled.|
7078e41f4b71Sopenharmony_ci
7079e41f4b71Sopenharmony_ci**Error codes**
7080e41f4b71Sopenharmony_ci
7081e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7082e41f4b71Sopenharmony_ci
7083e41f4b71Sopenharmony_ci| ID| Error Message                      |
7084e41f4b71Sopenharmony_ci|-------|----------------------------|
7085e41f4b71Sopenharmony_ci| 202   | Not System Application.    |
7086e41f4b71Sopenharmony_ci
7087e41f4b71Sopenharmony_ci**Example**
7088e41f4b71Sopenharmony_ci
7089e41f4b71Sopenharmony_ci```ts
7090e41f4b71Sopenharmony_cifunction unregisterSmoothZoomInfo(macroVideoSession: camera.MacroVideoSession): void {
7091e41f4b71Sopenharmony_ci  macroVideoSession.off('smoothZoomInfoAvailable');
7092e41f4b71Sopenharmony_ci}
7093e41f4b71Sopenharmony_ci```
7094e41f4b71Sopenharmony_ci
7095e41f4b71Sopenharmony_ci## FlashQuery<sup>12+</sup>
7096e41f4b71Sopenharmony_ci
7097e41f4b71Sopenharmony_ciProvides APIs to obtain the flash information of a camera device, including whether the LCD flash is supported.
7098e41f4b71Sopenharmony_ci
7099e41f4b71Sopenharmony_ci### isLcdFlashSupported<sup>12+</sup>
7100e41f4b71Sopenharmony_ci
7101e41f4b71Sopenharmony_ciisLcdFlashSupported(): boolean
7102e41f4b71Sopenharmony_ci
7103e41f4b71Sopenharmony_ciChecks whether the LCD flash is supported.
7104e41f4b71Sopenharmony_ci
7105e41f4b71Sopenharmony_ci**System API**: This is a system API.
7106e41f4b71Sopenharmony_ci
7107e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7108e41f4b71Sopenharmony_ci
7109e41f4b71Sopenharmony_ci**Return value**
7110e41f4b71Sopenharmony_ci
7111e41f4b71Sopenharmony_ci| Type           | Description                    |
7112e41f4b71Sopenharmony_ci| -------------- | ----------------------- |
7113e41f4b71Sopenharmony_ci| boolean | **true**: The LCD flash is supported.<br>**false**: The LCD flash is not supported.|
7114e41f4b71Sopenharmony_ci
7115e41f4b71Sopenharmony_ci**Error codes**
7116e41f4b71Sopenharmony_ci
7117e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7118e41f4b71Sopenharmony_ci
7119e41f4b71Sopenharmony_ci| ID        | Error Message       |
7120e41f4b71Sopenharmony_ci| --------------- | --------------- |
7121e41f4b71Sopenharmony_ci| 202 | Not System Application. |
7122e41f4b71Sopenharmony_ci| 7400103                |  Session not config, only throw in session usage. |
7123e41f4b71Sopenharmony_ci
7124e41f4b71Sopenharmony_ci**Example**
7125e41f4b71Sopenharmony_ci
7126e41f4b71Sopenharmony_ci```ts
7127e41f4b71Sopenharmony_cifunction isLcdFlashSupported(nightPhotoSession: camera.NightPhotoSession): boolean {
7128e41f4b71Sopenharmony_ci  return nightPhotoSession.isLcdFlashSupported();
7129e41f4b71Sopenharmony_ci}
7130e41f4b71Sopenharmony_ci```
7131e41f4b71Sopenharmony_ci
7132e41f4b71Sopenharmony_ci## TimeLapseRecordState<sup>12+</sup>
7133e41f4b71Sopenharmony_ci
7134e41f4b71Sopenharmony_ciEnumerates the time-lapse recording states.
7135e41f4b71Sopenharmony_ci
7136e41f4b71Sopenharmony_ci**System API**: This is a system API.
7137e41f4b71Sopenharmony_ci
7138e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7139e41f4b71Sopenharmony_ci
7140e41f4b71Sopenharmony_ci| Name                          | Value  | Description        |
7141e41f4b71Sopenharmony_ci| ----------------------------- | ---- | ----------- |
7142e41f4b71Sopenharmony_ci| IDLE          | 0    | Recording not started.|
7143e41f4b71Sopenharmony_ci| RECORDING     | 1    | Recording.|
7144e41f4b71Sopenharmony_ci
7145e41f4b71Sopenharmony_ci## TimeLapsePreviewType<sup>12+</sup>
7146e41f4b71Sopenharmony_ci
7147e41f4b71Sopenharmony_ciEnumerates the time-lapse preview types, which affect the shooting algorithm.
7148e41f4b71Sopenharmony_ci
7149e41f4b71Sopenharmony_ci**System API**: This is a system API.
7150e41f4b71Sopenharmony_ci
7151e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7152e41f4b71Sopenharmony_ci
7153e41f4b71Sopenharmony_ci| Name                          | Value  | Description        |
7154e41f4b71Sopenharmony_ci| ----------------------------- | ---- | ----------- |
7155e41f4b71Sopenharmony_ci| DARK         | 1    | Dark environment, a scenario with poor illumination, for example, at night or in a dark area.|
7156e41f4b71Sopenharmony_ci| LIGHT        | 2    | Bright environment, a scenario with good illumination, for example, in the daytime or under light.|
7157e41f4b71Sopenharmony_ci
7158e41f4b71Sopenharmony_ci## TryAEInfo<sup>12+</sup>
7159e41f4b71Sopenharmony_ci
7160e41f4b71Sopenharmony_ciDescribes the Try AE parameters. Try AE indicates that the hardware reports the status based on the ambient illumination change during time-lapse photographing.
7161e41f4b71Sopenharmony_ci
7162e41f4b71Sopenharmony_ci**System API**: This is a system API.
7163e41f4b71Sopenharmony_ci
7164e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7165e41f4b71Sopenharmony_ci
7166e41f4b71Sopenharmony_ci| Name| Type   | Read-only| Optional| Description          |
7167e41f4b71Sopenharmony_ci| ---- | ------- | ---- |--| -------------- |
7168e41f4b71Sopenharmony_ci| isTryAEDone        | boolean  | Yes  | No| Whether Try AE is complete.       |
7169e41f4b71Sopenharmony_ci| isTryAEHintNeeded  | boolean  | Yes  | Yes| Whether Try AE is required.       |
7170e41f4b71Sopenharmony_ci| previewType        | [TimeLapsePreviewType](#timelapsepreviewtype12) | Yes  | Yes| Preview type.       |
7171e41f4b71Sopenharmony_ci| captureInterval    | number   | Yes  | Yes| Shooting interval, in ms.       |
7172e41f4b71Sopenharmony_ci
7173e41f4b71Sopenharmony_ci## TimeLapsePhotoSession<sup>12+</sup>
7174e41f4b71Sopenharmony_ci
7175e41f4b71Sopenharmony_ciTimeLapsePhotoSession extends Session, Focus, ManualFocus, AutoExposure, ManualExposure, ManualIso, WhiteBalance, Zoom, ColorEffect
7176e41f4b71Sopenharmony_ci
7177e41f4b71Sopenharmony_ciImplements a time-lapse photo session, which sets the parameters of the time-lapse photo mode and saves all [CameraInput](js-apis-camera.md#camerainput) and [CameraOutput](js-apis-camera.md#cameraoutput) instances required to run the camera. It inherits from [Session](js-apis-camera.md#session12).
7178e41f4b71Sopenharmony_ci
7179e41f4b71Sopenharmony_ci### on('error')<sup>12+</sup>
7180e41f4b71Sopenharmony_ci
7181e41f4b71Sopenharmony_cion(type: 'error', callback: ErrorCallback): void
7182e41f4b71Sopenharmony_ci
7183e41f4b71Sopenharmony_ciSubscribes to **TimeLapsePhotoSession** error events. This API uses an asynchronous callback to return the result.
7184e41f4b71Sopenharmony_ci
7185e41f4b71Sopenharmony_ci**System API**: This is a system API.
7186e41f4b71Sopenharmony_ci
7187e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7188e41f4b71Sopenharmony_ci
7189e41f4b71Sopenharmony_ci**Parameters**
7190e41f4b71Sopenharmony_ci
7191e41f4b71Sopenharmony_ci| Name    | Type                                                         | Mandatory| Description                          |
7192e41f4b71Sopenharmony_ci| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
7193e41f4b71Sopenharmony_ci| type     | string                                                      | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as [beginConfig](js-apis-camera.md#beginconfig11), [commitConfig](js-apis-camera.md#commitconfig11-1), and [addInput](js-apis-camera.md#addinput11).|
7194e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| Yes  | Callback used to return an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).|
7195e41f4b71Sopenharmony_ci
7196e41f4b71Sopenharmony_ci**Error codes**
7197e41f4b71Sopenharmony_ci
7198e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7199e41f4b71Sopenharmony_ci
7200e41f4b71Sopenharmony_ci| ID  | Error Message       |
7201e41f4b71Sopenharmony_ci|---------| --------------- |
7202e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
7203e41f4b71Sopenharmony_ci
7204e41f4b71Sopenharmony_ci**Example**
7205e41f4b71Sopenharmony_ci
7206e41f4b71Sopenharmony_ci```ts
7207e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7208e41f4b71Sopenharmony_ci
7209e41f4b71Sopenharmony_cifunction callback(err: BusinessError): void {
7210e41f4b71Sopenharmony_ci  console.error(`Time lapse photo session error code: ${err.code}`);
7211e41f4b71Sopenharmony_ci}
7212e41f4b71Sopenharmony_ci
7213e41f4b71Sopenharmony_cifunction registerSessionError(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7214e41f4b71Sopenharmony_ci  timeLapsePhotoSession.on('error', callback);
7215e41f4b71Sopenharmony_ci}
7216e41f4b71Sopenharmony_ci```
7217e41f4b71Sopenharmony_ci
7218e41f4b71Sopenharmony_ci### off('error')<sup>12+</sup>
7219e41f4b71Sopenharmony_ci
7220e41f4b71Sopenharmony_cioff(type: 'error', callback?: ErrorCallback): void
7221e41f4b71Sopenharmony_ci
7222e41f4b71Sopenharmony_ciUnsubscribes from **TimeLapsePhotoSession** error events.
7223e41f4b71Sopenharmony_ci
7224e41f4b71Sopenharmony_ci**System API**: This is a system API.
7225e41f4b71Sopenharmony_ci
7226e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7227e41f4b71Sopenharmony_ci
7228e41f4b71Sopenharmony_ci**Parameters**
7229e41f4b71Sopenharmony_ci
7230e41f4b71Sopenharmony_ci| Name    | Type                       | Mandatory| Description                          |
7231e41f4b71Sopenharmony_ci| -------- | ------------------------ | ---- | ------------------------------ |
7232e41f4b71Sopenharmony_ci| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
7233e41f4b71Sopenharmony_ci| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| No  | Callback, which is optional. If a callback function is passed in, it is an anonymous function.      |
7234e41f4b71Sopenharmony_ci
7235e41f4b71Sopenharmony_ci**Error codes**
7236e41f4b71Sopenharmony_ci
7237e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7238e41f4b71Sopenharmony_ci
7239e41f4b71Sopenharmony_ci| ID  | Error Message       |
7240e41f4b71Sopenharmony_ci|---------| --------------- |
7241e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
7242e41f4b71Sopenharmony_ci
7243e41f4b71Sopenharmony_ci**Example**
7244e41f4b71Sopenharmony_ci
7245e41f4b71Sopenharmony_ci```ts
7246e41f4b71Sopenharmony_cifunction unregisterSessionError(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7247e41f4b71Sopenharmony_ci  timeLapsePhotoSession.off('error');
7248e41f4b71Sopenharmony_ci}
7249e41f4b71Sopenharmony_ci```
7250e41f4b71Sopenharmony_ci
7251e41f4b71Sopenharmony_ci### on('focusStateChange')<sup>12+</sup>
7252e41f4b71Sopenharmony_ci
7253e41f4b71Sopenharmony_cion(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
7254e41f4b71Sopenharmony_ci
7255e41f4b71Sopenharmony_ciSubscribes to focus state change events. This API uses an asynchronous callback to return the result.
7256e41f4b71Sopenharmony_ci
7257e41f4b71Sopenharmony_ci**System API**: This is a system API.
7258e41f4b71Sopenharmony_ci
7259e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7260e41f4b71Sopenharmony_ci
7261e41f4b71Sopenharmony_ci**Parameters**
7262e41f4b71Sopenharmony_ci
7263e41f4b71Sopenharmony_ci| Name    | Type                   | Mandatory| Description                      |
7264e41f4b71Sopenharmony_ci| -------- | ---------------- | ---- | ------------------------ |
7265e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.|
7266e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
7267e41f4b71Sopenharmony_ci
7268e41f4b71Sopenharmony_ci**Error codes**
7269e41f4b71Sopenharmony_ci
7270e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7271e41f4b71Sopenharmony_ci
7272e41f4b71Sopenharmony_ci| ID  | Error Message       |
7273e41f4b71Sopenharmony_ci|---------| --------------- |
7274e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
7275e41f4b71Sopenharmony_ci
7276e41f4b71Sopenharmony_ci**Example**
7277e41f4b71Sopenharmony_ci
7278e41f4b71Sopenharmony_ci```ts
7279e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7280e41f4b71Sopenharmony_ci
7281e41f4b71Sopenharmony_cifunction callback(err: BusinessError, focusState: camera.FocusState): void {
7282e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
7283e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
7284e41f4b71Sopenharmony_ci    return;
7285e41f4b71Sopenharmony_ci  }
7286e41f4b71Sopenharmony_ci  console.info(`Focus state: ${focusState}`);
7287e41f4b71Sopenharmony_ci}
7288e41f4b71Sopenharmony_ci
7289e41f4b71Sopenharmony_cifunction registerFocusStateChange(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7290e41f4b71Sopenharmony_ci  timeLapsePhotoSession.on('focusStateChange', callback);
7291e41f4b71Sopenharmony_ci}
7292e41f4b71Sopenharmony_ci```
7293e41f4b71Sopenharmony_ci
7294e41f4b71Sopenharmony_ci### off('focusStateChange')<sup>12+</sup>
7295e41f4b71Sopenharmony_ci
7296e41f4b71Sopenharmony_cioff(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
7297e41f4b71Sopenharmony_ci
7298e41f4b71Sopenharmony_ciUnsubscribes from focus state change events.
7299e41f4b71Sopenharmony_ci
7300e41f4b71Sopenharmony_ci**System API**: This is a system API.
7301e41f4b71Sopenharmony_ci
7302e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7303e41f4b71Sopenharmony_ci
7304e41f4b71Sopenharmony_ci**Parameters**
7305e41f4b71Sopenharmony_ci
7306e41f4b71Sopenharmony_ci| Name    | Type                                     | Mandatory| Description                      |
7307e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | ------------------------ |
7308e41f4b71Sopenharmony_ci| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
7309e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('focusStateChange')** with the specified callback is canceled. (The callback object cannot be an anonymous function.) |
7310e41f4b71Sopenharmony_ci
7311e41f4b71Sopenharmony_ci**Error codes**
7312e41f4b71Sopenharmony_ci
7313e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7314e41f4b71Sopenharmony_ci
7315e41f4b71Sopenharmony_ci| ID  | Error Message       |
7316e41f4b71Sopenharmony_ci|---------| --------------- |
7317e41f4b71Sopenharmony_ci| 202     |  Not System Application. |
7318e41f4b71Sopenharmony_ci
7319e41f4b71Sopenharmony_ci**Example**
7320e41f4b71Sopenharmony_ci
7321e41f4b71Sopenharmony_ci```ts
7322e41f4b71Sopenharmony_cifunction unregisterFocusStateChange(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7323e41f4b71Sopenharmony_ci  timeLapsePhotoSession.off('focusStateChange');
7324e41f4b71Sopenharmony_ci}
7325e41f4b71Sopenharmony_ci```
7326e41f4b71Sopenharmony_ci
7327e41f4b71Sopenharmony_ci### on('isoInfoChange')<sup>12+</sup>
7328e41f4b71Sopenharmony_ci
7329e41f4b71Sopenharmony_cion(type: 'isoInfoChange', callback: AsyncCallback\<IsoInfo\>): void
7330e41f4b71Sopenharmony_ci
7331e41f4b71Sopenharmony_ciSubscribes to automatic ISO change events to obtain real-time ISO information. This API uses an asynchronous callback to return the result.
7332e41f4b71Sopenharmony_ci
7333e41f4b71Sopenharmony_ci**System API**: This is a system API.
7334e41f4b71Sopenharmony_ci
7335e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7336e41f4b71Sopenharmony_ci
7337e41f4b71Sopenharmony_ci**Parameters**
7338e41f4b71Sopenharmony_ci
7339e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
7340e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7341e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
7342e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[IsoInfo](js-apis-camera-sys.md#isoinfo12)\>| Yes  | Callback used to return the ISO information.        |
7343e41f4b71Sopenharmony_ci
7344e41f4b71Sopenharmony_ci**Error codes**
7345e41f4b71Sopenharmony_ci
7346e41f4b71Sopenharmony_ci| ID| Error Message                    |
7347e41f4b71Sopenharmony_ci| ------- | ---------------------- |
7348e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7349e41f4b71Sopenharmony_ci
7350e41f4b71Sopenharmony_ci**Example**
7351e41f4b71Sopenharmony_ci
7352e41f4b71Sopenharmony_ci```ts
7353e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7354e41f4b71Sopenharmony_ci
7355e41f4b71Sopenharmony_cifunction isoInfoCallback(err: BusinessError, info: camera.IsoInfo): void {
7356e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
7357e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
7358e41f4b71Sopenharmony_ci    return;
7359e41f4b71Sopenharmony_ci  }
7360e41f4b71Sopenharmony_ci  console.log(`ISO value: ${info.iso}`);
7361e41f4b71Sopenharmony_ci}
7362e41f4b71Sopenharmony_ci
7363e41f4b71Sopenharmony_cifunction registerIsoInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7364e41f4b71Sopenharmony_ci  timeLapsePhotoSession.on('isoInfoChange', isoInfoCallback);
7365e41f4b71Sopenharmony_ci}
7366e41f4b71Sopenharmony_ci```
7367e41f4b71Sopenharmony_ci
7368e41f4b71Sopenharmony_ci### off('isoInfoChange')<sup>12+</sup>
7369e41f4b71Sopenharmony_ci
7370e41f4b71Sopenharmony_cioff(type: 'isoInfoChange', callback?: AsyncCallback\<IsoInfo\>): void
7371e41f4b71Sopenharmony_ci
7372e41f4b71Sopenharmony_ciUnsubscribes from automatic ISO change events.
7373e41f4b71Sopenharmony_ci
7374e41f4b71Sopenharmony_ci**System API**: This is a system API.
7375e41f4b71Sopenharmony_ci
7376e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7377e41f4b71Sopenharmony_ci
7378e41f4b71Sopenharmony_ci**Parameters**
7379e41f4b71Sopenharmony_ci
7380e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
7381e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7382e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
7383e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[IsoInfo](js-apis-camera-sys.md#isoinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('isoInfoChange')**.|
7384e41f4b71Sopenharmony_ci
7385e41f4b71Sopenharmony_ci**Error codes**
7386e41f4b71Sopenharmony_ci
7387e41f4b71Sopenharmony_ci| ID| Error Message                   |
7388e41f4b71Sopenharmony_ci| ------- | ---------------------- |
7389e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7390e41f4b71Sopenharmony_ci
7391e41f4b71Sopenharmony_ci**Example**
7392e41f4b71Sopenharmony_ci
7393e41f4b71Sopenharmony_ci```ts
7394e41f4b71Sopenharmony_cifunction unregisterIsoInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7395e41f4b71Sopenharmony_ci  timeLapsePhotoSession.off('isoInfoChange');
7396e41f4b71Sopenharmony_ci}
7397e41f4b71Sopenharmony_ci```
7398e41f4b71Sopenharmony_ci
7399e41f4b71Sopenharmony_ci### on('exposureInfoChange')<sup>12+</sup>
7400e41f4b71Sopenharmony_ci
7401e41f4b71Sopenharmony_cion(type: 'exposureInfoChange', callback: AsyncCallback\<[ExposureInfo](js-apis-camera-sys.md#exposureinfo12)\>): void
7402e41f4b71Sopenharmony_ci
7403e41f4b71Sopenharmony_ciSubscribes to exposure information change events to obtain the exposure information. This API uses an asynchronous callback to return the result.
7404e41f4b71Sopenharmony_ci
7405e41f4b71Sopenharmony_ci**System API**: This is a system API.
7406e41f4b71Sopenharmony_ci
7407e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7408e41f4b71Sopenharmony_ci
7409e41f4b71Sopenharmony_ci**Parameters**
7410e41f4b71Sopenharmony_ci
7411e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
7412e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7413e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
7414e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ExposureInfo](js-apis-camera-sys.md#exposureinfo12)\>| Yes  | Callback used to return the exposure information.        |
7415e41f4b71Sopenharmony_ci
7416e41f4b71Sopenharmony_ci**Error codes**
7417e41f4b71Sopenharmony_ci
7418e41f4b71Sopenharmony_ci| ID| Error Message                    |
7419e41f4b71Sopenharmony_ci| ------- | ---------------------- |
7420e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7421e41f4b71Sopenharmony_ci
7422e41f4b71Sopenharmony_ci**Example**
7423e41f4b71Sopenharmony_ci
7424e41f4b71Sopenharmony_ci```ts
7425e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7426e41f4b71Sopenharmony_ci
7427e41f4b71Sopenharmony_cifunction exposureInfoCallback(err: BusinessError, info: camera.ExposureInfo): void {
7428e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
7429e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
7430e41f4b71Sopenharmony_ci    return;
7431e41f4b71Sopenharmony_ci  }
7432e41f4b71Sopenharmony_ci  console.log(`exposureTimeValue: ${info.exposureTime}`);
7433e41f4b71Sopenharmony_ci}
7434e41f4b71Sopenharmony_ci
7435e41f4b71Sopenharmony_cifunction registerExposureInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7436e41f4b71Sopenharmony_ci  timeLapsePhotoSession.on('exposureInfoChange', exposureInfoCallback);
7437e41f4b71Sopenharmony_ci}
7438e41f4b71Sopenharmony_ci```
7439e41f4b71Sopenharmony_ci
7440e41f4b71Sopenharmony_ci### off('exposureInfoChange')<sup>12+</sup>
7441e41f4b71Sopenharmony_ci
7442e41f4b71Sopenharmony_cioff(type: 'exposureInfoChange', callback?: AsyncCallback\<[ExposureInfo](js-apis-camera-sys.md#exposureinfo12)\>): void
7443e41f4b71Sopenharmony_ci
7444e41f4b71Sopenharmony_ciUnsubscribes from exposure information change events.
7445e41f4b71Sopenharmony_ci
7446e41f4b71Sopenharmony_ci**System API**: This is a system API.
7447e41f4b71Sopenharmony_ci
7448e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7449e41f4b71Sopenharmony_ci
7450e41f4b71Sopenharmony_ci**Parameters**
7451e41f4b71Sopenharmony_ci
7452e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
7453e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7454e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
7455e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ExposureInfo](js-apis-camera-sys.md#exposureinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('exposureInfoChange')**.|
7456e41f4b71Sopenharmony_ci
7457e41f4b71Sopenharmony_ci**Error codes**
7458e41f4b71Sopenharmony_ci
7459e41f4b71Sopenharmony_ci| ID| Error Message                    |
7460e41f4b71Sopenharmony_ci| ------- | ---------------------- |
7461e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7462e41f4b71Sopenharmony_ci
7463e41f4b71Sopenharmony_ci**Example**
7464e41f4b71Sopenharmony_ci
7465e41f4b71Sopenharmony_ci```ts
7466e41f4b71Sopenharmony_cifunction unregisterExposureInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7467e41f4b71Sopenharmony_ci  timeLapsePhotoSession.off('exposureInfoChange');
7468e41f4b71Sopenharmony_ci}
7469e41f4b71Sopenharmony_ci```
7470e41f4b71Sopenharmony_ci
7471e41f4b71Sopenharmony_ci### on('luminationInfoChange')<sup>12+</sup>
7472e41f4b71Sopenharmony_ci
7473e41f4b71Sopenharmony_cion(type: 'luminationInfoChange', callback: AsyncCallback\<[LuminationInfo](js-apis-camera-sys.md#luminationinfo12)\>): void
7474e41f4b71Sopenharmony_ci
7475e41f4b71Sopenharmony_ciSubscribes to illumination change events to obtain real-time illumination information. This API uses an asynchronous callback to return the result.
7476e41f4b71Sopenharmony_ci
7477e41f4b71Sopenharmony_ci**System API**: This is a system API.
7478e41f4b71Sopenharmony_ci
7479e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7480e41f4b71Sopenharmony_ci
7481e41f4b71Sopenharmony_ci**Parameters**
7482e41f4b71Sopenharmony_ci
7483e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
7484e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7485e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
7486e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[LuminationInfo](js-apis-camera-sys.md#luminationinfo12)\>| Yes  | Callback used to return the illumination information.        |
7487e41f4b71Sopenharmony_ci
7488e41f4b71Sopenharmony_ci**Error codes**
7489e41f4b71Sopenharmony_ci
7490e41f4b71Sopenharmony_ci| ID| Error Message                    |
7491e41f4b71Sopenharmony_ci| ------- | ---------------------- |
7492e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7493e41f4b71Sopenharmony_ci
7494e41f4b71Sopenharmony_ci**Example**
7495e41f4b71Sopenharmony_ci
7496e41f4b71Sopenharmony_ci```ts
7497e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7498e41f4b71Sopenharmony_ci
7499e41f4b71Sopenharmony_cifunction luminationInfoCallback(err: BusinessError, info: camera.LuminationInfo): void {
7500e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
7501e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
7502e41f4b71Sopenharmony_ci    return;
7503e41f4b71Sopenharmony_ci  }
7504e41f4b71Sopenharmony_ci  console.log(`Lumination: ${info.lumination}`);
7505e41f4b71Sopenharmony_ci}
7506e41f4b71Sopenharmony_ci
7507e41f4b71Sopenharmony_cifunction registerLuminationInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7508e41f4b71Sopenharmony_ci  timeLapsePhotoSession.on('luminationInfoChange', luminationInfoCallback);
7509e41f4b71Sopenharmony_ci}
7510e41f4b71Sopenharmony_ci```
7511e41f4b71Sopenharmony_ci
7512e41f4b71Sopenharmony_ci### off('luminationInfoChange')<sup>12+</sup>
7513e41f4b71Sopenharmony_ci
7514e41f4b71Sopenharmony_cioff(type: 'luminationInfoChange', callback?: AsyncCallback\<[LuminationInfo](js-apis-camera-sys.md#luminationinfo12)\>): void
7515e41f4b71Sopenharmony_ci
7516e41f4b71Sopenharmony_ciUnsubscribes from illumination change events.
7517e41f4b71Sopenharmony_ci
7518e41f4b71Sopenharmony_ci**System API**: This is a system API.
7519e41f4b71Sopenharmony_ci
7520e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7521e41f4b71Sopenharmony_ci
7522e41f4b71Sopenharmony_ci**Parameters**
7523e41f4b71Sopenharmony_ci
7524e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
7525e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7526e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
7527e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[LuminationInfo](js-apis-camera-sys.md#luminationinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('luminationInfoChange')**.|
7528e41f4b71Sopenharmony_ci
7529e41f4b71Sopenharmony_ci**Error codes**
7530e41f4b71Sopenharmony_ci
7531e41f4b71Sopenharmony_ci| ID| Error Message                    |
7532e41f4b71Sopenharmony_ci| ------- | ---------------------- |
7533e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7534e41f4b71Sopenharmony_ci
7535e41f4b71Sopenharmony_ci**Example**
7536e41f4b71Sopenharmony_ci
7537e41f4b71Sopenharmony_ci```ts
7538e41f4b71Sopenharmony_cifunction unregisterLuminationInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7539e41f4b71Sopenharmony_ci  timeLapsePhotoSession.off('luminationInfoChange');
7540e41f4b71Sopenharmony_ci}
7541e41f4b71Sopenharmony_ci```
7542e41f4b71Sopenharmony_ci
7543e41f4b71Sopenharmony_ci### on('tryAEInfoChange')<sup>12+</sup>
7544e41f4b71Sopenharmony_ci
7545e41f4b71Sopenharmony_cion(type: 'tryAEInfoChange', callback: AsyncCallback\<[TryAEInfo](js-apis-camera-sys.md#tryaeinfo12)\>): void
7546e41f4b71Sopenharmony_ci
7547e41f4b71Sopenharmony_ciSubscribes to Try AE change events to obtain real-time Try AE parameters. This API uses an asynchronous callback to return the result.
7548e41f4b71Sopenharmony_ci
7549e41f4b71Sopenharmony_ci**System API**: This is a system API.
7550e41f4b71Sopenharmony_ci
7551e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7552e41f4b71Sopenharmony_ci
7553e41f4b71Sopenharmony_ci**Parameters**
7554e41f4b71Sopenharmony_ci
7555e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
7556e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7557e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'tryAEInfoChange'**.        |
7558e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[TryAEInfo](js-apis-camera-sys.md#tryaeinfo12)\>| Yes  | Callback used to return the Try AE parameters.        |
7559e41f4b71Sopenharmony_ci
7560e41f4b71Sopenharmony_ci**Error codes**
7561e41f4b71Sopenharmony_ci
7562e41f4b71Sopenharmony_ci| ID| Error Message                    |
7563e41f4b71Sopenharmony_ci| ------- | ---------------------- |
7564e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7565e41f4b71Sopenharmony_ci
7566e41f4b71Sopenharmony_ci**Example**
7567e41f4b71Sopenharmony_ci
7568e41f4b71Sopenharmony_ci```ts
7569e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7570e41f4b71Sopenharmony_ci
7571e41f4b71Sopenharmony_cifunction tryAEInfoCallback(err: BusinessError, info: camera.TryAEInfo): void {
7572e41f4b71Sopenharmony_ci  if (err !== undefined && err.code !== 0) {
7573e41f4b71Sopenharmony_ci    console.error(`Callback Error, errorCode: ${err.code}`);
7574e41f4b71Sopenharmony_ci    return;
7575e41f4b71Sopenharmony_ci  }
7576e41f4b71Sopenharmony_ci  console.log(`TryAEInfo: ${info.isTryAEDone}, ${info.isTryAEHintNeeded}, ${info.previewType}, ${info.captureInterval}`);
7577e41f4b71Sopenharmony_ci}
7578e41f4b71Sopenharmony_ci
7579e41f4b71Sopenharmony_cifunction registerTryAEInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7580e41f4b71Sopenharmony_ci  timeLapsePhotoSession.on('tryAEInfoChange', tryAEInfoCallback);
7581e41f4b71Sopenharmony_ci}
7582e41f4b71Sopenharmony_ci```
7583e41f4b71Sopenharmony_ci
7584e41f4b71Sopenharmony_ci### off('tryAEInfoChange')<sup>12+</sup>
7585e41f4b71Sopenharmony_ci
7586e41f4b71Sopenharmony_cioff(type: 'tryAEInfoChange', callback?: AsyncCallback\<[TryAEInfo](js-apis-camera-sys.md#tryaeinfo12)\>): void
7587e41f4b71Sopenharmony_ci
7588e41f4b71Sopenharmony_ciUnsubscribes from Try AE change events.
7589e41f4b71Sopenharmony_ci
7590e41f4b71Sopenharmony_ci**System API**: This is a system API.
7591e41f4b71Sopenharmony_ci
7592e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7593e41f4b71Sopenharmony_ci
7594e41f4b71Sopenharmony_ci**Parameters**
7595e41f4b71Sopenharmony_ci
7596e41f4b71Sopenharmony_ci| Name    | Type                                                     | Mandatory| Description                              |
7597e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7598e41f4b71Sopenharmony_ci| type     | string                                                  | Yes  | Event type. The value is fixed at **'tryAEInfoChange'**.        |
7599e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[TryAEInfo](js-apis-camera-sys.md#tryaeinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('tryAEInfoChange')**.|
7600e41f4b71Sopenharmony_ci
7601e41f4b71Sopenharmony_ci**Error codes**
7602e41f4b71Sopenharmony_ci
7603e41f4b71Sopenharmony_ci| ID| Error Message                    |
7604e41f4b71Sopenharmony_ci| ------- | ---------------------- |
7605e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7606e41f4b71Sopenharmony_ci
7607e41f4b71Sopenharmony_ci**Example**
7608e41f4b71Sopenharmony_ci
7609e41f4b71Sopenharmony_ci```ts
7610e41f4b71Sopenharmony_cifunction unregisterTryAEInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7611e41f4b71Sopenharmony_ci  timeLapsePhotoSession.off('tryAEInfoChange');
7612e41f4b71Sopenharmony_ci}
7613e41f4b71Sopenharmony_ci```
7614e41f4b71Sopenharmony_ci
7615e41f4b71Sopenharmony_ci### isTryAENeeded<sup>12+</sup>
7616e41f4b71Sopenharmony_ci
7617e41f4b71Sopenharmony_ciisTryAENeeded(): boolean
7618e41f4b71Sopenharmony_ci
7619e41f4b71Sopenharmony_ciChecks whether Try AE is required.
7620e41f4b71Sopenharmony_ci
7621e41f4b71Sopenharmony_ci**System API**: This is a system API.
7622e41f4b71Sopenharmony_ci
7623e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7624e41f4b71Sopenharmony_ci
7625e41f4b71Sopenharmony_ci**Return value**
7626e41f4b71Sopenharmony_ci
7627e41f4b71Sopenharmony_ci| Type       | Description                         |
7628e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
7629e41f4b71Sopenharmony_ci| boolean   | Result indicating whether Try AE is required. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
7630e41f4b71Sopenharmony_ci
7631e41f4b71Sopenharmony_ci**Error codes**
7632e41f4b71Sopenharmony_ci
7633e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7634e41f4b71Sopenharmony_ci
7635e41f4b71Sopenharmony_ci| ID        | Error Message       |
7636e41f4b71Sopenharmony_ci| --------------- | --------------- |
7637e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7638e41f4b71Sopenharmony_ci| 7400103 |  Session not config.    |
7639e41f4b71Sopenharmony_ci
7640e41f4b71Sopenharmony_ci**Example**
7641e41f4b71Sopenharmony_ci
7642e41f4b71Sopenharmony_ci```ts
7643e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7644e41f4b71Sopenharmony_ci
7645e41f4b71Sopenharmony_cifunction isTryAENeeded(timeLapsePhotoSession: camera.TimeLapsePhotoSession): boolean {
7646e41f4b71Sopenharmony_ci  let needed = false;
7647e41f4b71Sopenharmony_ci  try {
7648e41f4b71Sopenharmony_ci    needed = timeLapsePhotoSession.isTryAENeeded();
7649e41f4b71Sopenharmony_ci  } catch (error) {
7650e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
7651e41f4b71Sopenharmony_ci    let err = error as BusinessError;
7652e41f4b71Sopenharmony_ci    console.error(`The isTryAENeeded call failed. error code: ${err.code}`);
7653e41f4b71Sopenharmony_ci  }
7654e41f4b71Sopenharmony_ci  return needed;
7655e41f4b71Sopenharmony_ci}
7656e41f4b71Sopenharmony_ci```
7657e41f4b71Sopenharmony_ci
7658e41f4b71Sopenharmony_ci### startTryAE<sup>12+</sup>
7659e41f4b71Sopenharmony_ci
7660e41f4b71Sopenharmony_cistartTryAE(): void
7661e41f4b71Sopenharmony_ci
7662e41f4b71Sopenharmony_ciStarts to execute Try AE.
7663e41f4b71Sopenharmony_ci
7664e41f4b71Sopenharmony_ci**System API**: This is a system API.
7665e41f4b71Sopenharmony_ci
7666e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7667e41f4b71Sopenharmony_ci
7668e41f4b71Sopenharmony_ci**Error codes**
7669e41f4b71Sopenharmony_ci
7670e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7671e41f4b71Sopenharmony_ci
7672e41f4b71Sopenharmony_ci| ID        | Error Message       |
7673e41f4b71Sopenharmony_ci| --------------- | --------------- |
7674e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7675e41f4b71Sopenharmony_ci| 7400103 | Session not config.     |
7676e41f4b71Sopenharmony_ci
7677e41f4b71Sopenharmony_ci**Example**
7678e41f4b71Sopenharmony_ci
7679e41f4b71Sopenharmony_ci```ts
7680e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7681e41f4b71Sopenharmony_ci
7682e41f4b71Sopenharmony_cifunction startTryAE(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7683e41f4b71Sopenharmony_ci  try {
7684e41f4b71Sopenharmony_ci    timeLapsePhotoSession.startTryAE();
7685e41f4b71Sopenharmony_ci  } catch (error) {
7686e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
7687e41f4b71Sopenharmony_ci    let err = error as BusinessError;
7688e41f4b71Sopenharmony_ci    console.error(`The startTryAE call failed. error code: ${err.code}`);
7689e41f4b71Sopenharmony_ci  }
7690e41f4b71Sopenharmony_ci}
7691e41f4b71Sopenharmony_ci```
7692e41f4b71Sopenharmony_ci
7693e41f4b71Sopenharmony_ci### stopTryAE<sup>12+</sup>
7694e41f4b71Sopenharmony_ci
7695e41f4b71Sopenharmony_cistopTryAE(): void
7696e41f4b71Sopenharmony_ci
7697e41f4b71Sopenharmony_ciStops the execution of Try AE.
7698e41f4b71Sopenharmony_ci
7699e41f4b71Sopenharmony_ci**System API**: This is a system API.
7700e41f4b71Sopenharmony_ci
7701e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7702e41f4b71Sopenharmony_ci
7703e41f4b71Sopenharmony_ci**Error codes**
7704e41f4b71Sopenharmony_ci
7705e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7706e41f4b71Sopenharmony_ci
7707e41f4b71Sopenharmony_ci| ID        | Error Message       |
7708e41f4b71Sopenharmony_ci| --------------- | --------------- |
7709e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7710e41f4b71Sopenharmony_ci| 7400103 | Session not config.     |
7711e41f4b71Sopenharmony_ci
7712e41f4b71Sopenharmony_ci**Example**
7713e41f4b71Sopenharmony_ci
7714e41f4b71Sopenharmony_ci```ts
7715e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7716e41f4b71Sopenharmony_ci
7717e41f4b71Sopenharmony_cifunction stopTryAE(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7718e41f4b71Sopenharmony_ci  try {
7719e41f4b71Sopenharmony_ci    timeLapsePhotoSession.stopTryAE();
7720e41f4b71Sopenharmony_ci  } catch (error) {
7721e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
7722e41f4b71Sopenharmony_ci    let err = error as BusinessError;
7723e41f4b71Sopenharmony_ci    console.error(`The stopTryAE call failed. error code: ${err.code}`);
7724e41f4b71Sopenharmony_ci  }
7725e41f4b71Sopenharmony_ci}
7726e41f4b71Sopenharmony_ci```
7727e41f4b71Sopenharmony_ci
7728e41f4b71Sopenharmony_ci### getSupportedTimeLapseIntervalRange<sup>12+</sup>
7729e41f4b71Sopenharmony_ci
7730e41f4b71Sopenharmony_cigetSupportedTimeLapseIntervalRange(): Array\<number\>
7731e41f4b71Sopenharmony_ci
7732e41f4b71Sopenharmony_ciObtains the supported time-lapse shooting interval range.
7733e41f4b71Sopenharmony_ci
7734e41f4b71Sopenharmony_ci**System API**: This is a system API.
7735e41f4b71Sopenharmony_ci
7736e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7737e41f4b71Sopenharmony_ci
7738e41f4b71Sopenharmony_ci**Return value**
7739e41f4b71Sopenharmony_ci
7740e41f4b71Sopenharmony_ci| Type       | Description                         |
7741e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
7742e41f4b71Sopenharmony_ci| Array\<number\>   | Interval range, in ms. The value depends on the underlying capability. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
7743e41f4b71Sopenharmony_ci
7744e41f4b71Sopenharmony_ci**Error codes**
7745e41f4b71Sopenharmony_ci
7746e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7747e41f4b71Sopenharmony_ci
7748e41f4b71Sopenharmony_ci| ID        | Error Message       |
7749e41f4b71Sopenharmony_ci| --------------- | --------------- |
7750e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7751e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
7752e41f4b71Sopenharmony_ci
7753e41f4b71Sopenharmony_ci**Example**
7754e41f4b71Sopenharmony_ci
7755e41f4b71Sopenharmony_ci```ts
7756e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7757e41f4b71Sopenharmony_ci
7758e41f4b71Sopenharmony_cifunction getSupportedTimeLapseIntervalRange(timeLapsePhotoSession: camera.TimeLapsePhotoSession): Array<number> {
7759e41f4b71Sopenharmony_ci  let intervalRange: Array<number> = [];
7760e41f4b71Sopenharmony_ci  try {
7761e41f4b71Sopenharmony_ci    intervalRange = timeLapsePhotoSession.getSupportedTimeLapseIntervalRange();
7762e41f4b71Sopenharmony_ci  } catch (error) {
7763e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
7764e41f4b71Sopenharmony_ci    let err = error as BusinessError;
7765e41f4b71Sopenharmony_ci    console.error(`The getSupportedTimeLapseIntervalRange call failed. error code: ${err.code}`);
7766e41f4b71Sopenharmony_ci  }
7767e41f4b71Sopenharmony_ci  return intervalRange;
7768e41f4b71Sopenharmony_ci}
7769e41f4b71Sopenharmony_ci```
7770e41f4b71Sopenharmony_ci
7771e41f4b71Sopenharmony_ci### getTimeLapseInterval<sup>12+</sup>
7772e41f4b71Sopenharmony_ci
7773e41f4b71Sopenharmony_cigetTimeLapseInterval(): number
7774e41f4b71Sopenharmony_ci
7775e41f4b71Sopenharmony_ciObtains the current time-lapse shooting interval.
7776e41f4b71Sopenharmony_ci
7777e41f4b71Sopenharmony_ci**System API**: This is a system API.
7778e41f4b71Sopenharmony_ci
7779e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7780e41f4b71Sopenharmony_ci
7781e41f4b71Sopenharmony_ci**Return value**
7782e41f4b71Sopenharmony_ci
7783e41f4b71Sopenharmony_ci| Type       | Description                         |
7784e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
7785e41f4b71Sopenharmony_ci| number    | Shooting interval, in ms.|
7786e41f4b71Sopenharmony_ci
7787e41f4b71Sopenharmony_ci**Error codes**
7788e41f4b71Sopenharmony_ci
7789e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7790e41f4b71Sopenharmony_ci
7791e41f4b71Sopenharmony_ci| ID        | Error Message       |
7792e41f4b71Sopenharmony_ci| --------------- | --------------- |
7793e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7794e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
7795e41f4b71Sopenharmony_ci
7796e41f4b71Sopenharmony_ci**Example**
7797e41f4b71Sopenharmony_ci
7798e41f4b71Sopenharmony_ci```ts
7799e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7800e41f4b71Sopenharmony_ci
7801e41f4b71Sopenharmony_cifunction getTimeLapseInterval(timeLapsePhotoSession: camera.TimeLapsePhotoSession): number {
7802e41f4b71Sopenharmony_ci  let interval: number = 0;
7803e41f4b71Sopenharmony_ci  try {
7804e41f4b71Sopenharmony_ci    interval = timeLapsePhotoSession.getTimeLapseInterval();
7805e41f4b71Sopenharmony_ci  } catch (error) {
7806e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
7807e41f4b71Sopenharmony_ci    let err = error as BusinessError;
7808e41f4b71Sopenharmony_ci    console.error(`The getTimeLapseInterval call failed. error code: ${err.code}`);
7809e41f4b71Sopenharmony_ci  }
7810e41f4b71Sopenharmony_ci  return interval;
7811e41f4b71Sopenharmony_ci}
7812e41f4b71Sopenharmony_ci```
7813e41f4b71Sopenharmony_ci
7814e41f4b71Sopenharmony_ci### setTimeLapseInterval<sup>12+</sup>
7815e41f4b71Sopenharmony_cisetTimeLapseInterval(interval: number): void
7816e41f4b71Sopenharmony_ci
7817e41f4b71Sopenharmony_ciSets a time-lapse shooting interval.
7818e41f4b71Sopenharmony_ci
7819e41f4b71Sopenharmony_ci**System API**: This is a system API.
7820e41f4b71Sopenharmony_ci
7821e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7822e41f4b71Sopenharmony_ci
7823e41f4b71Sopenharmony_ci**Parameters**
7824e41f4b71Sopenharmony_ci
7825e41f4b71Sopenharmony_ci| Name     | Type                    | Mandatory| Description                |
7826e41f4b71Sopenharmony_ci| -------- | ----------------------- | ---- | ------------------- |
7827e41f4b71Sopenharmony_ci| interval | number | Yes  | Shooting interval, in ms.|
7828e41f4b71Sopenharmony_ci
7829e41f4b71Sopenharmony_ci**Error codes**
7830e41f4b71Sopenharmony_ci
7831e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7832e41f4b71Sopenharmony_ci
7833e41f4b71Sopenharmony_ci| ID        | Error Message       |
7834e41f4b71Sopenharmony_ci| --------------- | --------------- |
7835e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7836e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
7837e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
7838e41f4b71Sopenharmony_ci
7839e41f4b71Sopenharmony_ci**Example**
7840e41f4b71Sopenharmony_ci
7841e41f4b71Sopenharmony_ci```ts
7842e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7843e41f4b71Sopenharmony_ci
7844e41f4b71Sopenharmony_cifunction setTimeLapseInterval(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7845e41f4b71Sopenharmony_ci  try {
7846e41f4b71Sopenharmony_ci    let interval: number = 10000;
7847e41f4b71Sopenharmony_ci    timeLapsePhotoSession.setTimeLapseInterval(interval);
7848e41f4b71Sopenharmony_ci  } catch (error) {
7849e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
7850e41f4b71Sopenharmony_ci    let err = error as BusinessError;
7851e41f4b71Sopenharmony_ci    console.error(`The setTimeLapseInterval call failed. error code: ${err.code}`);
7852e41f4b71Sopenharmony_ci  }
7853e41f4b71Sopenharmony_ci}
7854e41f4b71Sopenharmony_ci```
7855e41f4b71Sopenharmony_ci
7856e41f4b71Sopenharmony_ci### getTimeLapseRecordState<sup>12+</sup>
7857e41f4b71Sopenharmony_ci
7858e41f4b71Sopenharmony_cigetTimeLapseRecordState(): TimeLapseRecordState
7859e41f4b71Sopenharmony_ci
7860e41f4b71Sopenharmony_ciObtains the time-lapse shooting state.
7861e41f4b71Sopenharmony_ci
7862e41f4b71Sopenharmony_ci**System API**: This is a system API.
7863e41f4b71Sopenharmony_ci
7864e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7865e41f4b71Sopenharmony_ci
7866e41f4b71Sopenharmony_ci**Return value**
7867e41f4b71Sopenharmony_ci
7868e41f4b71Sopenharmony_ci| Type       | Description                         |
7869e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
7870e41f4b71Sopenharmony_ci| [TimeLapseRecordState](#timelapserecordstate12)    | Shooting state. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
7871e41f4b71Sopenharmony_ci
7872e41f4b71Sopenharmony_ci**Error codes**
7873e41f4b71Sopenharmony_ci
7874e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7875e41f4b71Sopenharmony_ci
7876e41f4b71Sopenharmony_ci| ID        | Error Message       |
7877e41f4b71Sopenharmony_ci| --------------- | --------------- |
7878e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7879e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
7880e41f4b71Sopenharmony_ci
7881e41f4b71Sopenharmony_ci**Example**
7882e41f4b71Sopenharmony_ci
7883e41f4b71Sopenharmony_ci```ts
7884e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7885e41f4b71Sopenharmony_ci
7886e41f4b71Sopenharmony_cifunction getTimeLapseRecordState(timeLapsePhotoSession: camera.TimeLapsePhotoSession): camera.TimeLapseRecordState {
7887e41f4b71Sopenharmony_ci  let state = camera.TimeLapseRecordState.IDLE;
7888e41f4b71Sopenharmony_ci  try {
7889e41f4b71Sopenharmony_ci    state = timeLapsePhotoSession.getTimeLapseRecordState();
7890e41f4b71Sopenharmony_ci  } catch (error) {
7891e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
7892e41f4b71Sopenharmony_ci    let err = error as BusinessError;
7893e41f4b71Sopenharmony_ci    console.error(`The getTimeLapseRecordState call failed. error code: ${err.code}`);
7894e41f4b71Sopenharmony_ci  }
7895e41f4b71Sopenharmony_ci  return state;
7896e41f4b71Sopenharmony_ci}
7897e41f4b71Sopenharmony_ci```
7898e41f4b71Sopenharmony_ci
7899e41f4b71Sopenharmony_ci### setTimeLapseRecordState<sup>12+</sup>
7900e41f4b71Sopenharmony_ci
7901e41f4b71Sopenharmony_cisetTimeLapseRecordState(state: TimeLapseRecordState): void
7902e41f4b71Sopenharmony_ci
7903e41f4b71Sopenharmony_ciSets the time-lapse shooting state.
7904e41f4b71Sopenharmony_ci
7905e41f4b71Sopenharmony_ci**System API**: This is a system API.
7906e41f4b71Sopenharmony_ci
7907e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7908e41f4b71Sopenharmony_ci
7909e41f4b71Sopenharmony_ci**Parameters**
7910e41f4b71Sopenharmony_ci
7911e41f4b71Sopenharmony_ci| Name     | Type                           | Mandatory| Description                   |
7912e41f4b71Sopenharmony_ci| -------- | -------------------------------| ---- | ----------------------- |
7913e41f4b71Sopenharmony_ci| state   | [TimeLapseRecordState](#timelapserecordstate12)  | Yes  | Shooting state.               |
7914e41f4b71Sopenharmony_ci
7915e41f4b71Sopenharmony_ci**Error codes**
7916e41f4b71Sopenharmony_ci
7917e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7918e41f4b71Sopenharmony_ci
7919e41f4b71Sopenharmony_ci| ID        | Error Message       |
7920e41f4b71Sopenharmony_ci| --------------- | --------------- |
7921e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7922e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
7923e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
7924e41f4b71Sopenharmony_ci
7925e41f4b71Sopenharmony_ci**Example**
7926e41f4b71Sopenharmony_ci
7927e41f4b71Sopenharmony_ci```ts
7928e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7929e41f4b71Sopenharmony_ci
7930e41f4b71Sopenharmony_cifunction setTimeLapseRecordState(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7931e41f4b71Sopenharmony_ci  try {
7932e41f4b71Sopenharmony_ci    timeLapsePhotoSession.setTimeLapseRecordState(camera.TimeLapseRecordState.RECORDING);
7933e41f4b71Sopenharmony_ci  } catch (error) {
7934e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
7935e41f4b71Sopenharmony_ci    let err = error as BusinessError;
7936e41f4b71Sopenharmony_ci    console.error(`The setTimeLapseRecordState call failed. error code: ${err.code}`);
7937e41f4b71Sopenharmony_ci  }
7938e41f4b71Sopenharmony_ci}
7939e41f4b71Sopenharmony_ci```
7940e41f4b71Sopenharmony_ci
7941e41f4b71Sopenharmony_ci### getTimeLapsePreviewType<sup>12+</sup>
7942e41f4b71Sopenharmony_ci
7943e41f4b71Sopenharmony_cigetTimeLapsePreviewType(): TimeLapsePreviewType
7944e41f4b71Sopenharmony_ci
7945e41f4b71Sopenharmony_ciObtains the time-lapse preview type.
7946e41f4b71Sopenharmony_ci
7947e41f4b71Sopenharmony_ci**System API**: This is a system API.
7948e41f4b71Sopenharmony_ci
7949e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7950e41f4b71Sopenharmony_ci
7951e41f4b71Sopenharmony_ci**Return value**
7952e41f4b71Sopenharmony_ci
7953e41f4b71Sopenharmony_ci| Type       | Description                         |
7954e41f4b71Sopenharmony_ci| ---------- | ----------------------------- |
7955e41f4b71Sopenharmony_ci| [TimeLapsePreviewType](#timelapsepreviewtype12)    | Preview type. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
7956e41f4b71Sopenharmony_ci
7957e41f4b71Sopenharmony_ci**Error codes**
7958e41f4b71Sopenharmony_ci
7959e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7960e41f4b71Sopenharmony_ci
7961e41f4b71Sopenharmony_ci| ID        | Error Message       |
7962e41f4b71Sopenharmony_ci| --------------- | --------------- |
7963e41f4b71Sopenharmony_ci| 202     | Not System Application. |
7964e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
7965e41f4b71Sopenharmony_ci
7966e41f4b71Sopenharmony_ci**Example**
7967e41f4b71Sopenharmony_ci
7968e41f4b71Sopenharmony_ci```ts
7969e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
7970e41f4b71Sopenharmony_ci
7971e41f4b71Sopenharmony_cifunction getTimeLapsePreviewType(timeLapsePhotoSession: camera.TimeLapsePhotoSession): camera.TimeLapsePreviewType {
7972e41f4b71Sopenharmony_ci  let type = camera.TimeLapsePreviewType.DARK;
7973e41f4b71Sopenharmony_ci  try {
7974e41f4b71Sopenharmony_ci    type = timeLapsePhotoSession.getTimeLapsePreviewType();
7975e41f4b71Sopenharmony_ci  } catch (error) {
7976e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
7977e41f4b71Sopenharmony_ci    let err = error as BusinessError;
7978e41f4b71Sopenharmony_ci    console.error(`The getTimeLapsePreviewType call failed. error code: ${err.code}`);
7979e41f4b71Sopenharmony_ci  }
7980e41f4b71Sopenharmony_ci  return type;
7981e41f4b71Sopenharmony_ci}
7982e41f4b71Sopenharmony_ci```
7983e41f4b71Sopenharmony_ci
7984e41f4b71Sopenharmony_ci### setTimeLapsePreviewType<sup>12+</sup>
7985e41f4b71Sopenharmony_ci
7986e41f4b71Sopenharmony_cisetTimeLapsePreviewType(type: TimeLapsePreviewType): void
7987e41f4b71Sopenharmony_ci
7988e41f4b71Sopenharmony_ciSets the time-lapse preview type.
7989e41f4b71Sopenharmony_ci
7990e41f4b71Sopenharmony_ci**System API**: This is a system API.
7991e41f4b71Sopenharmony_ci
7992e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Camera.Core
7993e41f4b71Sopenharmony_ci
7994e41f4b71Sopenharmony_ci**Parameters**
7995e41f4b71Sopenharmony_ci
7996e41f4b71Sopenharmony_ci| Name     | Type                           | Mandatory| Description                   |
7997e41f4b71Sopenharmony_ci| -------- | -------------------------------| ---- | ----------------------- |
7998e41f4b71Sopenharmony_ci| state   | [TimeLapsePreviewType](#timelapsepreviewtype12)  | Yes  | Preview type.               |
7999e41f4b71Sopenharmony_ci
8000e41f4b71Sopenharmony_ci**Error codes**
8001e41f4b71Sopenharmony_ci
8002e41f4b71Sopenharmony_ciFor details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8003e41f4b71Sopenharmony_ci
8004e41f4b71Sopenharmony_ci| ID        | Error Message       |
8005e41f4b71Sopenharmony_ci| --------------- | --------------- |
8006e41f4b71Sopenharmony_ci| 202     | Not System Application. |
8007e41f4b71Sopenharmony_ci| 7400101                |  Parameter missing or parameter type incorrect.        |
8008e41f4b71Sopenharmony_ci| 7400103                |  Session not config.                                   |
8009e41f4b71Sopenharmony_ci
8010e41f4b71Sopenharmony_ci**Example**
8011e41f4b71Sopenharmony_ci
8012e41f4b71Sopenharmony_ci```ts
8013e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
8014e41f4b71Sopenharmony_ci
8015e41f4b71Sopenharmony_cifunction setTimeLapsePreviewType(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8016e41f4b71Sopenharmony_ci  try {
8017e41f4b71Sopenharmony_ci    timeLapsePhotoSession.setTimeLapsePreviewType(camera.TimeLapsePreviewType.LIGHT);
8018e41f4b71Sopenharmony_ci  } catch (error) {
8019e41f4b71Sopenharmony_ci    // If the operation fails, error.code is returned and processed.
8020e41f4b71Sopenharmony_ci    let err = error as BusinessError;
8021e41f4b71Sopenharmony_ci    console.error(`The setTimeLapsePreviewType call failed. error code: ${err.code}`);
8022e41f4b71Sopenharmony_ci  }
8023e41f4b71Sopenharmony_ci}
8024e41f4b71Sopenharmony_ci```
8025