• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.multimedia.camera (Camera Management) (System API)
2
3The 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.
4
5> **NOTE**
6>
7> - 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.
8> - 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).
9
10## Modules to Import
11
12```ts
13import { camera } from '@kit.CameraKit';
14```
15
16## SceneMode<sup>11+</sup>
17
18Enumerates the camera scene modes.
19
20**System capability**: SystemCapability.Multimedia.Camera.Core
21
22| Name                    | Value       | Description        |
23| ----------------------- | --------- | ------------ |
24| PORTRAIT_PHOTO       | 3      | Portrait photo mode. **System API**: This is a system API.           |
25| NIGHT_PHOTO        | 4      | Night photo mode. **System API**: This is a system API.            |
26| PROFESSIONAL_PHOTO<sup>12+</sup>        | 5      | Professional photo mode. **System API**: This is a system API.            |
27| PROFESSIONAL_VIDEO<sup>12+</sup>        | 6      | Professional video mode. **System API**: This is a system API.            |
28| SLOW_MOTION_VIDEO<sup>12+</sup>        | 7   | Slow-motion video mode. **System API**: This is a system API. |
29| HIGH_RESOLUTION_PHOTO<sup>12+</sup>        | 11     | High-resolution photo mode. **System API**: This is a system API.         |
30| PANORAMA_PHOTO<sup>12+</sup>        | 15     | Panoramic photo mode. **System API**: This is a system API.         |
31| TIME_LAPSE_PHOTO<sup>12+</sup>        | 16     | Time-lapse photo mode. **System API**: This is a system API.         |
32
33## SlowMotionStatus<sup>12+</sup>
34
35Enumerates the slow-motion states.
36
37**System capability**: SystemCapability.Multimedia.Camera.Core
38
39| Name            | Value  | Description           |
40|----------------|-----|---------------|
41| DISABLED       | 0   | Disabled.     |
42| READY          | 1   | Ready.     |
43| VIDEO_START    | 2   | Video start.   |
44| VIDEO_DONE     | 3   | Video complete.   |
45| FINISHED       | 4   | Finished.     |
46
47## LcdFlashStatus<sup>12+</sup>
48
49Describes the LCD flash information.
50
51**System API**: This is a system API.
52
53**System capability**: SystemCapability.Multimedia.Camera.Core
54
55| Name     | Type                         | Read-only| Optional | Description        |
56| -------- | ----------------------------- |---- |-----| ------------- |
57| isLcdFlashNeeded   | boolean | Yes | No  | Whether the LCD flash is required. The value **true** means that the LCD flash is required, and **false** means the opposite.     |
58| lcdCompensation     | number                 | Yes | No  | LCD flash compensation.      |
59
60## Photo<sup>11+</sup>
61
62Defines a higher-resolution image object.
63
64**System API**: This is a system API.
65
66**System capability**: SystemCapability.Multimedia.Camera.Core
67
68| Name  | Type                           | Read-only | Optional      | Description|
69| ------ | ----------------------------- |-----| ---------- | ---------- |
70| raw<sup>12+</sup> | [image.Image](../apis-image-kit/js-apis-image.md#image9)| NA  | Yes  | Raw image.|
71
72## ExposureMode
73
74Enumerates the exposure modes.
75
76**System API**: This is a system API.
77
78**System capability**: SystemCapability.Multimedia.Camera.Core
79
80| Name                          | Value  | Description     |
81| ----------------------------- |-----|---------|
82| EXPOSURE_MODE_MANUAL<sup>12+</sup>          | 3   | Manual exposure mode.|
83
84## PolicyType<sup>12+</sup>
85
86Enumerates the policy types.
87
88**System API**: This is a system API.
89
90**System capability**: SystemCapability.Multimedia.Camera.Core
91
92| Name                          | Value  | Description     |
93| ----------------------------- |-----|---------|
94| PRIVACY<sup>12+</sup>          | 1   | Privacy.|
95
96## LightPaintingType<sup>12+</sup>
97
98Enumerates the types of light painting shutter modes.
99
100**System API**: This is a system API.
101
102**System capability**: SystemCapability.Multimedia.Camera.Core
103
104| Name                          | Value  | Description     |
105| ----------------------------- |-----|---------|
106| TRAFFIC_TRAILS         | 0   | Traffic trails.|
107| STAR_TRAILS          | 1   | Star trails.|
108| SILKY_WATER          | 2   | Silky water.|
109| LIGHT_GRAFFITI          | 3   | Light graffiti.|
110
111## CameraManager
112
113Implements camera management. Before calling any API in **CameraManager**, you must use [getCameraManager](js-apis-camera.md#cameragetcameramanager) to obtain a **CameraManager** instance.
114
115### createDepthDataOutput<sup>13+</sup>
116
117createDepthDataOutput(profile: Profile): DepthDataOutput
118
119Creates a **DepthDataOutput** instance. This API returns the result synchronously.
120
121**System API**: This is a system API.
122
123**System capability**: SystemCapability.Multimedia.Camera.Core
124
125**Parameters**
126
127| Name    | Type                                            | Mandatory| Description                             |
128| -------- | ----------------------------------------------- | ---- | ------------------------------- |
129| profile  | [Profile](js-apis-camera.md#profile)                             | Yes  | Supported preview profile, which is obtained through [getSupportedOutputCapability](js-apis-camera.md#getsupportedoutputcapability11).|
130
131**Return value**
132
133| Type       | Description                         |
134| ---------- | ----------------------------- |
135| [DepthDataOutput](#depthdataoutput13)    | **DepthDataOutput** instance. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
136
137**Error codes**
138
139For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
140
141| ID        | Error Message       |
142| --------------- | --------------- |
143| 7400101                |  Parameter missing or parameter type incorrect.               |
144| 7400201                |  Camera service fatal error.               |
145
146**Example**
147
148```ts
149import { BusinessError } from '@kit.BasicServicesKit';
150
151function createDepthDataOutput(cameraOutputCapability: camera.CameraOutputCapability, cameraManager: camera.CameraManager): camera.DepthDataOutput | undefined {
152  let profile: camera.Profile = cameraOutputCapability.depthProfiles[0];
153  let depthDataOutput: camera.DepthDataOutput | undefined = undefined;
154  try {
155    depthDataOutput = cameraManager.createDepthDataOutput(profile);
156  } catch (error) {
157    // If the operation fails, error.code is returned and processed.
158    let err = error as BusinessError;
159    console.error(`The createDepthDataOutput call failed. error code: ${err.code}`);
160  }
161  return depthDataOutput;
162}
163```
164
165### isCameraMuteSupported
166
167isCameraMuteSupported(): boolean
168
169Checks whether the camera device can be muted.
170
171**System API**: This is a system API.
172
173**System capability**: SystemCapability.Multimedia.Camera.Core
174
175**Return value**
176
177| Type       | Description                         |
178| ---------- | ----------------------------- |
179| boolean    | Check result. The value **true** means that the camera device can be muted, and **false** means the opposite.|
180
181**Example**
182
183```ts
184function isCameraMuteSupported(cameraManager: camera.CameraManager): boolean {
185  let isMuteSupported: boolean = cameraManager.isCameraMuteSupported();
186  return isMuteSupported;
187}
188```
189
190### muteCamera
191
192muteCamera(mute: boolean): void
193
194Mutes or unmutes the camera device.
195
196> **NOTE**
197>
198> This API is supported since API version 10 and deprecated since API version 12. You are advised to use [muteCameraPersistent](#mutecamerapersistent12) instead.
199
200**System API**: This is a system API.
201
202**System capability**: SystemCapability.Multimedia.Camera.Core
203
204**Parameters**
205
206| Name     | Type                             | Mandatory | Description       |
207| -------- | --------------------------------- | ---- | ---------- |
208| mute     | boolean                           |  Yes |  Whether to mute the camera device. The value **true** means to mute the camera device, and **false** means the opposite. |
209
210**Example**
211
212```ts
213function muteCamera(cameraManager: camera.CameraManager): void {
214  let mute: boolean = true;
215  cameraManager.muteCamera(mute);
216}
217```
218
219### muteCameraPersistent<sup>12+</sup>
220
221muteCameraPersistent(mute: boolean, type: PolicyType): void
222
223Disables the camera in a persistent manner.
224
225**System API**: This is a system API.
226
227**System capability**: SystemCapability.Multimedia.Camera.Core
228
229**Parameters**
230
231| Name     | Type                         | Mandatory | Description                                        |
232| -------- |-----------------------------| ---- |--------------------------------------------|
233| mute     | boolean                     |  Yes | Whether to mute the camera device. The value **true** means to mute the camera device, and **false** means the opposite.                  |
234| type     | [PolicyType](#policytype12) |  Yes | Policy type. For details about the available options, see [PolicyType](#policytype12).|
235
236**Example**
237
238```ts
239function muteCameraPersistent(cameraManager: camera.CameraManager): void {
240  let mute: boolean = true;
241  cameraManager.muteCameraPersistent(mute, camera.PolicyType.PRIVACY);
242}
243```
244
245### on('cameraMute')
246
247on(type: 'cameraMute', callback: AsyncCallback\<boolean\>): void
248
249Subscribes to camera mute status events. This API uses an asynchronous callback to return the result.
250
251**System API**: This is a system API.
252
253**System capability**: SystemCapability.Multimedia.Camera.Core
254
255**Parameters**
256
257| Name    | Type            | Mandatory| Description      |
258| -------- | --------------- | ---- | --------- |
259| 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.|
260| callback | AsyncCallback\<boolean> | Yes  | Callback used to return the camera mute status. The value **true** means that the camera mute status is enabled, and **false** means that it is disabled.              |
261
262**Example**
263
264```ts
265import { BusinessError } from '@kit.BasicServicesKit';
266
267function callback(err: BusinessError, curMuted: boolean): void {
268  if (err !== undefined && err.code !== 0) {
269    console.error(`Callback Error, errorCode: ${err.code}`);
270    return;
271  }
272  let isMuted: boolean = curMuted;
273  console.info(`cameraMute status: ${isMuted}`);
274}
275
276function registerCameraMute(cameraManager: camera.CameraManager): void {
277  cameraManager.on('cameraMute', callback);
278}
279```
280
281### off('cameraMute')
282
283off(type: 'cameraMute', callback?: AsyncCallback\<boolean\>): void
284
285Unsubscribes from camera mute status events.
286
287**System API**: This is a system API.
288
289**System capability**: SystemCapability.Multimedia.Camera.Core
290
291**Parameters**
292
293| Name    | Type            | Mandatory| Description                                                     |
294| -------- | --------------- | ---- |---------------------------------------------------------|
295| 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.|
296| callback | AsyncCallback\<boolean> | No  | Callback used to return the camera mute status. The value **true** means that the camera mute status is enabled, and **false** means that it is disabled. 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.)                 |
297
298**Example**
299
300```ts
301import { BusinessError } from '@kit.BasicServicesKit';
302
303function callback(err: BusinessError, curMuted: boolean): void {
304  let isMuted: boolean = curMuted;
305}
306
307function unregisterCameraMute(cameraManager: camera.CameraManager): void {
308  cameraManager.off('cameraMute', callback);
309}
310```
311
312### isPrelaunchSupported
313
314isPrelaunchSupported(camera: CameraDevice): boolean
315
316Checks whether a camera device supports prelaunch.
317
318**System API**: This is a system API.
319
320**System capability**: SystemCapability.Multimedia.Camera.Core
321
322**Parameters**
323
324| Name    | Type                                              | Mandatory| Description      |
325| -------- |--------------------------------------------------| ---- | --------- |
326| camera | [CameraDevice](./js-apis-camera.md#cameradevice) | Yes| Camera device.|
327
328**Return value**
329
330| Type| Description|
331| -------- | --------------- |
332| boolean | Check result. The value **true** means that the camera device supports prelaunch, and **false** means the opposite.|
333
334**Error codes**
335
336For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
337
338| ID        | Error Message       |
339| --------------- | --------------- |
340| 202 | Not System Application. |
341| 7400101 | Parameter missing or parameter type incorrect. |
342
343**Example**
344
345```ts
346import { common } from '@kit.AbilityKit';
347
348function isPreLaunchSupported(context: common.BaseContext): boolean {
349  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
350  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
351  let isSupported: boolean = false;
352  if (cameras && cameras.length >= 1) {
353    isSupported = cameraManager.isPrelaunchSupported(cameras[0]);
354    console.info(`PreLaunch supported states: ${isSupported}`);
355    return isSupported;
356  }
357  return isSupported;
358}
359```
360
361### setPrelaunchConfig
362
363setPrelaunchConfig(prelaunchConfig: PrelaunchConfig): void
364
365Sets prelaunch configuration.
366
367Before the setting, call [isPrelaunchSupported](#isprelaunchsupported) to check whether the camera device supports prelaunch.
368
369**System API**: This is a system API.
370
371**Required permissions**: ohos.permission.CAMERA
372
373**System capability**: SystemCapability.Multimedia.Camera.Core
374
375**Parameters**
376
377| Name    | Type            | Mandatory| Description      |
378| -------- | --------------- | ---- | --------- |
379| prelaunchConfig | [PrelaunchConfig](#prelaunchconfig) | Yes| Prelaunch configuration.|
380
381**Error codes**
382
383For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
384
385| ID        | Error Message       |
386| --------------- | --------------- |
387| 202 | Not System Application. |
388| 7400101 | Parameter missing or parameter type incorrect. |
389| 7400102 | Operation not allowed. |
390| 7400201 | Camera service fatal error. |
391
392**Example**
393
394```ts
395import { common } from '@kit.AbilityKit';
396import { BusinessError } from '@kit.BasicServicesKit';
397
398function setPrelaunchConfig(context: common.BaseContext): void {
399  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
400  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
401  if (cameras && cameras.length >= 1) {
402    let cameraDevice: camera.CameraDevice = cameras[0];
403    if(cameraManager.isPrelaunchSupported(cameraDevice)) {
404      try {
405        cameraManager.setPrelaunchConfig({cameraDevice: cameraDevice});
406      } catch (error) {
407        let err = error as BusinessError;
408        console.error(`setPrelaunchConfig error. Code: ${err.code}, message: ${err.message}`);
409      }
410    }
411  }
412}
413```
414
415### prelaunch
416
417prelaunch(): void
418
419Prelaunches the camera device. This API is called when a user clicks the system camera icon to start the camera application.
420
421**System API**: This is a system API.
422
423**System capability**: SystemCapability.Multimedia.Camera.Core
424
425**Example**
426
427```ts
428import { common } from '@kit.AbilityKit';
429import { BusinessError } from '@kit.BasicServicesKit';
430
431function preLaunch(context: common.BaseContext): void {
432  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
433  try {
434    cameraManager.prelaunch();
435  } catch (error) {
436    let err = error as BusinessError;
437    console.error(`prelaunch error. Code: ${err.code}, message: ${err.message}`);
438  }
439}
440```
441
442### createDeferredPreviewOutput
443
444createDeferredPreviewOutput(profile: Profile): PreviewOutput
445
446Creates a deferred **PreviewOutput** instance and adds it, instead of a common **PreviewOutput** instance, to the data stream during stream configuration.
447
448**System API**: This is a system API.
449
450**System capability**: SystemCapability.Multimedia.Camera.Core
451
452**Parameters**
453
454| Name    | Type            | Mandatory| Description      |
455| -------- | --------------- | ---- | --------- |
456| profile | [Profile](js-apis-camera.md#profile) | Yes| Configuration file of the camera preview stream.|
457
458**Return value**
459
460| Type| Description|
461| -------- | --------------- |
462| [PreviewOutput](#previewoutput) | **PreviewOutput** instance obtained.|
463
464**Error codes**
465
466For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
467
468| ID        | Error Message       |
469| --------------- | --------------- |
470| 202         	  |  Not System Application.       |
471| 7400101 	      |  Parameter missing or parameter type incorrect. |
472
473**Example**
474
475```ts
476import { common } from '@kit.AbilityKit';
477
478function getDeferredPreviewOutput(context: common.BaseContext, previewProfile: camera.Profile): camera.PreviewOutput {
479  const cameraManager: camera.CameraManager = camera.getCameraManager(context);
480  const output: camera.PreviewOutput = cameraManager.createDeferredPreviewOutput(previewProfile);
481  return output;
482}
483```
484
485### preSwitchCamera<sup>11+</sup>
486
487preSwitchCamera(cameraId: string): void
488
489Pre-switches a camera device to speed up its startup.
490
491**System API**: This is a system API.
492
493**System capability**: SystemCapability.Multimedia.Camera.Core
494
495**Parameters**
496
497| Name    | Type            | Mandatory| Description      |
498| -------- | --------------- | ---- | --------- |
499| cameraId | string | Yes| Camera ID.|
500
501**Error codes**
502
503For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
504
505| ID  | Error Message                                          |
506| ------- |------------------------------------------------|
507| 202     | Not System Application.                        |
508| 7400101 | Parameter missing or parameter type incorrect. |
509| 7400201 | Camera service fatal error.                    |
510
511**Example**
512
513```ts
514import { common } from '@kit.AbilityKit';
515import { BusinessError } from '@kit.BasicServicesKit';
516
517function preSwitch(cameraDevice: camera.CameraDevice, context: common.BaseContext): void {
518  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
519  try {
520    cameraManager.preSwitchCamera(cameraDevice.cameraId);
521  } catch (error) {
522    let err = error as BusinessError;
523    console.error(`prelaunch error. Code: ${err.code}, message: ${err.message}`);
524  }
525}
526```
527
528## CameraOcclusionDetectionResult<sup>12+</sup>
529Describes the status indicating whether the camera is occluded.
530
531**System API**: This is a system API.
532
533**System capability**: SystemCapability.Multimedia.Camera.Core
534
535| Name                          | Type                                               | Read-only| Optional| Description               |
536| ----------------------------- | --------------------------------------------------- | ---- | ---- |-------------------|
537| isCameraOccluded                 | boolean              |  Yes | No|Whether the camera is occluded. The value **true** means that the camera is occluded, and **false** means the opposite.       |
538
539## CameraOutputCapability<sup>13+</sup>
540
541Describes the camera output capability.
542
543**System API**: This is a system API.
544
545**System capability**: SystemCapability.Multimedia.Camera.Core
546
547| Name                          | Type                                               | Read-only| Optional| Description               |
548| ----------------------------- | --------------------------------------------------- | ---- | ---- |-------------------|
549| depthProfiles                 | Array\<[DepthProfile](#depthprofile13)\>              |  Yes | No| Supported depth stream profiles.       |
550
551## CameraFormat
552
553Enumerates the camera output formats.
554
555**System API**: This is a system API.
556
557**System capability**: SystemCapability.Multimedia.Camera.Core
558
559| Name                    | Value       | Description        |
560| ----------------------- | --------- | ------------ |
561| CAMERA_FORMAT_DEPTH_16<sup>13+</sup> |   3000   | Depth map in DEPTH_16 format.     |
562| CAMERA_FORMAT_DEPTH_32<sup>13+</sup> |   3001   | Depth map in DEPTH_32 format.     |
563
564## CameraInput
565
566Defines the camera input object.
567
568It provides camera device information used in [Session](js-apis-camera.md#session11).
569
570### on('cameraOcclusionDetection')<sup>12+</sup>
571
572on(type: 'cameraOcclusionDetection', callback: AsyncCallback\<CameraOcclusionDetectionResult\>): void
573
574Subscribes to CameraInput occlusion events. This API uses an asynchronous callback to return the result.
575
576**System capability**: SystemCapability.Multimedia.Camera.Core
577
578**Parameters**
579
580| Name    | Type                             | Mandatory| Description                                         |
581| -------- | -------------------------------- | --- | ------------------------------------------- |
582| type     | string                           | Yes  | Event type. The value is fixed at **'cameraOcclusionDetection'**. The event can be listened for when a **CameraInput** instance is created. It is triggered when the occlusion status of the camera module changes, and the occlusion status is returned.|
583| callback | AsyncCallback\<[CameraOcclusionDetectionResult](#cameraocclusiondetectionresult12)\> | Yes  | Callback used to return the occlusion status. |
584
585**Example**
586
587```ts
588import { BusinessError } from '@kit.BasicServicesKit';
589
590function callback(err: BusinessError, CameraOcclusionDetectionResult: camera.CameraOcclusionDetectionResult): void {
591  if (err !== undefined && err.code !== 0) {
592    console.error('cameraOcclusionDetection with errorCode = ' + err.code);
593    return;
594  }
595  console.info(`isCameraOccluded : ${CameraOcclusionDetectionResult.isCameraOccluded}`);
596}
597
598function registerCameraOcclusionDetection(cameraInput: camera.CameraInput): void {
599  cameraInput.on('cameraOcclusionDetection', callback);
600}
601```
602
603### off('cameraOcclusionDetection')<sup>12+</sup>
604
605off(type: 'cameraOcclusionDetection', callback?: AsyncCallback\<CameraOcclusionDetectionResult\>): void
606
607Unsubscribes from CameraInput occlusion events.
608
609**System capability**: SystemCapability.Multimedia.Camera.Core
610
611**Parameters**
612
613| Name    | Type            | Mandatory| Description                                                     |
614| -------- | --------------- | ---- |---------------------------------------------------------|
615| type     | string          | Yes  | Event type. The value is fixed at **'cameraOcclusionDetection'**. The event can be listened for when a **CameraInput** instance is created.|
616| callback | AsyncCallback\<[CameraOcclusionDetectionResult](#cameraocclusiondetectionresult12)\> | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('cameraOcclusionDetection')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)                 |
617
618**Example**
619
620```ts
621import { BusinessError } from '@kit.BasicServicesKit';
622
623function callback(err: BusinessError, CameraOcclusionDetectionResult: camera.CameraOcclusionDetectionResult): void {
624  if (err !== undefined && err.code !== 0) {
625    console.error('cameraOcclusionDetection with errorCode = ' + err.code);
626    return;
627  }
628  console.info(`isCameraOccluded : ${CameraOcclusionDetectionResult.isCameraOccluded}`);
629}
630
631function unregisterCameraOcclusionDetection(cameraInput: camera.CameraInput): void {
632  cameraInput.off('cameraOcclusionDetection', callback);
633}
634```
635
636## DepthDataAccuracy<sup>13+</sup>
637
638Describes the accuracy of depth data.
639
640**System API**: This is a system API.
641
642**System capability**: SystemCapability.Multimedia.Camera.Core
643
644| Name     | Type                         | Read-only| Optional| Description           |
645| -------- | ----------------------------- |----- |---| -------------- |
646| DEPTH_DATA_ACCURACY_RELATIVE      | number                        |  Yes | No| Relative accuracy, which is the depth map calculated based on the disparity.     |
647| DEPTH_DATA_ACCURACY_ABSOLUTE      | number                        |  Yes | No| Absolute accuracy, which is the depth map calculated from distance measurement.     |
648
649## DepthProfile<sup>13+</sup>
650
651Describes the profile of depth data. It inherits from [Profile](js-apis-camera.md#profile).
652
653**System API**: This is a system API.
654
655**System capability**: SystemCapability.Multimedia.Camera.Core
656
657| Name                      | Type                                     | Read-only| Optional| Description       |
658| ------------------------- | ----------------------------------------- | --- | ---- |----------- |
659| depthDataAccuracy            | [DepthDataAccuracy](#depthdataaccuracy13)         | Yes |  No | Accuracy of the depth data, which can be either relative accuracy or absolute accuracy.|
660
661## DepthDataQualityLevel<sup>13+</sup>
662
663Enumerates the quality levels of depth data.
664
665**System API**: This is a system API.
666
667**System capability**: SystemCapability.Multimedia.Camera.Core
668
669| Name     | Type                         | Read-only| Optional| Description           |
670| -------- | ----------------------------- |----- |---| -------------- |
671| DEPTH_DATA_QUALITY_BAD     | number            |  Yes | No| The depth map is of poor quality and cannot be used for blurring.     |
672| DEPTH_DATA_QUALITY_FAIR      | number          |  Yes | No| The depth map is of average quality and cannot be used for high-quality blurring.     |
673| DEPTH_DATA_QUALITY_GOOD      | number          |  Yes | No| The depth map is of high quality and can be used for high-quality blurring.     |
674
675## DepthData<sup>13+</sup>
676
677Describes a depth data object.
678
679### Properties
680
681**System API**: This is a system API.
682
683**System capability**: SystemCapability.Multimedia.Camera.Core
684
685| Name     | Type                         | Read-only| Optional| Description           |
686| -------- | ----------------------------- |----- |---| -------------- |
687| format | [CameraFormat](#cameraformat)   | Yes|  No | Camera output format.|
688| depthMap | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)    | Yes|  No | Depth map.|
689| qualityLevel | [DepthDataQualityLevel](#depthdataqualitylevel13)   | Yes|  No | Quality level of the depth map.|
690| accuracy | [DepthDataAccuracy](#depthdataaccuracy13) | Yes|  No | Accuracy of the depth map.|
691
692### release<sup>13+</sup>
693
694release(): void
695
696Releases depth data output resources.
697
698**System API**: This is a system API.
699
700**System capability**: SystemCapability.Multimedia.Camera.Core
701
702**Example**
703
704```ts
705function releaseDepthData(depthData: camera.DepthData): void {
706  await depthData.release();
707}
708```
709
710## DepthDataOutput<sup>13+</sup>
711
712Implements depth data output. It inherits from [CameraOutput](js-apis-camera.md#cameraoutput).
713
714### start<sup>13+</sup>
715
716start(): Promise\<void\>
717
718Starts a depth data output stream. This API uses a promise to return the result.
719
720**System API**: This is a system API.
721
722**System capability**: SystemCapability.Multimedia.Camera.Core
723
724**Return value**
725
726| Type           | Description                    |
727| -------------- | ----------------------- |
728| Promise\<void\> | Promise that returns no value.|
729
730**Error codes**
731
732For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
733
734| ID        | Error Message       |
735| --------------- | --------------- |
736| 7400103                |  Session not config.                                   |
737| 7400201                |  Camera service fatal error.                           |
738
739**Example**
740
741```ts
742import { BusinessError } from '@kit.BasicServicesKit';
743
744function startDepthDataOutput(depthDataOutput: camera.DepthDataOutput): void {
745  depthDataOutput.start().then(() => {
746    console.info('Promise returned to indicate that start method execution success.');
747  }).catch((error: BusinessError) => {
748    console.error(`Failed to depth data output start, error code: ${error.code}.`);
749  });
750}
751```
752
753### stop<sup>13+</sup>
754
755stop(): Promise\<void\>
756
757Stops a depth data output stream. This API uses a promise to return the result.
758
759**System API**: This is a system API.
760
761**System capability**: SystemCapability.Multimedia.Camera.Core
762
763**Return value**
764
765| Type           | Description                    |
766| -------------- | ----------------------- |
767| Promise\<void\> | Promise that returns no value.|
768
769**Example**
770
771```ts
772import { BusinessError } from '@kit.BasicServicesKit';
773
774function stopDepthDataOutput(depthDataOutput: camera.DepthDataOutput): void {
775  depthDataOutput.stop().then(() => {
776    console.info('Promise returned to indicate that stop method execution success.');
777  }).catch((error: BusinessError) => {
778    console.error(`Failed to depth data output stop, error code: ${error.code}.`);
779  });
780}
781```
782
783### on('depthDataAvailable')<sup>13+</sup>
784
785on(type: 'depthDataAvailable', callback: AsyncCallback\<DepthData\>): void
786
787Subscribes to depth data availability events. This API uses an asynchronous callback to return the result.
788
789> **NOTE**
790>
791> Currently, you cannot use **off()** to unregister the callback in the callback method of **on()**.
792
793**System API**: This is a system API.
794
795**System capability**: SystemCapability.Multimedia.Camera.Core
796
797**Parameters**
798
799| Name    | Type     | Mandatory| Description                                 |
800| -------- | ---------- | --- | ------------------------------------ |
801| type     | string     | Yes  | Event type. The value is fixed at **'depthDataAvailable'**. The event can be listened for when a **depthDataOutput** instance is created.|
802| callback | AsyncCallback\<[DepthData](#depthdata13)\> | Yes  | Callback used to listen for depth data.|
803
804**Example**
805
806```ts
807import { BusinessError } from '@kit.BasicServicesKit';
808
809function callback(err: BusinessError, depthData: camera.DepthData): void {
810  if (err !== undefined && err.code !== 0) {
811    console.error(`Callback Error, errorCode: ${err.code}`);
812    return;
813  }
814}
815
816function registerDepthDataAvailable(depthDataOutput: camera.DepthDataOutput): void {
817  depthDataOutput.on('depthDataAvailable', callback);
818}
819```
820
821### off('depthDataAvailable')<sup>13+</sup>
822
823off(type: 'depthDataAvailable', callback?: AsyncCallback\<DepthData\>): void
824
825Unsubscribes from depth data availability events.
826
827**System API**: This is a system API.
828
829**System capability**: SystemCapability.Multimedia.Camera.Core
830
831**Parameters**
832
833| Name     | Type                   | Mandatory| Description                                      |
834| -------- | ---------------------- | ---- | ------------------------------------------ |
835| type     | string                 | Yes  | Event type. The value is fixed at **'depthDataAvailable'**. The event can be listened for when a **depthDataOutput** instance is created.|
836| callback | AsyncCallback\<[DepthData](#depthdata13)\> | 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.|
837
838**Example**
839
840```ts
841import { BusinessError } from '@kit.BasicServicesKit';
842
843function callback(err: BusinessError, depthData: camera.DepthData): void {
844  if (err !== undefined && err.code !== 0) {
845    console.error(`Callback Error, errorCode: ${err.code}`);
846    return;
847  }
848}
849
850function unRegisterDepthDataAvailable(depthDataOutput: camera.DepthDataOutput): void {
851  depthDataOutput.off('depthDataAvailable', callback);
852}
853```
854
855### on('error')<sup>13+</sup>
856
857on(type: 'error', callback: ErrorCallback): void
858
859Subscribes to **DepthDataOutput** error events. This API uses an asynchronous callback to return the result.
860
861> **NOTE**
862>
863> Currently, you cannot use **off()** to unregister the callback in the callback method of **on()**.
864
865**System API**: This is a system API.
866
867**System capability**: SystemCapability.Multimedia.Camera.Core
868
869**Parameters**
870
871| Name    | Type        | Mandatory| Description                      |
872| -------- | --------------| ---- | ------------------------ |
873| type     | string        | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a **depthDataOutput** instance is created.|
874| 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). |
875
876**Example**
877
878```ts
879import { BusinessError } from '@kit.BasicServicesKit';
880
881function callback(depthDataOutputError: BusinessError): void {
882  console.error(`Depth data output error code: ${depthDataOutputError.code}`);
883}
884
885function registerDepthDataOutputError(depthDataOutput: camera.DepthDataOutput): void {
886  depthDataOutput.on('error', callback)
887}
888```
889
890### off('error')<sup>13+</sup>
891
892off(type: 'error', callback?: ErrorCallback): void
893
894Unsubscribes from **DepthDataOutput** error events.
895
896**System API**: This is a system API.
897
898**System capability**: SystemCapability.Multimedia.Camera.Core
899
900**Parameters**
901
902| Name    | Type        | Mandatory| Description                      |
903| -------- | --------------| ---- | ------------------------ |
904| type     | string        | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a **depthDataOutput** instance is created.|
905| 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.|
906
907**Example**
908
909```ts
910function unregisterDepthDataOutputError(depthDataOutput: camera.DepthDataOutput): void {
911  depthDataOutput.off('error');
912}
913```
914
915## PrelaunchConfig
916
917Defines the camera prelaunch configuration.
918
919Currently, the configuration is used for sensor-level prelaunch. It will be used for stream-level prelaunch in a later version.
920
921**System API**: This is a system API.
922
923**System capability**: SystemCapability.Multimedia.Camera.Core
924
925|            Name                | Type                                              |     Read-only   |     Mandatory    | Description      |
926| ------------------------------- |--------------------------------------------------| ----------- | ------------ | ---------- |
927| cameraDevice                    | [CameraDevice](./js-apis-camera.md#cameradevice) |      No    |       Yes     | Camera device.        |
928| restoreParamType<sup>11+</sup>  | [RestoreParamType](#restoreparamtype11)          |      No    |       No     | Type of the parameter used for prelaunch.   |
929| activeTime<sup>11+</sup>        | number                                           |      No    |       No     | Activation time, in minutes.|
930| settingParam<sup>11+</sup>      | [SettingParam](#settingparam11)                  |      No    |       No     | Setting parameter.     |
931
932## RestoreParamType<sup>11+</sup>
933
934Enumerates the types of the parameters used for prelaunch.
935
936**System API**: This is a system API.
937
938**System capability**: SystemCapability.Multimedia.Camera.Core
939
940| Name            | Value   | Description    |
941| ----------------| ----  | ---------|
942| NO_NEED_RESTORE_PARAM           | 0      | The parameter used for prelaunch is not required.    |
943| PRESISTENT_DEFAULT_PARAM    | 1      | Persistent parameter type. This parameter is used to restore stream information with the specified time point.    |
944| 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.    |
945
946## SettingParam<sup>11+</sup>
947
948Defines the effect parameters used to preheat an image.
949
950**System API**: This is a system API.
951
952**System capability**: SystemCapability.Multimedia.Camera.Core
953
954| Name            | Type  |   Read-only   | Optional | Description                                                                                               |
955| --------------- | ------ | --------- |-----|---------------------------------------------------------------------------------------------------|
956| skinSmoothLevel | number |  No      | No  | Skin smoothing level, which is obtained through [Beauty.getSupportedBeautyRange](#getsupportedbeautyrange11). For example, the value **1** indicates level-1 smoothing.       |
957| faceSlender     | number |  No      | No  | Face slimming level, which is obtained through [Beauty.getSupportedBeautyRange](#getsupportedbeautyrange11). For example, the value **1** indicates level-1 slimming.       |
958| skinTone        | number |  No      | No  | Skin tone perfection level, which is obtained through [Beauty.getSupportedBeautyRange](#getsupportedbeautyrange11). For example, the value **0xBF986C** indicates a specific color.|
959
960## PreviewOutput
961
962Implements preview output. It inherits from [CameraOutput](js-apis-camera.md#cameraoutput).
963
964### addDeferredSurface
965
966addDeferredSurface(surfaceId: string): void
967
968Adds 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.
969
970**System API**: This is a system API.
971
972**System capability**: SystemCapability.Multimedia.Camera.Core
973
974**Parameters**
975
976| Name    | Type        | Mandatory| Description                      |
977| -------- | --------------| ---- | ------------------------ |
978| surfaceId | string | Yes| Surface ID, which is obtained from [XComponent](../apis-arkui/arkui-ts/ts-basic-components-xcomponent.md).|
979
980**Error codes**
981
982For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
983
984| ID        | Error Message       |
985| --------------- | --------------- |
986| 7400101                |  Parameter missing or parameter type incorrect.        |
987
988**Example**
989
990```ts
991import { common } from '@kit.AbilityKit';
992
993async function preview(context: common.BaseContext, cameraDevice: camera.CameraDevice, previewProfile: camera.Profile, photoProfile: camera.Profile, mode: camera.SceneMode, previewSurfaceId: string): Promise<void> {
994  const cameraManager: camera.CameraManager = camera.getCameraManager(context);
995  const cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameraDevice);
996  const previewOutput: camera.PreviewOutput = cameraManager.createDeferredPreviewOutput(previewProfile);
997  const photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
998  const session: camera.Session  = cameraManager.createSession(mode);
999  session.beginConfig();
1000  session.addInput(cameraInput);
1001  session.addOutput(previewOutput);
1002  session.addOutput(photoOutput);
1003  await session.commitConfig();
1004  await session.start();
1005  previewOutput.addDeferredSurface(previewSurfaceId);
1006}
1007```
1008
1009### isSketchSupported<sup>11+</sup>
1010
1011isSketchSupported(): boolean
1012
1013Checks whether Picture-in-Picture (PiP) preview is supported.
1014
1015**System API**: This is a system API.
1016
1017**System capability**: SystemCapability.Multimedia.Camera.Core
1018
1019**Return value**
1020
1021| Type           | Description                    |
1022| -------------- | ----------------------- |
1023| boolean | Check result. The value **true** means that the PiP preview is supported, and **false** means the opposite.|
1024
1025**Error codes**
1026
1027For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1028
1029| ID        | Error Message                   |
1030| --------------- |-------------------------|
1031| 202             | Not System Application. |
1032
1033**Example**
1034
1035```ts
1036function isSketchSupported(previewOutput: camera.PreviewOutput): boolean {
1037  try {
1038    let isSupported: boolean = previewOutput.isSketchSupported();
1039    return isSupported;
1040  } catch (error) {
1041    // If the operation fails, error.code is returned and processed.
1042    let err = error as BusinessError;
1043    console.error(`The isSketchSupported call failed. error code: ${err.code}`);
1044  }
1045  return false;
1046}
1047```
1048
1049### getSketchRatio<sup>11+</sup>
1050
1051getSketchRatio(): number
1052
1053Obtains the zoom ratio when PiP preview is enabled.
1054
1055**System API**: This is a system API.
1056
1057**System capability**: SystemCapability.Multimedia.Camera.Core
1058
1059**Return value**
1060
1061| Type           | Description                    |
1062| -------------- | ----------------------- |
1063| number | Zoom ratio obtained. If PiP preview is not supported, the value **-1** is returned.|
1064
1065**Error codes**
1066
1067For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1068
1069| ID        | Error Message       |
1070| --------------- | --------------- |
1071| 7400103         |  Session not config.                      |
1072| 202             |  Not System Application.                  |
1073
1074**Example**
1075
1076```ts
1077function getSketchRatio(previewOutput: camera.PreviewOutput): number {
1078  let sketchRatio: number = previewOutput.getSketchRatio();
1079  return sketchRatio;
1080}
1081```
1082
1083### enableSketch<sup>11+</sup>
1084
1085enableSketch(enabled: boolean): void
1086
1087Enables or disables PiP preview.
1088
1089**System API**: This is a system API.
1090
1091**System capability**: SystemCapability.Multimedia.Camera.Core
1092
1093**Parameters**
1094
1095| Name    | Type     | Mandatory| Description                      |
1096|---------|---------| ---- | ------------------------ |
1097| enabled | boolean | Yes| Whether to enable or disable PiP view. The value **true** means to enable PiP view, and **false** means to disable it.|
1098
1099**Error codes**
1100
1101For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1102
1103| ID    | Error Message                       |
1104|-----------|-----------------------------|
1105| 202       | Not System Application.     |
1106| 7400102   | Operation not allowed.      |
1107| 7400103   | Session not config.         |
1108| 7400201   | Camera service fatal error. |
1109
1110**Example**
1111
1112```ts
1113import { BusinessError } from '@kit.BasicServicesKit';
1114
1115function enableSketch(previewOutput: camera.PreviewOutput, session: camera.Session, cameraInput: camera.CameraInput): void {
1116  try {
1117    session.beginConfig();
1118    session.addInput(cameraInput);
1119    session.addOutput(previewOutput);
1120    previewOutput.enableSketch(true);
1121    session.commitConfig();
1122  } catch (error) {
1123    // If the operation fails, error.code is returned and processed.
1124    let err = error as BusinessError;
1125    console.error(`The enableSketch call failed. error code: ${err.code}`);
1126  }
1127}
1128```
1129
1130### attachSketchSurface<sup>11+</sup>
1131
1132attachSketchSurface(surfaceId: string): void
1133
1134Attaches a surface for PiP preview.
1135
1136**System API**: This is a system API.
1137
1138**System capability**: SystemCapability.Multimedia.Camera.Core
1139
1140**Parameters**
1141
1142| Name    | Type        | Mandatory| Description                      |
1143| -------- | --------------| ---- | ------------------------ |
1144| surfaceId | string | Yes| Surface ID, which is obtained from [XComponent](../apis-arkui/arkui-ts/ts-basic-components-xcomponent.md).|
1145
1146**Error codes**
1147
1148For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1149
1150| ID  | Error Message                                          |
1151|---------|------------------------------------------------|
1152| 202     | Not System Application.                        |
1153| 7400101 | Parameter missing or parameter type incorrect. |
1154| 7400103 | Session not config.                            |
1155| 7400201 | Camera service fatal error.                    |
1156
1157**Example**
1158
1159```ts
1160import { BusinessError } from '@kit.BasicServicesKit';
1161
1162function attachSketchSurface(previewOutput: camera.PreviewOutput, session: camera.Session, cameraInput: camera.CameraInput, sketchSurfaceId: string): void {
1163  try {
1164    session.beginConfig();
1165    session.addInput(cameraInput);
1166    session.addOutput(previewOutput);
1167    previewOutput.enableSketch(true);
1168    session.commitConfig();
1169    previewOutput.attachSketchSurface(sketchSurfaceId);
1170  } catch (error) {
1171    // If the operation fails, error.code is returned and processed.
1172    let err = error as BusinessError;
1173    console.error(`The attachSketchSurface call failed. error code: ${err.code}`);
1174  }
1175}
1176```
1177
1178### on('sketchStatusChanged')<sup>11+</sup>
1179
1180on(type: 'sketchStatusChanged', callback: AsyncCallback\<SketchStatusData\>): void
1181
1182Subscribes to PiP status change events. This API uses an asynchronous callback to return the result.
1183
1184**System API**: This is a system API.
1185
1186**System capability**: SystemCapability.Multimedia.Camera.Core
1187
1188**Parameters**
1189
1190| Name     | Type                   | Mandatory| Description                                      |
1191| -------- | ---------------------- | ---- | ------------------------------------------ |
1192| 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.|
1193| callback | AsyncCallback\<[SketchStatusData](#sketchstatusdata11)\> | Yes  | Callback used to return the PiP status data.           |
1194
1195**Error codes**
1196
1197For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1198
1199| ID  | Error Message                         |
1200|---------|-------------------------------|
1201| 202     | Not System Application.       |
1202
1203**Example**
1204
1205```ts
1206import { BusinessError } from '@kit.BasicServicesKit';
1207
1208function callback(error: BusinessError, data: camera.SketchStatusData): void {
1209  if (error !== undefined && error.code !== 0) {
1210    console.error(`Callback Error, errorCode: ${error.code}`);
1211    return;
1212  }
1213  console.info(`sketch errorCode is ${error.code}, data is ${JSON.stringify(data)}`);
1214}
1215
1216function registerSketchStatusChanged(previewOutput: camera.PreviewOutput): void {
1217  previewOutput.on('sketchStatusChanged', callback);
1218}
1219```
1220
1221### off('sketchStatusChanged')<sup>11+</sup>
1222
1223off(type: 'sketchStatusChanged', callback?: AsyncCallback\<SketchStatusData\>): void
1224
1225Unsubscribes from PiP status change events.
1226
1227**System API**: This is a system API.
1228
1229**System capability**: SystemCapability.Multimedia.Camera.Core
1230
1231**Parameters**
1232
1233| Name     | Type                   | Mandatory| Description                                      |
1234| -------- | ---------------------- | ---- | ------------------------------------------ |
1235| type     | string                 | Yes  | Event type. The value is fixed at **'sketchStatusChanged'**. The event can be listened for when a PiP preview stream is created.|
1236| 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.)          |
1237
1238**Error codes**
1239
1240For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1241
1242| ID  | Error Message                         |
1243|---------|-------------------------------|
1244| 202     | Not System Application.       |
1245
1246**Example**
1247
1248```ts
1249function unregisterSketchStatusChanged(previewOutput: camera.PreviewOutput): void {
1250  previewOutput.off('sketchStatusChanged');
1251}
1252```
1253
1254## DeferredDeliveryImageType<sup>11+</sup>
1255
1256Enumerates 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.
1257
1258**System API**: This is a system API.
1259
1260**System capability**: SystemCapability.Multimedia.Camera.Core
1261
1262| Name   | Value  | Description        |
1263| ------- | ---- | ------------ |
1264| NONE    | 0    | Deferred delivery is not supported.|
1265| PHOTO   | 1    | Deferred delivery for photo capture.|
1266| VIDEO   | 2    | Deferred delivery for video capture.|
1267
1268## DeferredPhotoProxy<sup>11+</sup>
1269
1270A class object that functions as a thumbnail proxy.
1271
1272### getThumbnail<sup>11+</sup>
1273
1274getThumbnail(): Promise<image.PixelMap>
1275
1276Obtains the PixelMap of a thumbnail.
1277
1278**System API**: This is a system API.
1279
1280**System capability**: SystemCapability.Multimedia.Camera.Core
1281
1282**Return value**
1283
1284| Type           | Description                    |
1285| -------------- | ----------------------- |
1286| Promise\<image.PixelMap\> | PixelMap of the thumbnail.|
1287
1288**Error codes**
1289
1290For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1291
1292| ID        | Error Message       |
1293| --------------- | --------------- |
1294| 202         	  |  Not System Application.       |
1295
1296**Example**
1297
1298```ts
1299import { image } from '@kit.ImageKit';
1300
1301function getThumbnail(proxyObj: camera.DeferredPhotoProxy): void {
1302  proxyObj.getThumbnail().then((thumbnail: image.PixelMap) => {
1303    AppStorage.setOrCreate('proxyThumbnail', thumbnail);
1304  });
1305}
1306```
1307
1308### release<sup>11+</sup>
1309
1310release(): Promise\<void\>
1311
1312Releases output resources. This API uses a promise to return the result.
1313
1314**System API**: This is a system API.
1315
1316**System capability**: SystemCapability.Multimedia.Camera.Core
1317
1318**Return value**
1319
1320| Type           | Description              |
1321| -------------- |------------------|
1322| Promise\<void\> | Promise that returns no value.|
1323
1324**Error codes**
1325
1326For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1327
1328| ID        | Error Message       |
1329| --------------- | --------------- |
1330| 202         	  |  Not System Application.       |
1331
1332**Example**
1333
1334```ts
1335async function releaseDeferredPhotoProxy(proxyObj: camera.DeferredPhotoProxy): Promise<void> {
1336  await proxyObj.release();
1337}
1338```
1339
1340## PhotoOutput
1341
1342Implements output information used in a photo session. It inherits from [CameraOutput](js-apis-camera.md#cameraoutput).
1343
1344### burstCapture<sup>12+</sup>
1345
1346burstCapture(setting: PhotoCaptureSetting): Promise\<void\>
1347
1348Starts 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.
1349
1350**System API**: This is a system API.
1351
1352**System capability**: SystemCapability.Multimedia.Camera.Core
1353
1354**Parameters**
1355
1356| Name | Type                                       | Mandatory| Description    |
1357| ------- | ------------------------------------------- | ---- | -------- |
1358| setting | [PhotoCaptureSetting](js-apis-camera.md#photocapturesetting) | Yes  | Shooting parameters. The input of **undefined** is processed as if no parameters were passed.|
1359
1360**Return value**
1361
1362| Type           | Description                     |
1363| -------------- | ------------------------   |
1364| Promise\<void\> | Promise that returns no value.|
1365
1366**Error codes**
1367
1368For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1369
1370| ID        | Error Message       |
1371| --------------- | --------------- |
1372| 202         	  |  Not System Application.       |
1373| 7400101         |  Parameter missing or parameter type incorrect.          |
1374| 7400104         |  Session not running.          |
1375| 7400201         |  Camera service fatal error.   |
1376
1377**Example**
1378
1379```ts
1380import { BusinessError } from '@kit.BasicServicesKit';
1381
1382function burstCapture(photoOutput: camera.PhotoOutput): void {
1383  let captureLocation: camera.Location = {
1384    latitude: 0,
1385    longitude: 0,
1386    altitude: 0
1387  }
1388  let settings: camera.PhotoCaptureSetting = {
1389    quality: camera.QualityLevel.QUALITY_LEVEL_LOW,
1390    rotation: camera.ImageRotation.ROTATION_0,
1391    location: captureLocation,
1392    mirror: false
1393  }
1394  photoOutput.burstCapture(settings).then(() => {
1395    console.info('Promise returned to indicate that photo burstCapture request success.');
1396  }).catch((error: BusinessError) => {
1397    console.error(`Failed to photo output burstCapture, error code: ${error.code}.`);
1398  });
1399}
1400```
1401
1402### confirmCapture<sup>11+</sup>
1403
1404confirmCapture()
1405
1406Confirms 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.
1407
1408This API is used to end the burst mode, which is started by calling [burstCapture](#burstcapture12).
1409
1410**System API**: This is a system API.
1411
1412**System capability**: SystemCapability.Multimedia.Camera.Core
1413
1414**Error codes**
1415
1416For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1417
1418| ID        | Error Message       |
1419| --------------- | --------------- |
1420| 202         	  |  Not System Application.       |
1421| 7400104         |  Session not running.          |
1422| 7400201         |  Camera service fatal error.   |
1423
1424**Example**
1425
1426```ts
1427import { BusinessError } from '@kit.BasicServicesKit';
1428
1429function confirmCapture(photoOutput: camera.PhotoOutput): void {
1430  try {
1431    photoOutput.confirmCapture();
1432  } catch (error) {
1433    let err = error as BusinessError;
1434    console.error(`The confirmCapture call failed. error code: ${err.code}`);
1435  }
1436}
1437```
1438
1439### isDeferredImageDeliverySupported<sup>11+</sup>
1440
1441isDeferredImageDeliverySupported(type: DeferredDeliveryImageType): boolean
1442
1443Checks whether deferred delivery of a certain type is supported.
1444
1445**System API**: This is a system API.
1446
1447**System capability**: SystemCapability.Multimedia.Camera.Core
1448
1449**Parameters**
1450
1451| Name     | Type              | Mandatory| Description                |
1452| -------- | -------------------- | ---- | ------------------- |
1453|   type   |  [DeferredDeliveryImageType](#deferreddeliveryimagetype11)  |   Yes  |   Deferred delivery image type.   |
1454
1455**Return value**
1456
1457| Type           | Description                   |
1458| -------------- | ----------------------- |
1459| boolean | Check result. The value **true** means that deferred delivery is supported, and **false** means the opposite.|
1460
1461**Error codes**
1462
1463For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1464
1465| ID        | Error Message                                               |
1466| --------------- |-----------------------------------------------------|
1467| 7400101                | Parameter missing or parameter type incorrect.      |
1468| 7400104                | Session not running.                                |
1469| 7400201                | Camera service fatal error.                         |
1470| 202                    | Not System Application.                             |
1471
1472**Example**
1473
1474```ts
1475function isDeferredImageDeliverySupported(photoOutput: camera.PhotoOutput, type: camera.DeferredDeliveryImageType): boolean {
1476  let res: boolean = false;
1477  res = photoOutput.isDeferredImageDeliverySupported(type);
1478  return res;
1479}
1480```
1481
1482### isDeferredImageDeliveryEnabled<sup>11+</sup>
1483
1484isDeferredImageDeliveryEnabled(type: DeferredDeliveryImageType): boolean
1485
1486Checks whether deferred delivery of a certain type is enabled.
1487
1488**System API**: This is a system API.
1489
1490**System capability**: SystemCapability.Multimedia.Camera.Core
1491
1492**Parameters**
1493
1494| Name     | Type              | Mandatory| Description                |
1495| -------- | -------------------- | ---- | ------------------- |
1496|   type   |  [DeferredDeliveryImageType](#deferreddeliveryimagetype11)  |   Yes  |   Deferred delivery image type.   |
1497
1498**Return value**
1499
1500| Type           | Description                   |
1501| -------------- | ----------------------- |
1502| boolean | **true**: Deferred delivery is enabled. **false**: Deferred delivery is disabled.|
1503
1504**Error codes**
1505
1506For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1507
1508| ID        | Error Message       |
1509| --------------- | --------------- |
1510| 7400101                |  Parameter missing or parameter type incorrect.        |
1511| 7400104                |  Session not running.                                  |
1512| 7400201                |  Camera service fatal error.                           |
1513| 202                    |  Not System Application.                               |
1514
1515**Example**
1516
1517```ts
1518function isDeferredImageDeliveryEnabled(photoOutput: camera.PhotoOutput, type: camera.DeferredDeliveryImageType): boolean {
1519  let res: boolean = false;
1520  res = photoOutput.isDeferredImageDeliveryEnabled(type);
1521  return res;
1522}
1523```
1524
1525### deferImageDelivery<sup>11+</sup>
1526
1527deferImageDelivery(type: DeferredDeliveryImageType): void
1528
1529Enables deferred delivery of a certain type.
1530
1531**System API**: This is a system API.
1532
1533**System capability**: SystemCapability.Multimedia.Camera.Core
1534
1535**Parameters**
1536
1537| Name     | Type              | Mandatory| Description                |
1538| -------- | -------------------- | ---- | ------------------- |
1539|   type   |  [DeferredDeliveryImageType](#deferreddeliveryimagetype11)  |   Yes  |   Deferred delivery image type.   |
1540
1541**Error codes**
1542
1543For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1544
1545| ID        | Error Message       |
1546| --------------- | --------------- |
1547| 7400101                |  Parameter missing or parameter type incorrect.        |
1548| 7400104                |  Session not running.                                  |
1549| 7400201                |  Camera service fatal error.                           |
1550| 202                    |  Not System Application.                               |
1551
1552**Example**
1553
1554```ts
1555function deferImageDelivery(photoOutput: camera.PhotoOutput, type: camera.DeferredDeliveryImageType): void {
1556  photoOutput.deferImageDelivery(type);
1557}
1558```
1559
1560### isAutoHighQualityPhotoSupported<sup>13+</sup>
1561
1562isAutoHighQualityPhotoSupported(): boolean
1563
1564Checks whether automatic high quality is supported for photos.
1565
1566**System API**: This is a system API.
1567
1568**System capability**: SystemCapability.Multimedia.Camera.Core
1569
1570**Return value**
1571
1572| Type           | Description                    |
1573| -------------- | ----------------------- |
1574| boolean | Check result. The value **true** means that automatic high quality is supported, and **false** means the opposite.|
1575
1576**Error codes**
1577
1578For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1579
1580| ID        | Error Message       |
1581| --------------- | --------------- |
1582| 202 | Not System Application. |
1583| 7400104                |  Session not running.                                  |
1584| 7400201                |  Camera service fatal error.                           |
1585
1586**Example**
1587
1588```ts
1589import { BusinessError } from '@kit.BasicServicesKit';
1590
1591function isAutoHighQualityPhotoSupported(photoOutput: camera.PhotoOutput): boolean {
1592  return photoOutput.isAutoHighQualityPhotoSupported();
1593}
1594```
1595
1596### enableAutoHighQualityPhoto<sup>13+</sup>
1597
1598enableAutoHighQualityPhoto(enabled: boolean): void
1599
1600Enables automatic high quality for photos.
1601
1602Before using this API, call [isAutoHighQualityPhotoSupported](#isautohighqualityphotosupported13) to check whether automatic high quality is supported.
1603
1604**System API**: This is a system API.
1605
1606**System capability**: SystemCapability.Multimedia.Camera.Core
1607
1608**Parameters**
1609
1610| Name     | Type              | Mandatory| Description                |
1611| -------- | -------------------- | ---- | ------------------- |
1612|   enabled   |  boolean  |   Yes  |   Whether to enable or disable automatic high quality for photos. The value **true** means to enable automatic high-quality, and **false** means to disable it.   |
1613
1614**Error codes**
1615
1616For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1617
1618| ID        | Error Message       |
1619| --------------- | --------------- |
1620| 202 | Not System Application. |
1621| 7400101                |  Parameter missing or parameter type incorrect.        |
1622| 7400104                |  Session not running.                                  |
1623| 7400201                |  Camera service fatal error.                           |
1624
1625**Example**
1626
1627```ts
1628import { BusinessError } from '@kit.BasicServicesKit';
1629
1630function enableAutoHighQualityPhoto(photoOutput: camera.PhotoOutput): void {
1631  return photoOutput.enableAutoHighQualityPhoto(true);
1632}
1633```
1634
1635### on('deferredPhotoProxyAvailable')<sup>11+</sup>
1636
1637on(type: 'deferredPhotoProxyAvailable', callback: AsyncCallback\<DeferredPhotoProxy\>): void
1638
1639Subscribes to events indicating available thumbnail proxies. This API uses an asynchronous callback to return the result.
1640
1641**System API**: This is a system API.
1642
1643**System capability**: SystemCapability.Multimedia.Camera.Core
1644
1645**Parameters**
1646
1647| Name    | Type     | Mandatory| Description                                 |
1648| -------- | ---------- | --- | ------------------------------------ |
1649| type     | string     | Yes  | Event type. The value is fixed at **'deferredPhotoProxyAvailable'**. The event can be listened for when a **photoOutput** instance is created.|
1650| callback | AsyncCallback\<[DeferredPhotoProxy](#deferredphotoproxy11)\> | Yes  | Callback used to return the thumbnail proxy.|
1651
1652**Error codes**
1653
1654For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1655
1656| ID        | Error Message       |
1657| --------------- | --------------- |
1658| 202         	  |  Not System Application.       |
1659
1660**Example**
1661
1662```ts
1663import { BusinessError } from '@kit.BasicServicesKit';
1664import { image } from '@kit.ImageKit';
1665
1666function callback(err: BusinessError, proxyObj: camera.DeferredPhotoProxy): void {
1667  if (err !== undefined && err.code !== 0) {
1668    console.error(`Callback Error, errorCode: ${err.code}`);
1669    return;
1670  }
1671  proxyObj.getThumbnail().then((thumbnail: image.PixelMap) => {
1672    AppStorage.setOrCreate('proxyThumbnail', thumbnail);
1673  });
1674}
1675
1676function registerPhotoOutputDeferredPhotoProxyAvailable(photoOutput: camera.PhotoOutput): void {
1677  photoOutput.on('deferredPhotoProxyAvailable', callback);
1678}
1679```
1680
1681### off('deferredPhotoProxyAvailable')<sup>11+</sup>
1682
1683off(type: 'deferredPhotoProxyAvailable', callback?: AsyncCallback\<DeferredPhotoProxy\>): void
1684
1685Unsubscribes from events indicating available thumbnail proxies.
1686
1687**System API**: This is a system API.
1688
1689**System capability**: SystemCapability.Multimedia.Camera.Core
1690
1691**Parameters**
1692
1693| Name     | Type                   | Mandatory| Description                                      |
1694| -------- | ---------------------- | ---- | ------------------------------------------ |
1695| type     | string                 | Yes  | Event type. The value is fixed at **'deferredPhotoProxyAvailable'**. The event can be listened for when a **photoOutput** instance is created.|
1696| 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.)           |
1697
1698**Error codes**
1699
1700For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1701
1702| ID        | Error Message       |
1703| --------------- | --------------- |
1704| 202         	  |  Not System Application.       |
1705
1706**Example**
1707
1708```ts
1709import { BusinessError } from '@kit.BasicServicesKit';
1710import { image } from '@kit.ImageKit';
1711
1712function callback(err: BusinessError, proxyObj: camera.DeferredPhotoProxy): void {
1713  proxyObj.getThumbnail().then((thumbnail: image.PixelMap) => {
1714    AppStorage.setOrCreate('proxyThumbnail', thumbnail);
1715  });
1716}
1717
1718function unRegisterPhotoOutputDeferredPhotoProxyAvailable(photoOutput: camera.PhotoOutput): void {
1719  photoOutput.off('deferredPhotoProxyAvailable', callback);
1720}
1721```
1722
1723### isQuickThumbnailSupported
1724
1725isQuickThumbnailSupported(): boolean
1726
1727Checks whether the quick thumbnail feature is supported.
1728
1729This 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).
1730
1731**System API**: This is a system API.
1732
1733**System capability**: SystemCapability.Multimedia.Camera.Core
1734
1735**Return value**
1736
1737| Type| Description|
1738| --------- | ------ |
1739| boolean | Check result. The value **true** means that the quick thumbnail feature is supported, and **false** means the opposite.|
1740
1741**Error codes**
1742
1743For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1744
1745| ID        | Error Message       |
1746| --------------- | --------------- |
1747| 202                	 |  Not System Application.        |
1748| 7400104                |  session is not running.        |
1749
1750**Example**
1751
1752```ts
1753import { common } from '@kit.AbilityKit';
1754
1755async function isQuickThumbnailSupported(context: common.BaseContext, mode: camera.SceneMode, photoProfile: camera.Profile): Promise<boolean> {
1756  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
1757  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
1758  // Create a CaptureSession instance.
1759  let session: camera.Session = cameraManager.createSession(mode);
1760  // Start configuration for the session.
1761  session.beginConfig();
1762  // Add a CameraInput instance to the session.
1763  let cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameras[0]);
1764  await cameraInput.open();
1765  session.addInput(cameraInput);
1766  // Add a PhotoOutput instance to the session.
1767  let photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
1768  session.addOutput(photoOutput);
1769  let isSupported: boolean = photoOutput.isQuickThumbnailSupported();
1770  return isSupported;
1771}
1772```
1773
1774### enableQuickThumbnail
1775
1776enableQuickThumbnail(enabled: boolean): void
1777
1778Enables or disables the quick thumbnail feature.
1779
1780This 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).
1781
1782**System API**: This is a system API.
1783
1784**System capability**: SystemCapability.Multimedia.Camera.Core
1785
1786**Parameters**
1787
1788| Name    | Type        | Mandatory| Description                                |
1789| -------- | ------------- | ---- | ----------------------------------- |
1790| 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.|
1791
1792**Error codes**
1793
1794For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1795
1796| ID        | Error Message       |
1797| --------------- | --------------- |
1798| 202                	 |  Not System Application.        |
1799| 7400101                |  Parameter missing or parameter type incorrect.        |
1800| 7400104                |  session is not running.        |
1801| 7400201                |  Camera service fatal error.        |
1802
1803**Example**
1804
1805```ts
1806import { common } from '@kit.AbilityKit';
1807import { BusinessError } from '@kit.BasicServicesKit';
1808
1809async function enableQuickThumbnail(context: common.BaseContext, mode: camera.SceneMode, photoProfile: camera.Profile): Promise<void> {
1810  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
1811  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
1812  // Create a CaptureSession instance.
1813  let session: camera.Session = cameraManager.createSession(mode);
1814  // Start configuration for the session.
1815  session.beginConfig();
1816  // Add a CameraInput instance to the session.
1817  let cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameras[0]);
1818  await cameraInput.open();
1819  session.addInput(cameraInput);
1820  // Add a PhotoOutput instance to the session.
1821  let photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
1822  session.addOutput(photoOutput);
1823  let isSupported: boolean = photoOutput.isQuickThumbnailSupported();
1824  if (!isSupported) {
1825    console.info('Quick Thumbnail is not supported to be turned on.');
1826    return;
1827  }
1828  try {
1829    photoOutput.enableQuickThumbnail(true);
1830  } catch (error) {
1831    let err = error as BusinessError;
1832    console.error(`The enableQuickThumbnail call failed. error code: ${err.code}`);
1833  }
1834}
1835```
1836
1837### on('quickThumbnail')
1838
1839on(type: 'quickThumbnail', callback: AsyncCallback\<image.PixelMap>): void
1840
1841Subscribes to quick thumbnail output events. This API uses an asynchronous callback to return the result.
1842
1843The listening takes effect after **enableQuickThumbnail(true)** is called.
1844
1845**System API**: This is a system API.
1846
1847**System capability**: SystemCapability.Multimedia.Camera.Core
1848
1849**Parameters**
1850
1851| Name    | Type        | Mandatory| Description                                |
1852| -------- | ------------- | ---- | ----------------------------------- |
1853| type    | string     | Yes  | Event type. The value is fixed at **'quickThumbnail'**.|
1854| callback | AsyncCallback\<[image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)> | Yes| Callback that returns a **PixelMap** instance.|
1855
1856**Example**
1857
1858```ts
1859import { common } from '@kit.AbilityKit';
1860import { BusinessError } from '@kit.BasicServicesKit';
1861import { image } from '@kit.ImageKit';
1862
1863function callback(err: BusinessError, pixelMap: image.PixelMap): void {
1864  if (err || pixelMap === undefined) {
1865      console.error('photoOutput on thumbnail failed');
1866      return;
1867  }
1868  // Display or save the PixelMap instance.
1869  // do something.
1870}
1871
1872async function registerQuickThumbnail(context: common.BaseContext, mode: camera.SceneMode, photoProfile: camera.Profile): Promise<void> {
1873  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
1874  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
1875  // Create a CaptureSession instance.
1876  let session: camera.Session = cameraManager.createSession(mode);
1877  // Start configuration for the session.
1878  session.beginConfig();
1879  // Add a CameraInput instance to the session.
1880  let cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameras[0]);
1881  await cameraInput.open();
1882  session.addInput(cameraInput);
1883  // Add a PhotoOutput instance to the session.
1884  let photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
1885  session.addOutput(photoOutput);
1886  let isSupported: boolean = photoOutput.isQuickThumbnailSupported();
1887  if (!isSupported) {
1888    console.info('Quick Thumbnail is not supported to be turned on.');
1889    return;
1890  }
1891  try {
1892    photoOutput.enableQuickThumbnail(true);
1893  } catch (error) {
1894    let err = error as BusinessError;
1895    console.error(`The enableQuickThumbnail call failed. error code: ${err.code}`);
1896  }
1897
1898  photoOutput.on('quickThumbnail', callback);
1899}
1900```
1901
1902### off('quickThumbnail')
1903
1904off(type: 'quickThumbnail', callback?: AsyncCallback\<image.PixelMap>): void
1905
1906Unsubscribes from quick thumbnail output events.
1907
1908**System API**: This is a system API.
1909
1910**System capability**: SystemCapability.Multimedia.Camera.Core
1911
1912**Parameters**
1913
1914| Name    | Type        | Mandatory| Description                                |
1915| -------- | ------------- | ---- | ----------------------------------- |
1916| type    | string     | Yes  | Event type. The value is fixed at **'quickThumbnail'**.|
1917| 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.)|
1918
1919**Example**
1920
1921```ts
1922function unregisterQuickThumbnail(photoOutput: camera.PhotoOutput): void {
1923  photoOutput.off('quickThumbnail');
1924}
1925```
1926
1927## MetadataOutput
1928
1929Implements metadata streams. It inherits from [CameraOutput](js-apis-camera.md#cameraoutput).
1930
1931### addMetadataObjectTypes<sup>13+</sup>
1932
1933addMetadataObjectTypes(types: Array\<MetadataObjectType\>): void
1934
1935Adds the types of metadata objects to be detected.
1936
1937**System capability**: SystemCapability.Multimedia.Camera.Core
1938
1939**Parameters**
1940
1941| Name                 | Type                                              | Mandatory| Description                         |
1942| -------------------- | -------------------------------------------------- | --- | ---------------------------- |
1943| metadataObjectTypes  | Array\<[MetadataObjectType](#metadataobjecttype)\>  | Yes | Metadata object types, which are obtained through **getSupportedOutputCapability**.|
1944
1945**Error codes**
1946
1947For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1948
1949| ID        | Error Message       |
1950| --------------- | --------------- |
1951| 202                    |  Not system application.        |
1952| 7400101                |  Parameter missing or parameter type incorrect.        |
1953| 7400103                |  Session not config.                                   |
1954| 7400201                |  Camera service fatal error.                           |
1955
1956**Example**
1957
1958```ts
1959import { BusinessError } from '@kit.BasicServicesKit';
1960
1961function addMetadataObjectTypes(metadataOutput: camera.MetadataOutput, types: Array<camera.MetadataObjectType>): void {
1962  try {
1963    metadataOutput.addMetadataObjectTypes(types);
1964  } catch (error) {
1965    // If the operation fails, error.code is returned and processed.
1966    let err = error as BusinessError;
1967    console.error(`addMetadataObjectTypes error. error code: ${err.code}`);
1968  }
1969}
1970```
1971
1972### removeMetadataObjectTypes<sup>13+</sup>
1973
1974removeMetadataObjectTypes(types: Array\<MetadataObjectType\>): void
1975
1976Removes the types of metadata objects to be detected.
1977
1978**System capability**: SystemCapability.Multimedia.Camera.Core
1979
1980**Parameters**
1981
1982| Name                 | Type                                              | Mandatory| Description                         |
1983| -------------------- | -------------------------------------------------- | --- | ---------------------------- |
1984| metadataObjectTypes  | Array\<[MetadataObjectType](#metadataobjecttype)\>  | Yes | Metadata object types, which are obtained through **getSupportedOutputCapability**.|
1985
1986**Error codes**
1987
1988For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
1989
1990| ID        | Error Message       |
1991| --------------- | --------------- |
1992| 202                    |  Not system application.        |
1993| 7400101                |  Parameter missing or parameter type incorrect.                                   |
1994| 7400103                |  Session not config.                                   |
1995| 7400201                |  Camera service fatal error.                           |
1996
1997**Example**
1998
1999```ts
2000import { BusinessError } from '@kit.BasicServicesKit';
2001
2002function removeMetadataObjectTypes(metadataOutput: camera.MetadataOutput, types: Array<camera.MetadataObjectType>): void {
2003  try {
2004    metadataOutput.removeMetadataObjectTypes(types);
2005  } catch (error) {
2006    // If the operation fails, error.code is returned and processed.
2007    let err = error as BusinessError;
2008    console.error(`removeMetadataObjectTypes error. error code: ${err.code}`);
2009  }
2010}
2011```
2012
2013## MetadataObjectType
2014
2015Enumerates the types of metadata objects used for camera detection.
2016
2017**System capability**: SystemCapability.Multimedia.Camera.Core
2018
2019| Name                      | Value  | Description             |
2020| -------------------------- | ---- | ----------------- |
2021| HUMAN_BODY<sup>13+</sup>                 | 1    | Metadata object used for human body detection.|
2022| CAT_FACE<sup>13+</sup>                   | 2    | Metadata object used for cat face detection.|
2023| CAT_BODY<sup>13+</sup>                   | 3    | Metadata object used for cat body detection.|
2024| DOG_FACE<sup>13+</sup>                   | 4    | Metadata object used for dog face detection.|
2025| DOG_BODY<sup>13+</sup>                   | 5    | Metadata object used for dog body detection.|
2026| SALIENT_DETECTION<sup>13+</sup>          | 6    | Metadata object used for salient detection.|
2027
2028## Emotion<sup>13+</sup>
2029Enumerates the types of emotions in the detected human face information.
2030
2031**System capability**: SystemCapability.Multimedia.Camera.Core
2032
2033| Name                      | Value  | Description             |
2034| -------------------------- | ---- | ----------------- |
2035| NEUTRAL                 | 0    | Quiet and calm.|
2036| SADNESS                   | 1    | Sad.|
2037| SMILE                   | 2    | Smile.|
2038| SURPRISE                   | 3    | Surprise.|
2039
2040## MetadataObject
2041
2042Implements the basic metadata object used for camera detection. This class is the data source of the camera information of [CameraInput](#camerainput). It is obtained by calling metadataOutput.[on('metadataObjectsAvailable')](js-apis-camera.md#onmetadataobjectsavailable).
2043
2044**System capability**: SystemCapability.Multimedia.Camera.Core
2045
2046| Name        | Type                                       | Read-only| Optional|Description               |
2047| -----------  | ------------------------------------------- | ---- | ---- | ----------------- |
2048| objectId<sup>13+</sup>     | number                                      |  Yes |  No | Metadata object ID.|
2049| confidence<sup>13+</sup>   | number                                      |  Yes |  No | Confidence of the detection, with a value range of [0,1].|
2050
2051## MetadataFaceObject<sup>13+</sup>
2052
2053Implements the human face metadata object used for camera detection. This class inherits from [MetadataObject](#metadataobject) and is the data source of the camera information of [CameraInput](#camerainput). It is obtained by calling metadataOutput.[on('metadataObjectsAvailable')](js-apis-camera.md#onmetadataobjectsavailable).
2054
2055**System capability**: SystemCapability.Multimedia.Camera.Core
2056
2057| Name                   | Type                             | Read-only| Optional|Description               |
2058| ---------------------- | --------------------------------- | ---- | ---- | --------------------- |
2059| leftEyeBoundingBox     | [Rect](js-apis-camera.md#rect)                             |  Yes |  No | Left eye area.|
2060| rightEyeBoundingBox    | [Rect](js-apis-camera.md#rect)                            |  Yes |  No | Right eye area.|
2061| emotion                | [Emotion](#emotion13)             |  Yes |  No | Detected emotion.|
2062| emotionConfidence      | number                            |  Yes |  No | Confidence of the emotion detection, with a value range of [0,1].|
2063| pitchAngle             | number                            |  Yes |  No | Pitch angle, with a value range of [-90, 90], where downward is positive.|
2064| yawAngle               | number                            |  Yes |  No | Yaw angle, with a value range of [-90, 90], where rightward is positive.|
2065| rollAngle              | number                            |  Yes |  No | Row angle, with a value range of [-180, 180], where clockwise direction is positive.|
2066
2067## MetadataHumanBodyObject<sup>13+</sup>
2068
2069Implements the human body metadata object used for camera detection. This class inherits from [MetadataObject](#metadataobject) and is the data source of the camera information of [CameraInput](#camerainput). It is obtained by calling metadataOutput.[on('metadataObjectsAvailable')](js-apis-camera.md#onmetadataobjectsavailable).
2070
2071**System capability**: SystemCapability.Multimedia.Camera.Core
2072
2073## MetadataCatFaceObject<sup>13+</sup>
2074
2075Implements the cat face metadata object used for camera detection. This class inherits from [MetadataObject](#metadataobject) and is the data source of the camera information of [CameraInput](#camerainput). It is obtained by calling metadataOutput.[on('metadataObjectsAvailable')](js-apis-camera.md#onmetadataobjectsavailable).
2076
2077**System capability**: SystemCapability.Multimedia.Camera.Core
2078
2079| Name                   | Type                             | Read-only| Optional|Description               |
2080| ---------------------- | --------------------------------- | ---- | ---- | --------------------- |
2081| leftEyeBoundingBox     | [Rect](js-apis-camera.md#rect)                              |  Yes |  No | Left eye area.|
2082| rightEyeBoundingBox    | [Rect](js-apis-camera.md#rect)                              |  Yes |  No | Right eye area.|
2083
2084## MetadataCatBodyObject<sup>13+</sup>
2085
2086Implements the cat body metadata object used for camera detection. This class inherits from [MetadataObject](#metadataobject) and is the data source of the camera information of [CameraInput](#camerainput). It is obtained by calling metadataOutput.[on('metadataObjectsAvailable')](js-apis-camera.md#onmetadataobjectsavailable).
2087
2088**System capability**: SystemCapability.Multimedia.Camera.Core
2089
2090## MetadataDogFaceObject<sup>13+</sup>
2091
2092Implements the dog face metadata object used for camera detection. This class inherits from [MetadataObject](#metadataobject) and is the data source of the camera information of [CameraInput](#camerainput). It is obtained by calling metadataOutput.[on('metadataObjectsAvailable')](js-apis-camera.md#onmetadataobjectsavailable).
2093
2094**System capability**: SystemCapability.Multimedia.Camera.Core
2095
2096| Name                   | Type                             | Read-only| Optional|Description               |
2097| ---------------------- | --------------------------------- | ---- | ---- | --------------------- |
2098| leftEyeBoundingBox     | [Rect](js-apis-camera.md#rect)                              |  Yes |  No | Left eye area.|
2099| rightEyeBoundingBox    | [Rect](js-apis-camera.md#rect)                              |  Yes |  No | Right eye area.|
2100
2101## MetadataDogBodyObject<sup>13+</sup>
2102
2103Implements the dog body metadata object used for camera detection. This class inherits from [MetadataObject](#metadataobject) and is the data source of the camera information of [CameraInput](#camerainput). It is obtained by calling metadataOutput.[on('metadataObjectsAvailable')](js-apis-camera.md#onmetadataobjectsavailable).
2104
2105**System capability**: SystemCapability.Multimedia.Camera.Core
2106
2107## MetadataSalientDetectionObject<sup>13+</sup>
2108
2109Implements the salient detection metadata object used for camera detection. This class inherits from [MetadataObject](#metadataobject) and is the data source of the camera information of [CameraInput](#camerainput). It is obtained by calling metadataOutput.[on('metadataObjectsAvailable')](js-apis-camera.md#onmetadataobjectsavailable).
2110
2111**System capability**: SystemCapability.Multimedia.Camera.Core
2112
2113## MetadataBarcodeObject<sup>14+</sup>
2114
2115Implements the barcode metadata object used for camera detection. This class inherits from [MetadataObject](#metadataobject) and is the data source of the camera information of [CameraInput](#camerainput). It is obtained by calling metadataOutput.[on('metadataObjectsAvailable')](js-apis-camera.md#onmetadataobjectsavailable).
2116
2117**System capability**: SystemCapability.Multimedia.Camera.Core
2118
2119## PortraitEffect
2120
2121Enumerates the portrait effects.
2122
2123**System API**: This is a system API.
2124
2125**System capability**: SystemCapability.Multimedia.Camera.Core
2126
2127| Name            | Value   | Description    |
2128| ----------------| ----  | ---------|
2129| OFF             | 0      | Disabled.   |
2130| CIRCLES         | 1      | Circles.   |
2131| HEART<sup>11+</sup>           | 2      | Heart-shaped.   |
2132| ROTATED<sup>11+</sup>         | 3      | Rotated.   |
2133| STUDIO<sup>11+</sup>          | 4      | Studio light. |
2134| THEATER<sup>11+</sup>         | 5      | Theater light. |
2135
2136## BeautyQuery<sup>12+</sup>
2137
2138Provides APIs to obtain and set the beauty effect.
2139
2140### getSupportedBeautyTypes<sup>11+</sup>
2141
2142getSupportedBeautyTypes(): Array\<BeautyType\>
2143
2144Obtains the supported beauty types.
2145
2146**System API**: This is a system API.
2147
2148**System capability**: SystemCapability.Multimedia.Camera.Core
2149
2150**Return value**
2151
2152| Type               | Description                                                 |
2153| ----------          | -----------------------------                         |
2154|  Array\<[BeautyType](#beautytype)\>| Array of beauty types supported.                            |
2155
2156**Error codes**
2157
2158For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2159
2160| ID        | Error Message       |
2161| --------------- | --------------- |
2162| 202                |  Not System Application.                                   |
2163| 7400103                |  Session not config.                                   |
2164
2165**Example**
2166
2167```ts
2168function getSupportedBeautyTypes(portraitPhotoSession: camera.PortraitPhotoSession): Array<camera.BeautyType> {
2169  let beautyTypes: Array<camera.BeautyType> = portraitPhotoSession.getSupportedBeautyTypes();
2170  return beautyTypes;
2171}
2172```
2173
2174### getSupportedBeautyRange<sup>11+</sup>
2175
2176getSupportedBeautyRange(type: BeautyType): Array\<number\>
2177
2178Obtains the levels that can be set a beauty type.
2179
2180The beauty levels vary according to the device type. The following table is only an example.
2181
2182| Input Parameter          | Example Return Value   | Return Value Description    |
2183| ----------------| ----  | ---------|
2184| 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.   |
2185| 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.   |
2186| 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.  |
2187| 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.   |
2188
2189**System API**: This is a system API.
2190
2191**System capability**: SystemCapability.Multimedia.Camera.Core
2192
2193**Parameters**
2194
2195| Name     | Type                   | Mandatory| Description      |
2196| -------- | --------------------------| ---- | ----------|
2197| type     | [BeautyType](#beautytype) | Yes  | Beauty type.  |
2198
2199**Return value**
2200
2201| Type       | Description                         |
2202| ---------- | ----------------------------- |
2203|  Array\<number\>     | Array of levels supported.|
2204
2205**Error codes**
2206
2207For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2208
2209| ID        | Error Message       |
2210| --------------- | --------------- |
2211| 202                |  Not System Application.                                   |
2212| 7400103                |  Session not config.                                   |
2213
2214**Example**
2215
2216```ts
2217function getSupportedBeautyRange(portraitPhotoSession: camera.PortraitPhotoSession): Array<number> {
2218  let beautyTypes: Array<camera.BeautyType> = portraitPhotoSession.getSupportedBeautyTypes();
2219  if (beautyTypes === undefined || beautyTypes.length <= 0) {
2220    return [];
2221  }
2222  let beautyLevels: Array<number> = portraitPhotoSession.getSupportedBeautyRange(beautyTypes[0]);
2223  return beautyLevels;
2224}
2225```
2226
2227## BeautyType
2228
2229Enumerates the beauty types.
2230
2231**System API**: This is a system API.
2232
2233**System capability**: SystemCapability.Multimedia.Camera.Core
2234
2235| Name            | Value   | Description    |
2236| ----------------| ----  | ---------|
2237| AUTO           | 0      | Automatic.    |
2238| SKIN_SMOOTH    | 1      | Skin smoothing.    |
2239| FACE_SLENDER   | 2      | Face slimming.    |
2240| SKIN_TONE      | 3      | Skin tone perfection.    |
2241
2242## ManualExposureQuery<sup>12+</sup>
2243
2244Provides APIs to obtain the manual exposure range supported.
2245
2246### getSupportedExposureRange<sup>11+</sup>
2247
2248getSupportedExposureRange(): Array\<number\>
2249
2250Obtains the supported manual exposure durations.
2251
2252**System API**: This is a system API.
2253
2254**System capability**: SystemCapability.Multimedia.Camera.Core
2255
2256**Return value**
2257
2258| Type               | Description                                                 |
2259| ----------          | -----------------------------                         |
2260|  Array\<number\>| Array of manual exposure durations supported, in ms.                            |
2261
2262**Error codes**
2263
2264For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2265
2266| ID        | Error Message       |
2267| --------------- | --------------- |
2268| 202                |  Not System Application.  |
2269| 7400101            |  Parameter missing or parameter type incorrect.  |
2270| 7400103            |  Session not config, only throw in session usage.  |
2271
2272 **Example**
2273
2274```ts
2275function getSupportedExposureRange(nightPhotoSession: camera.NightPhotoSession): Array<number> {
2276  let exposureRange: Array<number> = nightPhotoSession.getSupportedExposureRange();
2277  return exposureRange;
2278}
2279```
2280
2281## ManualExposure<sup>11+</sup>
2282
2283ManualExposure extends [ManualExposureQuery](#manualexposurequery12)
2284
2285Provides APIs to obtain and set the exposure duration.
2286
2287### getExposure<sup>11+</sup>
2288
2289getExposure(): number
2290
2291Obtains the manual exposure duration in use.
2292
2293**System API**: This is a system API.
2294
2295**System capability**: SystemCapability.Multimedia.Camera.Core
2296
2297**Return value**
2298| Name     | Type                                             | Mandatory| Description                   |
2299| -------- | ------------------------------------------------- | ---- | --------------------- |
2300| value     | number | Yes  | Manual exposure duration, in ms. |
2301
2302**Error codes**
2303
2304For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2305
2306| ID        | Error Message       |
2307| --------------- | --------------- |
2308| 202                    |  Not System Application.                               |
2309| 7400101                |  Parameter missing or parameter type incorrect.        |
2310| 7400103                |  Session not config.                                   |
2311
2312**Example**
2313
2314```ts
2315function getExposure(nightPhotoSession: camera.NightPhotoSession): number | undefined {
2316  let exposureRange: Array<number> = nightPhotoSession.getSupportedExposureRange();
2317  if (exposureRange === undefined || exposureRange.length <= 0) {
2318    return undefined;
2319  }
2320  let exposure: number = nightPhotoSession.getExposure();
2321  return exposure;
2322}
2323```
2324
2325### setExposure<sup>11+</sup>
2326
2327setExposure(exposure: number): void
2328
2329Sets the manual exposure duration. Before using this API, call [getSupportedExposureRange](#getsupportedexposurerange11) to obtain the supported manual exposure durations, in ms.
2330
2331**System API**: This is a system API.
2332
2333**System capability**: SystemCapability.Multimedia.Camera.Core
2334
2335**Parameters**
2336
2337| Name     | Type                   | Mandatory| Description                                                                     |
2338| -------- | --------------------------| ---- |-------------------------------------------------------------------------|
2339| value    | number                    | Yes  | Manual exposure duration, which must be one of the supported durations obtained by running [getSupportedExposureRange](#getsupportedexposurerange11).|
2340
2341 **Error codes**
2342
2343| ID        | Error Message       |
2344| --------------- | --------------- |
2345| 202                	 |  Not System Application.  |
2346| 7400102                |  Operation not allowed.   |
2347| 7400103                |  Session not config.      |
2348
2349```ts
2350function setExposure(nightPhotoSession: camera.NightPhotoSession): void {
2351  let exposureRange: Array<number> = nightPhotoSession.getSupportedExposureRange();
2352  if (exposureRange === undefined || exposureRange.length <= 0) {
2353    return;
2354  }
2355  nightPhotoSession.setExposure(exposureRange[0]);
2356}
2357```
2358
2359## MacroQuery<sup>12+</sup>
2360
2361Provides the API to check the support for macro photography.
2362
2363### isMacroSupported<sup>11+</sup>
2364
2365isMacroSupported(): boolean
2366
2367Checks whether macro photography is supported in the current state. This API must be called after [commitConfig](js-apis-camera.md#commitconfig11-1).
2368
2369**System API**: This is a system API.
2370
2371**System capability**: SystemCapability.Multimedia.Camera.Core
2372
2373**Return value**
2374
2375| Type       | Description                         |
2376| ---------- | ----------------------------- |
2377|   boolean  | Check result. The value **true** means that macro photography is supported, and **false** means the opposite.|
2378
2379**Error codes**
2380
2381For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2382
2383| ID  | Error Message                    |
2384|---------|--------------------------|
2385| 202     | Not System Application.  |
2386
2387**Example**
2388
2389```ts
2390function isMacroSupported(photoSession: camera.PhotoSessionForSys): boolean {
2391  let isSupported: boolean = photoSession.isMacroSupported();
2392  return isSupported;
2393}
2394```
2395
2396## Macro<sup>11+</sup>
2397
2398Macro extends [MacroQuery](#macroquery12)
2399
2400Provides the API to enable macro photography.
2401
2402### enableMacro<sup>11+</sup>
2403
2404enableMacro(enabled: boolean): void
2405
2406Enables or disables macro photography. This API can be called only when macro photography is supported.
2407
2408**System API**: This is a system API.
2409
2410**System capability**: SystemCapability.Multimedia.Camera.Core
2411
2412**Parameters**
2413
2414| Name    | Type                  | Mandatory| Description                 |
2415| -------- | -------------------- | ---- | -------------------- |
2416| enabled | boolean | Yes  | Whether to enable macro photography. The value **true** means to enable macro photography, and **false** means to disable it.|
2417
2418**Error codes**
2419
2420For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2421
2422| ID   | Error Message                    |
2423|----------|--------------------------|
2424| 202      | Not System Application.  |
2425| 7400102  | Operation not allowed.   |
2426| 7400103  | Session not config.      |
2427
2428**Example**
2429
2430```ts
2431function enableMacro(photoSession: camera.PhotoSessionForSys): void {
2432  let isSupported: boolean = photoSession.isMacroSupported();
2433  if (isSupported) {
2434    photoSession.enableMacro(true);
2435  }
2436}
2437```
2438
2439## TripodStatus<sup>13+</sup>
2440
2441Enumerates the tripod statuses.
2442
2443**System capability**: SystemCapability.Multimedia.Camera.Core
2444
2445| Name      | Value  | Description                                 |
2446|----------|-----|-------------------------------------|
2447| INVALID  | 0   | Error status, or no tripod detected. **System API**: This is a system API.|
2448| ACTIVE   | 1   | The tripod is active. **System API**: This is a system API.         |
2449| ENTERING | 2   | The system is transitioning into a stable tripod mode. **System API**: This is a system API.       |
2450| EXITING  | 3   | The system is leaving the stable tripod mode. **System API**: This is a system API.         |
2451
2452
2453## SceneFeatureType<sup>12+</sup>
2454
2455Enumerates the scene features.
2456
2457**System capability**: SystemCapability.Multimedia.Camera.Core
2458
2459| Name                           | Value  | Description                       |
2460|-------------------------------|-----|---------------------------|
2461| MOON_CAPTURE_BOOST            | 0   | Moon scene. **System API**: This is a system API. |
2462| TRIPOD_DETECTION<sup>13+</sup> | 1   | Scene where a tripod is used for photo capture. **System API**: This is a system API. |
2463| LOW_LIGHT_BOOST<sup>13+</sup> | 2   | Scene for long exposure photography. **System API**: This is a system API.|
2464
2465## SceneFeatureDetectionResult<sup>12+</sup>
2466
2467Describes the scene feature detection result.
2468
2469**System capability**: SystemCapability.Multimedia.Camera.Core
2470
2471| Name    | Type       |   Read-only  |   Mandatory  | Description      |
2472| -------- | ---------- | -------- | -------- | ---------- |
2473| featureType |   [SceneFeatureType](#scenefeaturetype12)   |   Yes    |    Yes   | Scene feature type. |
2474| detected |   boolean   |   Yes    |    Yes   | Detection result. The value **true** means that the specified scene feature is detected, and **false** means the opposite.|
2475
2476## TripodDetectionResult<sup>13+</sup>
2477
2478TripodDetectionResult extends [SceneFeatureDetectionResult](#scenefeaturedetectionresult12)
2479
2480Describes the tripod detection result.
2481
2482**System capability**: SystemCapability.Multimedia.Camera.Core
2483
2484| Name    | Type                             |   Read-only  |   Mandatory  | Description     |
2485| -------- |---------------------------------| -------- | -------- |---------|
2486| tripodStatus | [TripodStatus](#tripodstatus13) |   Yes    |    Yes   | Tripod status.|
2487
2488## SceneDetection<sup>12+</sup>
2489
2490Provides the scene detection capability.
2491
2492### isSceneFeatureSupported<sup>12+</sup>
2493
2494isSceneFeatureSupported(type: SceneFeatureType): boolean
2495
2496Checks whether a scene feature is supported.
2497
2498**System API**: This is a system API.
2499
2500**System capability**: SystemCapability.Multimedia.Camera.Core
2501
2502**Parameters**
2503
2504| Name  | Type                                       | Mandatory | Description         |
2505|-------|-------------------------------------------|-----|-------------|
2506| type  | [SceneFeatureType](#scenefeaturetype12)   | Yes  | Scene feature. |
2507
2508**Return value**
2509
2510| Type       | Description          |
2511|-----------|--------------|
2512| boolean   | Check result. The value **true** means that the scene feature is supported, and **false** means the opposite. |
2513
2514**Error codes**
2515
2516For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2517
2518| ID  | Error Message                                          |
2519|---------|------------------------------------------------|
2520| 202     | Not System Application.                        |
2521| 7400101 | Parameter missing or parameter type incorrect. |
2522
2523**Example**
2524
2525```ts
2526function isSceneFeatureSupported(photoSession: camera.PhotoSession, featureType: camera.SceneFeatureType): boolean {
2527  let isSupported: boolean = photoSession.isSceneFeatureSupported(featureType);
2528  return isSupported;
2529}
2530```
2531
2532### enableSceneFeature<sup>12+</sup>
2533
2534enableSceneFeature(type: SceneFeatureType, enabled: boolean): void
2535
2536Enables or disables a scene feature. This API must be called after [SceneFeatureDetectionResult](#scenefeaturedetectionresult12) of the corresponding scene feature is received.
2537
2538**System API**: This is a system API.
2539
2540**System capability**: SystemCapability.Multimedia.Camera.Core
2541
2542**Parameters**
2543
2544| Name    | Type                                       | Mandatory | Description                         |
2545|---------|-------------------------------------------|-----|-----------------------------|
2546| type    | [SceneFeatureType](#scenefeaturetype12)   | Yes  | Scene feature.              |
2547| enabled | boolean                                   | Yes  | Whether to enable the scene feature. The value **true** means to enable the scene feature, and **false** means the opposite.|
2548
2549**Error codes**
2550
2551For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2552
2553| ID  | Error Message                                          |
2554|---------|------------------------------------------------|
2555| 202     | Not System Application.                        |
2556| 7400101 | Parameter missing or parameter type incorrect. |
2557
2558**Example**
2559
2560```ts
2561import { BusinessError } from '@kit.BasicServicesKit';
2562
2563function enableSceneFeature(photoSession: camera.PhotoSessionForSys, cameraInput: camera.CameraInput, previewOutput: camera.PreviewOutput): void {
2564  photoSession.beginConfig();
2565  photoSession.addInput(cameraInput);
2566  photoSession.addOutput(previewOutput);
2567  photoSession.commitConfig();
2568
2569  photoSession.on('featureDetection', camera.SceneFeatureType.MOON_CAPTURE_BOOST,
2570    (err: BusinessError, statusObject: camera.SceneFeatureDetectionResult) => {
2571      if (err !== undefined && err.code !== 0) {
2572        console.error(`Callback Error, errorCode: ${err.code}`);
2573        return;
2574      }
2575      console.info(
2576        `on featureDetectionStatus featureType:${statusObject.featureType} detected:${statusObject.detected}`);
2577      if (statusObject.featureType === camera.SceneFeatureType.MOON_CAPTURE_BOOST) {
2578        try {
2579          photoSession.enableSceneFeature(statusObject.featureType, statusObject.detected);
2580        } catch (error) {
2581          let err = error as BusinessError;
2582          console.error(`The enableSceneFeature call failed. error code: ${err.code}`);
2583        }
2584      }
2585    });
2586}
2587```
2588
2589## ZoomPointInfo<sup>12+</sup>
2590
2591Describes the equivalent focal length information.
2592
2593**System API**: This is a system API.
2594
2595**System capability**: SystemCapability.Multimedia.Camera.Core
2596
2597| Name    | Type       |   Read-only  | Optional | Description      |
2598| -------- | ---------- | -------- |-----| ---------- |
2599| zoomRatio |   number   |   Yes    | No  | Zoom ratio.|
2600| equivalentFocalLength |   number   |   Yes    | No  | Equivalent focal length corresponding to the current focal length ratio.|
2601
2602## ZoomQuery<sup>12+</sup>
2603
2604Provides the API to obtain the equivalent focal length information list in the current mode.
2605
2606### getZoomPointInfos<sup>12+</sup>
2607
2608getZoomPointInfos(): Array\<ZoomPointInfo\>
2609
2610Obtains the equivalent focal length information list in the current mode.
2611
2612**System API**: This is a system API.
2613
2614**System capability**: SystemCapability.Multimedia.Camera.Core
2615
2616**Return value**
2617
2618| Type               | Description                                                 |
2619| ----------          | -----------------------------                         |
2620|  Array\<[ZoomPointInfo](#zoompointinfo12)\>| Equivalent focal length information list in the current mode.                  |
2621
2622**Error codes**
2623
2624For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2625
2626| ID        | Error Message       |
2627| --------------- | --------------- |
2628| 202                    |  Not System Application.                      |
2629| 7400103                |  Session not config.                          |
2630
2631**Example**
2632
2633```ts
2634import { BusinessError } from '@kit.BasicServicesKit';
2635
2636function getZoomPointInfos(): Array<ZoomPointInfo> {
2637  try {
2638    let zoomPointInfos: Array<ZoomPointInfo> = sessionExtendsZoom.getZoomPointInfos();
2639	return zoomPointInfos;
2640  } catch (error) {
2641    // If the operation fails, error.code is returned and processed.
2642    let err = error as BusinessError;
2643    console.error(`The getZoomPointInfos call failed. error code: ${err.code}`);
2644  }
2645}
2646```
2647
2648## Zoom<sup>11+</sup>
2649
2650Zoom extend [ZoomQuery](#zoomquery12)
2651
2652Provides 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.
2653
2654### prepareZoom<sup>11+</sup>
2655
2656prepareZoom(): void
2657
2658Instructs the bottom layer to prepare for zooming, for example, powering on the sensor.
2659
2660**System API**: This is a system API.
2661
2662**System capability**: SystemCapability.Multimedia.Camera.Core
2663
2664**Error codes**
2665
2666For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2667
2668| ID        | Error Message       |
2669| --------------- | --------------- |
2670| 202                    |  Not System Application.                      |
2671| 7400103                |  Session not config.                          |
2672
2673**Example**
2674
2675```ts
2676import { BusinessError } from '@kit.BasicServicesKit';
2677
2678function prepareZoom(sessionExtendsZoom: camera.Zoom): void {
2679  try {
2680    sessionExtendsZoom.prepareZoom();
2681  } catch (error) {
2682    // If the operation fails, error.code is returned and processed.
2683    let err = error as BusinessError;
2684    console.error(`The prepareZoom call failed. error code: ${err.code}`);
2685  }
2686}
2687```
2688
2689### unprepareZoom<sup>11+</sup>
2690
2691unprepareZoom(): void
2692
2693Instructs the bottom layer to unprepare for zooming.
2694
2695**System API**: This is a system API.
2696
2697**System capability**: SystemCapability.Multimedia.Camera.Core
2698
2699**Error codes**
2700
2701For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2702
2703| ID        | Error Message       |
2704| --------------- | --------------- |
2705| 202                    |  Not System Application.                      |
2706| 7400103                |  Session not config.                          |
2707
2708**Example**
2709
2710```ts
2711import { BusinessError } from '@kit.BasicServicesKit';
2712
2713function unprepareZoom(sessionExtendsZoom: camera.Zoom): void {
2714  try {
2715    sessionExtendsZoom.unprepareZoom();
2716  } catch (error) {
2717    // If the operation fails, error.code is returned and processed.
2718    let err = error as BusinessError;
2719    console.error(`The unprepareZoom call failed. error code: ${err.code}`);
2720  }
2721}
2722```
2723
2724## ZoomRange<sup>11+</sup>
2725
2726Obtains the supported zoom ratio range. The range is [min, max), which includes the minimum value but excludes the maximum value.
2727
2728**System API**: This is a system API.
2729
2730**System capability**: SystemCapability.Multimedia.Camera.Core
2731
2732| Name    | Type          | Read-only| Mandatory| Description        |
2733| -------- | ------------- |---- | ---- | -------------|
2734| min      | number        | Yes |  N/A  | Minimum value of the zoom ratio range. |
2735| max      | number        | Yes |  N/A  | Maximum value of the zoom ratio range.|
2736
2737## Beauty<sup>11+</sup>
2738
2739Beauty extends [BeautyQuery](#beautyquery12)
2740
2741Provides APIs to obtain and set the beauty effect.
2742
2743### setBeauty<sup>11+</sup>
2744
2745setBeauty(type: BeautyType, value: number): void
2746
2747Sets a beauty type and its level. Beauty mode is turned off only when all the [beauty types](#beautytype) obtained through [getSupportedBeautyTypes](#getsupportedbeautytypes11) are disabled.
2748
2749**System API**: This is a system API.
2750
2751**System capability**: SystemCapability.Multimedia.Camera.Core
2752
2753**Parameters**
2754
2755| Name     | Type                   | Mandatory| Description                                                               |
2756| -------- | --------------------------| ---- |-------------------------------------------------------------------|
2757| type     | [BeautyType](#beautytype) | Yes  | Beauty type.                                                            |
2758| value    | number                    | Yes  | Beauty level, which is obtained through [getSupportedBeautyRange](#getsupportedbeautyrange11).|
2759
2760**Error codes**
2761
2762For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2763
2764| ID        | Error Message       |
2765| --------------- | --------------- |
2766| 202                |  Not System Application.                                   |
2767| 7400103                |  Session not config.                                   |
2768
2769**Example**
2770
2771```ts
2772function setBeauty(portraitPhotoSession: camera.PortraitPhotoSession): void {
2773  let beautyTypes: Array<camera.BeautyType> = portraitPhotoSession.getSupportedBeautyTypes();
2774  if (beautyTypes === undefined || beautyTypes.length <= 0) {
2775    return;
2776  }
2777  let beautyLevels: Array<number> = portraitPhotoSession.getSupportedBeautyRange(beautyTypes[0]);
2778  if (beautyLevels === undefined || beautyLevels.length <= 0) {
2779    return;
2780  }
2781  portraitPhotoSession.setBeauty(beautyTypes[0], beautyLevels[0]);
2782}
2783```
2784
2785### getBeauty<sup>11+</sup>
2786
2787getBeauty(type: BeautyType): number
2788
2789Obtains the level of the beauty type in use.
2790
2791**System API**: This is a system API.
2792
2793**System capability**: SystemCapability.Multimedia.Camera.Core
2794
2795**Parameters**
2796
2797| Name     | Type                                             | Mandatory| Description                   |
2798| -------- | ------------------------------------------------- | ---- | --------------------- |
2799| type     | [BeautyType](#beautytype) | Yes  | Beauty type.  |
2800
2801**Return value**
2802| Name     | Type                                             | Mandatory| Description                   |
2803| -------- | ------------------------------------------------- | ---- | --------------------- |
2804| value     | number | Yes  | Beauty level. |
2805
2806**Error codes**
2807
2808For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2809
2810| ID        | Error Message       |
2811| --------------- | --------------- |
2812| 202                |  Not System Application.                                   |
2813| 7400103                |  Session not config.                                   |
2814
2815**Example**
2816
2817```ts
2818function getBeauty(portraitPhotoSession: camera.PortraitPhotoSession): number {
2819  const invalidValue: number = -1;
2820  let beautyTypes = portraitPhotoSession.getSupportedBeautyTypes();
2821  if (beautyTypes === undefined || beautyTypes.length <= 0) {
2822    return invalidValue;
2823  }
2824  let beautyLevels: Array<number> = portraitPhotoSession.getSupportedBeautyRange(beautyTypes[0]);
2825  if (beautyLevels === undefined || beautyLevels.length <= 0) {
2826    return invalidValue;
2827  }
2828  portraitPhotoSession.setBeauty(beautyTypes[0], beautyLevels[0]);
2829  let beautyLevel: number = portraitPhotoSession.getBeauty(beautyTypes[0]);
2830  return beautyLevel;
2831}
2832```
2833
2834## ColorEffectQuery<sup>12+</sup>
2835
2836Provides the API to obtain the color effects supported.
2837
2838### getSupportedColorEffects<sup>11+</sup>
2839
2840getSupportedColorEffects(): Array\<ColorEffectType\>
2841
2842Obtains the supported color effects.
2843
2844**System API**: This is a system API.
2845
2846**System capability**: SystemCapability.Multimedia.Camera.Core
2847
2848**Return value**
2849
2850| Type                                            | Description                          |
2851| ----------------------------------------------- | ---------------------------- |
2852| Array<[ColorEffectType](#coloreffecttype11)>       | Array of color effects supported.          |
2853
2854**Error codes**
2855
2856For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2857
2858| ID        | Error Message       |
2859| --------------- | --------------- |
2860| 7400103         |  Session not config.                      |
2861| 202             |  Not System Application.                  |
2862
2863**Example**
2864
2865```ts
2866function getSupportedColorEffects(session: camera.PhotoSessionForSys): Array<camera.ColorEffectType> {
2867  let colorEffects: Array<camera.ColorEffectType> = session.getSupportedColorEffects();
2868  return colorEffects;
2869}
2870```
2871
2872## ColorEffect<sup>11+</sup>
2873
2874ColorEffect extends [ColorEffectQuery](#coloreffectquery12)
2875
2876Provides the APIs to obtain and set the lens color effect.
2877
2878### setColorEffect<sup>11+</sup>
2879
2880setColorEffect(type: ColorEffectType): void
2881
2882Sets a color effect. Before the setting, call [getSupportedColorEffects](#getsupportedcoloreffects11) to obtain the supported color effects.
2883
2884**System API**: This is a system API.
2885
2886**System capability**: SystemCapability.Multimedia.Camera.Core
2887
2888**Parameters**
2889
2890| Name        | Type                                                           | Mandatory| Description                     |
2891| ------------ |--------------------------------------------------------------- | -- | -------------------------- |
2892| type | [ColorEffectType](#coloreffecttype11)                              | Yes| Color effect, which can be obtained through [getSupportedColorEffects](#getsupportedcoloreffects11).  |
2893
2894**Error codes**
2895
2896For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2897
2898| ID        | Error Message       |
2899| --------------- | --------------- |
2900| 7400103                |  Session not config.                                   |
2901| 202             |  Not System Application.                         |
2902
2903**Example**
2904
2905```ts
2906function setColorEffect(session: camera.PhotoSessionForSys, colorEffect: camera.ColorEffectType): void {
2907  session.setColorEffect(colorEffect);
2908}
2909```
2910
2911### getColorEffect<sup>11+</sup>
2912
2913getColorEffect(): ColorEffectType
2914
2915Obtains the color effect in use.
2916
2917**System API**: This is a system API.
2918
2919**System capability**: SystemCapability.Multimedia.Camera.Core
2920
2921**Return value**
2922
2923| Type                                            | Description                          |
2924| ----------------------------------------------- | ---------------------------- |
2925| [ColorEffectType](#coloreffecttype11)             | Color effect.               |
2926
2927**Error codes**
2928
2929For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2930
2931| ID        | Error Message       |
2932| --------------- | --------------- |
2933| 7400103                |  Session not config.                                   |
2934| 202             |  Not System Application.                         |
2935
2936**Example**
2937
2938```ts
2939function getColorEffect(session: camera.PhotoSessionForSys): camera.ColorEffectType {
2940  let colorEffect: camera.ColorEffectType = session.getColorEffect();
2941  return colorEffect;
2942}
2943```
2944
2945## ColorEffectType<sup>11+</sup>
2946
2947Enumerates the color effect types.
2948
2949**System API**: This is a system API.
2950
2951**System capability**: SystemCapability.Multimedia.Camera.Core
2952
2953| Name                 | Value  | Description      |
2954| --------------------- | ---- | --------- |
2955| NORMAL                | 0    | Regular color effect. |
2956| BRIGHT                | 1    | Bright color effect. |
2957| SOFT                  | 2    | Soft color effect. |
2958| BLACK_WHITE<sup>12+</sup>    | 3    | Black and white color effect. |
2959
2960## Portrait<sup>11+</sup>
2961
2962Provides the APIs for portrait photo settings.
2963
2964### getSupportedPortraitEffects<sup>10+</sup>
2965
2966getSupportedPortraitEffects(): Array\<PortraitEffect\>
2967
2968Obtains the supported portrait effects.
2969
2970**System API**: This is a system API.
2971
2972**System capability**: SystemCapability.Multimedia.Camera.Core
2973
2974**Return value**
2975
2976| Type                                            | Description                          |
2977| ----------------------------------------------- | ---------------------------- |
2978| Array<[PortraitEffect](#portraiteffect)> | Array of portrait effects supported.              |
2979
2980**Error codes**
2981
2982For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
2983
2984| ID        | Error Message       |
2985| --------------- | --------------- |
2986| 7400103         |  Session not config.                |
2987| 202             |  Not System Application.            |
2988
2989**Example**
2990
2991```ts
2992function getSupportedPortraitEffects(portraitPhotoSession: camera.PortraitPhotoSession): Array<camera.PortraitEffect> {
2993  let portraitEffects: Array<camera.PortraitEffect> = portraitPhotoSession.getSupportedPortraitEffects();
2994  return portraitEffects;
2995}
2996```
2997
2998### setPortraitEffect<sup>10+</sup>
2999
3000setPortraitEffect(effect: PortraitEffect): void
3001
3002Sets a portrait effect. Before the setting, call [getSupportedPortraitEffects](#getsupportedportraiteffects10) to obtain the supported portrait effects and check whether the target portrait effect is supported.
3003
3004**System API**: This is a system API.
3005
3006**System capability**: SystemCapability.Multimedia.Camera.Core
3007
3008**Parameters**
3009
3010| Name        | Type                       | Mandatory| Description                     |
3011| ------------ |----------------------------- | -- | -------------------------- |
3012| effect | [PortraitEffect](#portraiteffect)  | Yes| Portrait effect, which can be obtained through [getSupportedPortraitEffects](#getsupportedportraiteffects10).  |
3013
3014**Error codes**
3015
3016For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3017
3018| ID        | Error Message       |
3019| --------------- | --------------- |
3020| 7400103         |  Session not config.                                   |
3021| 202             |  Not System Application.                         |
3022
3023**Example**
3024
3025```ts
3026import { BusinessError } from '@kit.BasicServicesKit';
3027
3028function setPortraitEffect(portraitPhotoSession: camera.PortraitPhotoSession, portraitEffects: Array<camera.PortraitEffect>): void {
3029  if (portraitEffects === undefined || portraitEffects.length <= 0) {
3030    return;
3031  }
3032  try {
3033    portraitPhotoSession.setPortraitEffect(portraitEffects[0]);
3034  } catch (error) {
3035    let err = error as BusinessError;
3036    console.error(`The setPortraitEffect call failed. error code: ${err.code}`);
3037  }
3038}
3039```
3040
3041### getPortraitEffect<sup>10+</sup>
3042
3043getPortraitEffect(): PortraitEffect
3044
3045Obtains the portrait effect in use.
3046
3047**System API**: This is a system API.
3048
3049**System capability**: SystemCapability.Multimedia.Camera.Core
3050
3051**Return value**
3052
3053| Type                                            | Description                          |
3054| ----------------------------------------------- | ---------------------------- |
3055| [PortraitEffect](#portraiteffect)               | Portrait effect.               |
3056
3057**Error codes**
3058
3059For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3060
3061| ID        | Error Message       |
3062| --------------- | --------------- |
3063| 7400103         |  Session not config.                |
3064| 202             |  Not System Application.            |
3065
3066**Example**
3067
3068```ts
3069function getPortraitEffect(portraitPhotoSession: camera.PortraitPhotoSession): camera.PortraitEffect {
3070  let portraitEffect: camera.PortraitEffect = portraitPhotoSession.getPortraitEffect();
3071  return portraitEffect;
3072}
3073```
3074
3075## PhysicalAperture<sup>11+</sup>
3076
3077Defines the physical aperture information.
3078
3079**System API**: This is a system API.
3080
3081**System capability**: SystemCapability.Multimedia.Camera.Core
3082
3083| Name      | Type                      |  Read-only| Optional | Description              |
3084| ---------- | ------------------------- | ----- |-----| ----------------- |
3085| zoomRange  | [ZoomRange](#zoomrange11) | No   | No  | Zoom range of a given physical aperture. |
3086| apertures  | Array\<number\>           | No   | No  | Array of physical apertures supported.     |
3087
3088## Aperture<sup>11+</sup>
3089
3090Provides the APIs for aperture settings.
3091
3092### getSupportedVirtualApertures<sup>11+</sup>
3093
3094getSupportedVirtualApertures(): Array\<number\>
3095
3096Obtains the supported virtual apertures.
3097
3098**System API**: This is a system API.
3099
3100**System capability**: SystemCapability.Multimedia.Camera.Core
3101
3102**Return value**
3103
3104| Type                                            | Description                          |
3105| ----------------------------------------------- | ---------------------------- |
3106| Array\<number\> | Array of virtual apertures supported.              |
3107
3108**Error codes**
3109
3110For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3111
3112| ID        | Error Message       |
3113| --------------- | --------------- |
3114| 7400103         |  Session not config.                             |
3115| 202             |  Not System Application.                         |
3116
3117**Example**
3118
3119```ts
3120function getSupportedVirtualApertures(session: camera.PortraitPhotoSession): Array<number> {
3121  let virtualApertures: Array<number> = session.getSupportedVirtualApertures();
3122  return virtualApertures;
3123}
3124```
3125
3126### getVirtualAperture<sup>11+</sup>
3127
3128getVirtualAperture(): number
3129
3130Obtains the virtual aperture in use.
3131
3132**System API**: This is a system API.
3133
3134**System capability**: SystemCapability.Multimedia.Camera.Core
3135
3136**Return value**
3137
3138| Type                                            | Description                          |
3139| ----------------------------------------------- | ---------------------------- |
3140| number               | Virtual aperture.               |
3141
3142**Error codes**
3143
3144For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3145
3146| ID        | Error Message       |
3147| --------------- | --------------- |
3148| 7400103         |  Session not config.                             |
3149| 202             |  Not System Application.                         |
3150
3151**Example**
3152
3153```ts
3154function getVirtualAperture(session: camera.PortraitPhotoSession): number {
3155  let virtualAperture: number = session.getVirtualAperture();
3156  return virtualAperture;
3157}
3158```
3159
3160### setVirtualAperture<sup>11+</sup>
3161
3162setVirtualAperture(aperture: number): void
3163
3164Sets a virtual aperture. Before the setting, call [getSupportedVirtualApertures](#getsupportedvirtualapertures11) to obtain the supported virtual apertures.
3165
3166**System API**: This is a system API.
3167
3168**System capability**: SystemCapability.Multimedia.Camera.Core
3169
3170**Parameters**
3171
3172| Name        | Type                   | Mandatory| Description                     |
3173| ------------ |------------------------- | -- | -------------------------- |
3174| aperture       | number                 | Yes| Virtual aperture, which can be obtained by calling [getSupportedVirtualApertures](#getsupportedvirtualapertures11).  |
3175
3176**Error codes**
3177
3178For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3179
3180| ID        | Error Message       |
3181| --------------- | --------------- |
3182| 7400103         |  Session not config.                          |
3183| 202             |  Not System Application.                      |
3184
3185**Example**
3186
3187```ts
3188function setVirtualAperture(session: camera.PortraitPhotoSession, virtualAperture: number): void {
3189  session.setVirtualAperture(virtualAperture);
3190}
3191```
3192
3193### getSupportedPhysicalApertures<sup>11+</sup>
3194
3195getSupportedPhysicalApertures(): Array\<PhysicalAperture\>
3196
3197Obtains the supported physical apertures.
3198
3199**System API**: This is a system API.
3200
3201**System capability**: SystemCapability.Multimedia.Camera.Core
3202
3203**Return value**
3204
3205| Type                                            | Description                          |
3206| ----------------------------------------------- | ---------------------------- |
3207| Array<[PhysicalAperture](#physicalaperture11)>    | Array of physical apertures supported.              |
3208
3209**Error codes**
3210
3211For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3212
3213| ID        | Error Message       |
3214| --------------- | --------------- |
3215| 7400103         |  Session not config.                          |
3216| 202             |  Not System Application.                      |
3217
3218**Example**
3219
3220```ts
3221function getSupportedPhysicalApertures(session: camera.PortraitPhotoSession): Array<camera.PhysicalAperture> {
3222  let physicalApertures: Array<camera.PhysicalAperture> = session.getSupportedPhysicalApertures();
3223  return physicalApertures;
3224}
3225```
3226
3227### getPhysicalAperture<sup>11+</sup>
3228
3229getPhysicalAperture(): number
3230
3231Obtains the physical aperture in use.
3232
3233**System API**: This is a system API.
3234
3235**System capability**: SystemCapability.Multimedia.Camera.Core
3236
3237**Return value**
3238
3239| Type                | Description                          |
3240| -------------------- | ---------------------------- |
3241| number               | Physical aperture.          |
3242
3243**Error codes**
3244
3245For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3246
3247| ID        | Error Message       |
3248| --------------- | --------------- |
3249| 7400103         |  Session not config.                             |
3250| 202             |  Not System Application.                         |
3251
3252**Example**
3253
3254```ts
3255function getPhysicalAperture(session: camera.PortraitPhotoSession): number {
3256  let physicalAperture: number = session.getPhysicalAperture();
3257  return physicalAperture;
3258}
3259```
3260
3261### setPhysicalAperture<sup>11+</sup>
3262
3263setPhysicalAperture(aperture: number): void
3264
3265Sets a physical aperture. Before the setting, call [getSupportedPhysicalApertures](#getsupportedphysicalapertures11) to obtain the supported physical apertures.
3266
3267**System API**: This is a system API.
3268
3269**System capability**: SystemCapability.Multimedia.Camera.Core
3270
3271**Parameters**
3272
3273| Name        | Type                   | Mandatory| Description                     |
3274| ------------ |------------------------- | -- | -------------------------- |
3275| aperture       | number                 | Yes| Physical aperture, which can be obtained by calling [getSupportedPhysicalApertures](#getsupportedphysicalapertures11).  |
3276
3277**Error codes**
3278
3279For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3280
3281| ID        | Error Message       |
3282| --------------- | --------------- |
3283| 7400103         |  Session not config.                          |
3284| 202             |  Not System Application.                      |
3285
3286**Example**
3287
3288```ts
3289function setPhysicalAperture(session: camera.PortraitPhotoSession, physicalAperture: number): void {
3290  session.setPhysicalAperture(physicalAperture);
3291}
3292```
3293
3294## CaptureSession<sup>(deprecated)</sup>
3295
3296Implements 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.
3297
3298> **NOTE**
3299>
3300> 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.
3301
3302### getSupportedBeautyTypes<sup>(deprecated)</sup>
3303
3304getSupportedBeautyTypes(): Array\<BeautyType>
3305
3306Obtains the supported beauty types.
3307
3308> **NOTE**
3309>
3310> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [Beauty.getSupportedBeautyTypes](#getsupportedbeautytypes11) instead.
3311
3312**System API**: This is a system API.
3313
3314**System capability**: SystemCapability.Multimedia.Camera.Core
3315
3316**Return value**
3317
3318| Type               | Description                                                 |
3319| ----------          | -----------------------------                         |
3320|  Array\<[BeautyType](#beautytype)\>| Array of beauty types supported.                            |
3321
3322**Error codes**
3323
3324For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3325
3326| ID        | Error Message       |
3327| --------------- | --------------- |
3328| 7400103                |  Session not config.                                   |
3329
3330**Example**
3331
3332```ts
3333function getSupportedBeautyTypes(captureSession: camera.CaptureSession): Array<camera.BeautyType> {
3334  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3335  return beautyTypes;
3336}
3337```
3338
3339### getSupportedBeautyRange<sup>(deprecated)</sup>
3340
3341getSupportedBeautyRange(type: BeautyType): Array\<number\>
3342
3343Obtains 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.
3344
3345| Input Parameter          | Example Return Value   | Return Value Description    |
3346| ----------------| ----  | ---------|
3347| 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.   |
3348| 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.   |
3349| 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.  |
3350| 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.   |
3351
3352> **NOTE**
3353>
3354> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [Beauty.getSupportedBeautyRange](#getsupportedbeautyrange11) instead.
3355
3356**System API**: This is a system API.
3357
3358**System capability**: SystemCapability.Multimedia.Camera.Core
3359
3360**Parameters**
3361
3362| Name     | Type                   | Mandatory| Description      |
3363| -------- | --------------------------| ---- | ----------|
3364| type     | [BeautyType](#beautytype) | Yes  | Beauty type.  |
3365
3366**Return value**
3367
3368| Type       | Description                         |
3369| ---------- | ----------------------------- |
3370|  Array\<number\>     | Array of levels supported.|
3371
3372**Error codes**
3373
3374For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3375
3376| ID        | Error Message       |
3377| --------------- | --------------- |
3378| 7400103                |  Session not config.                                   |
3379
3380**Example**
3381
3382```ts
3383function getSupportedBeautyRange(captureSession: camera.CaptureSession): Array<number> {
3384  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3385  if (beautyTypes === undefined || beautyTypes.length <= 0) {
3386    return [];
3387  }
3388  let beautyLevels: Array<number> = captureSession.getSupportedBeautyRange(beautyTypes[0]);
3389  return beautyLevels;
3390}
3391```
3392
3393### setBeauty<sup>(deprecated)</sup>
3394
3395setBeauty(type: BeautyType, value: number): void
3396
3397Sets a beauty type and its level. Beauty mode is turned off only when all the [beauty types](#beautytype) obtained through [getSupportedBeautyTypes](#getsupportedbeautytypesdeprecated) are disabled.
3398
3399> **NOTE**
3400>
3401> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [Beauty.setBeauty](#setbeauty11) instead.
3402
3403**System API**: This is a system API.
3404
3405**System capability**: SystemCapability.Multimedia.Camera.Core
3406
3407**Parameters**
3408
3409| Name     | Type                   | Mandatory| Description                  |
3410| -------- | --------------------------| ---- | --------------------- |
3411| type     | [BeautyType](#beautytype) | Yes  | Beauty type.             |
3412| value    | number                    | Yes  | Beauty level, which is obtained through [getSupportedBeautyRange](#getsupportedbeautyrangedeprecated).|
3413
3414**Error codes**
3415
3416For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3417
3418| ID        | Error Message       |
3419| --------------- | --------------- |
3420| 7400103                |  Session not config.                                   |
3421
3422**Example**
3423
3424```ts
3425function setBeauty(captureSession: camera.CaptureSession): void {
3426  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3427  if (beautyTypes === undefined || beautyTypes.length <= 0) {
3428    return;
3429  }
3430  let beautyLevels: Array<number> = captureSession.getSupportedBeautyRange(beautyTypes[0]);
3431  if (beautyLevels === undefined || beautyLevels.length <= 0) {
3432    return;
3433  }
3434  captureSession.setBeauty(beautyTypes[0], beautyLevels[0]);
3435}
3436```
3437
3438### getBeauty<sup>(deprecated)</sup>
3439
3440getBeauty(type: BeautyType): number
3441
3442Obtains the level of the beauty type in use.
3443
3444> **NOTE**
3445>
3446> This API is supported since API version 10 and deprecated since API version 11. You are advised to use [Beauty.getBeauty](#getbeauty11) instead.
3447
3448**System API**: This is a system API.
3449
3450**System capability**: SystemCapability.Multimedia.Camera.Core
3451
3452**Parameters**
3453
3454| Name     | Type                                             | Mandatory| Description                   |
3455| -------- | ------------------------------------------------- | ---- | --------------------- |
3456| type     | [BeautyType](#beautytype) | Yes  | Beauty type.  |
3457
3458**Return value**
3459| Name     | Type                                             | Mandatory| Description                   |
3460| -------- | ------------------------------------------------- | ---- | --------------------- |
3461| value     | number | Yes  | Beauty level. |
3462
3463**Error codes**
3464
3465For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3466
3467| ID        | Error Message       |
3468| --------------- | --------------- |
3469| 7400103                |  Session not config.                                   |
3470
3471**Example**
3472
3473```ts
3474function getBeauty(captureSession: camera.CaptureSession): number {
3475  const invalidValue: number = -1;
3476  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3477  if (beautyTypes === undefined || beautyTypes.length <= 0) {
3478    return invalidValue;
3479  }
3480  let beautyLevels: Array<number> = captureSession.getSupportedBeautyRange(beautyTypes[0]);
3481  if (beautyLevels === undefined || beautyLevels.length <= 0) {
3482    return invalidValue;
3483  }
3484  captureSession.setBeauty(beautyTypes[0], beautyLevels[0]);
3485  let beautyLevel: number = captureSession.getBeauty(beautyTypes[0]);
3486  return beautyLevel;
3487}
3488```
3489
3490## PhotoSessionForSys<sup>11+</sup>
3491
3492PhotoSessionForSys extends PhotoSession, Beauty, ColorEffect, ColorManagement, Macro, SceneDetection
3493
3494Implements 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).
3495
3496**System API**: This is a system API.
3497
3498**System capability**: SystemCapability.Multimedia.Camera.Core
3499
3500## PhotoSession<sup>11+</sup>
3501
3502PhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorManagement
3503
3504Implements 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).
3505
3506### on('macroStatusChanged')<sup>11+</sup>
3507
3508on(type: 'macroStatusChanged', callback: AsyncCallback\<boolean\>): void
3509
3510Subscribes to macro state change events. This API uses an asynchronous callback to return the result.
3511
3512**System API**: This is a system API.
3513
3514**System capability**: SystemCapability.Multimedia.Camera.Core
3515
3516**Parameters**
3517
3518| Name    | Type                                     | Mandatory| Description                      |
3519| -------- | ----------------------------------------- | ---- | ------------------------ |
3520| type     | string      | Yes  | Event type. The value is fixed at **'macroStatusChanged'**. The event can be listened for when a session is created.|
3521| callback | AsyncCallback\<boolean\>     | Yes  | Callback used to return the macro state. The value **true** means that the macro state is enabled, and **false** means that it is disabled. |
3522
3523**Error codes**
3524
3525For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3526
3527| ID| Error Message                     |
3528|-------|---------------------------|
3529| 202   | Not System Application.   |
3530
3531**Example**
3532
3533```ts
3534import { BusinessError } from '@kit.BasicServicesKit';
3535
3536function callback(err: BusinessError, macroStatus: boolean): void {
3537  if (err !== undefined && err.code !== 0) {
3538    console.error(`Callback Error, errorCode: ${err.code}`);
3539    return;
3540  }
3541  console.info(`Macro state: ${macroStatus}`);
3542}
3543
3544function registerMacroStatusChanged(photoSession: camera.PhotoSession): void {
3545  photoSession.on('macroStatusChanged', callback);
3546}
3547```
3548
3549### off('macroStatusChanged')<sup>11+</sup>
3550
3551off(type: 'macroStatusChanged', callback?: AsyncCallback\<boolean\>): void
3552
3553Unsubscribes from macro state change events.
3554
3555**System API**: This is a system API.
3556
3557**System capability**: SystemCapability.Multimedia.Camera.Core
3558
3559**Parameters**
3560
3561| Name    | Type                   | Mandatory| Description                      |
3562| -------- | ------------------------ | ---- | ------------------------ |
3563| type     | string                   | Yes  | Event type. The value is fixed at **'macroStatusChanged'**. The event can be listened for when a session is created.|
3564| callback | AsyncCallback\<boolean\> | No  | Callback used to return the macro state. The value **true** means that the macro state is enabled, and **false** means that it is disabled. 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.)|
3565
3566**Error codes**
3567
3568For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3569
3570| ID| Error Message                     |
3571|-------|---------------------------|
3572| 202   | Not System Application.   |
3573
3574**Example**
3575
3576```ts
3577function unregisterMacroStatusChanged(photoSession: camera.PhotoSession): void {
3578  photoSession.off('macroStatusChanged');
3579}
3580```
3581
3582### on('featureDetection')<sup>12+</sup>
3583
3584on(type: 'featureDetection', featureType: SceneFeatureType, callback: AsyncCallback\<SceneFeatureDetectionResult\>): void
3585
3586Subscribe to scene feature detection status change events. This API uses an asynchronous callback to return the result.
3587
3588**System API**: This is a system API.
3589
3590**System capability**: SystemCapability.Multimedia.Camera.Core
3591
3592**Parameters**
3593
3594| Name    | Type                                     | Mandatory| Description                      |
3595| -------- | ----------------------------------------- | ---- | ------------------------ |
3596| type     | string      | Yes  | Event type. The value is fixed at **'featureDetection'**. The event can be listened for when a photo session is created.|
3597| featureType     | [SceneFeatureType](#scenefeaturetype12)      | Yes  | Scene feature type.|
3598| callback | AsyncCallback\<[SceneFeatureDetectionResult](#scenefeaturedetectionresult12)\>     | Yes  | Callback used to return the status of the scene feature detection. |
3599
3600**Error codes**
3601
3602For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3603
3604| ID| Error Message                     |
3605|-------|---------------------------|
3606| 202   | Not System Application.   |
3607
3608**Example**
3609
3610```ts
3611import { BusinessError } from '@kit.BasicServicesKit';
3612
3613function callback(err: BusinessError, result: camera.SceneFeatureDetectionResult): void {
3614  if (err !== undefined && err.code !== 0) {
3615    console.error(`Callback Error, errorCode: ${err.code}`);
3616    return;
3617  }
3618  console.info(`feature type: ${result.featureType}`);
3619  console.info(`feature status: ${result.detected}`);
3620}
3621
3622function registerFeatureDetectionStatus(photoSession: camera.PhotoSession, featureType: camera.SceneFeatureType): void {
3623  photoSession.on('featureDetection', featureType, callback);
3624}
3625```
3626
3627### off('featureDetection')<sup>12+</sup>
3628
3629off(type: 'featureDetection', featureType: SceneFeatureType, callback?: AsyncCallback\<SceneFeatureDetectionResult\>): void
3630
3631Unsubscribe from camera feature detection status change events.
3632
3633**System API**: This is a system API.
3634
3635**System capability**: SystemCapability.Multimedia.Camera.Core
3636
3637**Parameters**
3638
3639| Name   | Type                    | Mandatory| Description                      |
3640| -------- | ------------------------ | ---- | ------------------------ |
3641| type     | string                   | Yes  | Event type. The value is fixed at **'featureDetection'**. The event can be listened for when a session is created.|
3642| featureType     | [SceneFeatureType](#scenefeaturetype12)      | Yes  | Scene feature type.|
3643| 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.)|
3644
3645**Error codes**
3646
3647For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3648
3649| ID| Error Message                     |
3650|-------|---------------------------|
3651| 202   | Not System Application.   |
3652
3653**Example**
3654
3655```ts
3656function unregisterFeatureDetectionStatus(photoSession: camera.PhotoSession, featureType: camera.SceneFeatureType): void {
3657  photoSession.off('featureDetection', featureType);
3658}
3659```
3660
3661### on('lcdFlashStatus')<sup>13+</sup>
3662
3663on(type: 'lcdFlashStatus', callback: AsyncCallback\<LcdFlashStatus\>): void
3664
3665Subscribes to LCD flash status change events. This API uses an asynchronous callback to return the result.
3666
3667**System API**: This is a system API.
3668
3669**System capability**: SystemCapability.Multimedia.Camera.Core
3670
3671**Parameters**
3672
3673| Name    | Type                                     | Mandatory| Description                                      |
3674| -------- | ----------------------------------------- | ---- |------------------------------------------|
3675| type     | string      | Yes  | Event type. The value is fixed at **'lcdFlashStatus'**. The event can be listened for when a session is created.|
3676| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>     | Yes  | Callback used to return the LCD flash status change.                 |
3677
3678**Error codes**
3679
3680For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3681
3682| ID| Error Message                     |
3683|-------|---------------------------|
3684| 202   | Not System Application.   |
3685
3686**Example**
3687
3688```ts
3689import { BusinessError } from '@kit.BasicServicesKit';
3690
3691function callback(err: BusinessError, lcdFlashStatus: camera.LcdFlashStatus): void {
3692  if (err !== undefined && err.code !== 0) {
3693    console.error(`Callback Error, errorCode: ${err.code}`);
3694    return;
3695  }
3696  console.info(`isLcdFlashNeeded: ${lcdFlashStatus.isLcdFlashNeeded}`);
3697  console.info(`lcdCompensation: ${lcdFlashStatus.lcdCompensation}`);
3698}
3699
3700function registerLcdFlashStatus(photoSession: camera.PhotoSession): void {
3701  photoSession.on('lcdFlashStatus', callback);
3702}
3703```
3704
3705### off('lcdFlashStatus')<sup>13+</sup>
3706
3707off(type: 'lcdFlashStatus', callback?: AsyncCallback\<LcdFlashStatus\>): void
3708
3709Unsubscribes from LCD flash status change events.
3710
3711**System API**: This is a system API.
3712
3713**System capability**: SystemCapability.Multimedia.Camera.Core
3714
3715**Parameters**
3716
3717| Name   | Type                    | Mandatory| Description                                                              |
3718| -------- | ------------------------ | ---- |------------------------------------------------------------------|
3719| type     | string                   | Yes  | Event type. The value is fixed at **'lcdFlashStatus'**. The event can be listened for when a session is created.                      |
3720| 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.)|
3721
3722**Error codes**
3723
3724For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3725
3726| ID| Error Message                     |
3727|-------|---------------------------|
3728| 202   | Not System Application.   |
3729
3730**Example**
3731
3732```ts
3733function unregisterLcdFlashStatus(photoSession: camera.PhotoSession): void {
3734  photoSession.off('lcdFlashStatus');
3735}
3736```
3737
3738## FocusTrackingMode<sup>15+</sup>
3739
3740Enumerates the focus tracking modes.
3741
3742**System capability**: SystemCapability.Multimedia.Camera.Core
3743
3744| Name| Value  | Description  |
3745| ---- | ---- | ------ |
3746| AUTO | 0    | Automatic.|
3747
3748## FocusTrackingInfo<sup>15+</sup>
3749
3750Describes the focus tracking information, which is obtained by calling VideoSessionForSys.[on('focusTrackingInfoAvailable')](#onfocustrackinginfoavailable15).
3751
3752**System capability**: SystemCapability.Multimedia.Camera.Core
3753
3754| Name          | Type                                     | Read-only| Optional| Description      |
3755| -------------- | ----------------------------------------- | ---- | ---- | ---------- |
3756| trackingMode   | [FocusTrackingMode](#focustrackingmode15) | No  | No  | Tracing mode.|
3757| trackingRegion | [Rect](js-apis-camera.md#rect)            | No  | No  | Tracking region.|
3758
3759## VideoSessionForSys<sup>11+</sup>
3760
3761VideoSessionForSys extends VideoSession, Beauty, ColorEffect, ColorManagement, Macro, Aperture, ColorReservation
3762
3763Implements 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).
3764
3765**System API**: This is a system API.
3766
3767**System capability**: SystemCapability.Multimedia.Camera.Core
3768
3769## VideoSession<sup>11+</sup>
3770
3771VideoSession extends Session, Flash, AutoExposure, Focus, Zoom, Stabilization, ColorManagement
3772
3773Implements 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).
3774
3775### on('macroStatusChanged')<sup>11+</sup>
3776
3777on(type: 'macroStatusChanged', callback: AsyncCallback\<boolean\>): void
3778
3779Subscribes to macro state change events. This API uses an asynchronous callback to return the result.
3780
3781**System API**: This is a system API.
3782
3783**System capability**: SystemCapability.Multimedia.Camera.Core
3784
3785**Parameters**
3786
3787| Name    | Type                                     | Mandatory| Description                      |
3788| -------- | ----------------------------------------- | ---- | ------------------------ |
3789| type     | string      | Yes  | Event type. The value is fixed at **'macroStatusChanged'**. The event can be listened for when a session is created.|
3790| callback | AsyncCallback\<boolean\>     | Yes  | Callback used to return the macro state. The value **true** means that the macro state is enabled, and **false** means that it is disabled. |
3791
3792**Error codes**
3793
3794For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3795
3796| ID| Error Message                     |
3797|-------|---------------------------|
3798| 202   | Not System Application.   |
3799
3800**Example**
3801
3802```ts
3803import { BusinessError } from '@kit.BasicServicesKit';
3804
3805function callback(err: BusinessError, macroStatus: boolean): void {
3806  if (err !== undefined && err.code !== 0) {
3807    console.error(`Callback Error, errorCode: ${err.code}`);
3808    return;
3809  }
3810  console.info(`Macro state: ${macroStatus}`);
3811}
3812
3813function registerMacroStatusChanged(videoSession: camera.VideoSession): void {
3814  videoSession.on('macroStatusChanged', callback);
3815}
3816```
3817
3818### off('macroStatusChanged')<sup>11+</sup>
3819
3820off(type: 'macroStatusChanged', callback?: AsyncCallback\<boolean\>): void
3821
3822Unsubscribes from macro state change events.
3823
3824**System API**: This is a system API.
3825
3826**System capability**: SystemCapability.Multimedia.Camera.Core
3827
3828**Parameters**
3829
3830| Name   | Type                    | Mandatory| Description                      |
3831| -------- | ------------------------ | ---- | ------------------------ |
3832| type     | string                   | Yes  | Event type. The value is fixed at **'macroStatusChanged'**. The event can be listened for when a session is created.|
3833| callback | AsyncCallback\<boolean\> | No  | Callback used to return the macro state. The value **true** means that the macro state is enabled, and **false** means that it is disabled. 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.)|
3834
3835**Error codes**
3836
3837For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3838
3839| ID| Error Message                     |
3840|-------|---------------------------|
3841| 202   | Not System Application.   |
3842
3843**Example**
3844
3845```ts
3846function unregisterMacroStatusChanged(videoSession: camera.VideoSession): void {
3847  videoSession.off('macroStatusChanged');
3848}
3849```
3850
3851### on('lcdFlashStatus')<sup>13+</sup>
3852
3853on(type: 'lcdFlashStatus', callback: AsyncCallback\<LcdFlashStatus\>): void
3854
3855Subscribes to LCD flash status change events. This API uses an asynchronous callback to return the result.
3856
3857**System API**: This is a system API.
3858
3859**System capability**: SystemCapability.Multimedia.Camera.Core
3860
3861**Parameters**
3862
3863| Name    | Type                                     | Mandatory| Description                                      |
3864| -------- | ----------------------------------------- | ---- |------------------------------------------|
3865| type     | string      | Yes  | Event type. The value is fixed at **'lcdFlashStatus'**. The event can be listened for when a session is created.|
3866| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>     | Yes  | Callback used to return the LCD flash status change.                 |
3867
3868**Error codes**
3869
3870For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3871
3872| ID| Error Message                     |
3873|-------|---------------------------|
3874| 202   | Not System Application.   |
3875
3876**Example**
3877
3878```ts
3879import { BusinessError } from '@kit.BasicServicesKit';
3880
3881function callback(err: BusinessError, lcdFlashStatus: camera.LcdFlashStatus): void {
3882  if (err !== undefined && err.code !== 0) {
3883    console.error(`Callback Error, errorCode: ${err.code}`);
3884    return;
3885  }
3886  console.info(`isLcdFlashNeeded: ${lcdFlashStatus.isLcdFlashNeeded}`);
3887  console.info(`lcdCompensation: ${lcdFlashStatus.lcdCompensation}`);
3888}
3889
3890function registerLcdFlashStatus(videoSession: camera.VideoSession): void {
3891  videoSession.on('lcdFlashStatus', callback);
3892}
3893```
3894
3895### off('lcdFlashStatus')<sup>13+</sup>
3896
3897off(type: 'lcdFlashStatus', callback?: AsyncCallback\<LcdFlashStatus\>): void
3898
3899Unsubscribes from LCD flash status change events.
3900
3901**System API**: This is a system API.
3902
3903**System capability**: SystemCapability.Multimedia.Camera.Core
3904
3905**Parameters**
3906
3907| Name   | Type                    | Mandatory| Description                                                              |
3908| -------- | ------------------------ | ---- |------------------------------------------------------------------|
3909| type     | string                   | Yes  | Event type. The value is fixed at **'lcdFlashStatus'**. The event can be listened for when a session is created.                      |
3910| 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.)|
3911
3912**Error codes**
3913
3914For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3915
3916| ID| Error Message                     |
3917|-------|---------------------------|
3918| 202   | Not System Application.   |
3919
3920**Example**
3921
3922```ts
3923function unregisterLcdFlashStatus(videoSession: camera.VideoSession): void {
3924  videoSession.off('lcdFlashStatus');
3925}
3926```
3927
3928### on('focusTrackingInfoAvailable')<sup>15+</sup>
3929
3930on(type: 'focusTrackingInfoAvailable', callback: Callback\<FocusTrackingInfo\>): void
3931
3932Subscribes to focus tracking information events. This API uses an asynchronous callback to return the result.
3933
3934**System API**: This is a system API.
3935
3936**System capability**: SystemCapability.Multimedia.Camera.Core
3937
3938**Parameters**
3939
3940| Name  | Type                                                      | Mandatory| Description                                                        |
3941| -------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ |
3942| type     | string                                                     | Yes  | Event type. The value is fixed at **'focusTrackingInfoAvailable'**. The event can be listened for when a **VideoSessionForSys** object is created.|
3943| callback | Callback\<[FocusTrackingInfo](#focustrackinginfo15)\>      | Yes  | Callback used to return the focus tracking information.                        |
3944
3945**Error codes**
3946
3947For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3948
3949| ID| Error Message               |
3950| -------- | ----------------------- |
3951| 202      | Not System Application. |
3952
3953**Example**
3954
3955```ts
3956function callback(focusTrackingInfo: camera.FocusTrackingInfo): void {
3957  console.info(`Focus tracking mode: ${focusTrackingInfo.trackingMode}`);
3958  console.info(`Focus tracking Region: topLeftX ${focusTrackingInfo.trackingRegion.topLeftX}
3959                                       topLeftY ${focusTrackingInfo.trackingRegion.topLeftY}
3960                                       width ${focusTrackingInfo.trackingRegion.width}
3961                                       height ${focusTrackingInfo.trackingRegion.height}`);
3962}
3963
3964function registerFocusTrakingInfoChanged(session: camera.VideoSessionForSys): void {
3965  session.on('focusTrackingInfoAvailable', callback);
3966}
3967```
3968
3969### off('focusTrackingInfoAvailable')<sup>15+</sup>
3970
3971off(type: 'focusTrackingInfoAvailable', callback?: Callback\<FocusTrackingInfo\>): void
3972
3973Unsubscribes from focus tracking information events.
3974
3975**System API**: This is a system API.
3976
3977**System capability**: SystemCapability.Multimedia.Camera.Core
3978
3979**Parameters**
3980
3981| Name  | Type                                                      | Mandatory| Description                                                        |
3982| -------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ |
3983| type     | string                                                     | Yes  | Event type. The value is fixed at **'focusTrackingInfoAvailable'**. The event can be listened for when a **VideoSessionForSys** object is created.|
3984| callback | Callback\<[FocusTrackingInfo](#focustrackinginfo15)\>      | No  | Callback used to return the result. This parameter is optional. If this parameter is specified, the subscription to the specified event **on('focusTrackingInfoAvailable')** with the specified callback is canceled. (The callback object cannot be an anonymous function.)|
3985
3986**Error codes**
3987
3988For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
3989
3990| ID| Error Message               |
3991| -------- | ----------------------- |
3992| 202      | Not System Application. |
3993
3994**Example**
3995
3996```ts
3997function unregisterFocusTrakingInfoChanged(session: camera.VideoSessionForSys): void {
3998  session.off('focusTrackingInfoAvailable');
3999}
4000```
4001
4002## PortraitPhotoSession<sup>11+</sup>
4003
4004PortraitPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty, ColorEffect, ColorManagement, Portrait, Aperture
4005
4006Implements 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).
4007
4008### on('error')<sup>11+</sup>
4009
4010on(type: 'error', callback: ErrorCallback): void
4011
4012Subscribes to **PortraitSession** error events. This API uses an asynchronous callback to return the result.
4013
4014**System API**: This is a system API.
4015
4016**System capability**: SystemCapability.Multimedia.Camera.Core
4017
4018**Parameters**
4019
4020| Name    | Type       | Mandatory| Description                          |
4021| -------- | --------------------------------- | ---- | ------------------------------ |
4022| 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).|
4023| 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).       |
4024
4025**Example**
4026
4027```ts
4028import { BusinessError } from '@kit.BasicServicesKit';
4029
4030function callback(err: BusinessError): void {
4031  console.error(`Portrait photo session error code: ${err.code}`);
4032}
4033
4034function registerSessionError(portraitPhotoSession: camera.PortraitPhotoSession): void {
4035  portraitPhotoSession.on('error', callback);
4036}
4037```
4038
4039### off('error')<sup>11+</sup>
4040
4041off(type: 'error', callback?: ErrorCallback): void
4042
4043Unsubscribes from **PortraitSession** error events.
4044
4045**System API**: This is a system API.
4046
4047**System capability**: SystemCapability.Multimedia.Camera.Core
4048
4049**Parameters**
4050
4051| Name    | Type       | Mandatory| Description                          |
4052| -------- | -------------------------- | ---- | ------------------------------ |
4053| type     | string                     | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
4054| 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.)   |
4055
4056**Example**
4057
4058```ts
4059function unregisterSessionError(portraitPhotoSession: camera.PortraitPhotoSession): void {
4060  portraitPhotoSession.off('error');
4061}
4062```
4063
4064### on('focusStateChange')<sup>11+</sup>
4065
4066on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4067
4068Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
4069
4070**System API**: This is a system API.
4071
4072**System capability**: SystemCapability.Multimedia.Camera.Core
4073
4074**Parameters**
4075
4076| Name    | Type                   | Mandatory| Description                      |
4077| -------- | ---------------- | ---- | ------------------------ |
4078| 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.|
4079| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
4080
4081**Example**
4082
4083```ts
4084import { BusinessError } from '@kit.BasicServicesKit';
4085
4086function callback(err: BusinessError, focusState: camera.FocusState): void {
4087  if (err !== undefined && err.code !== 0) {
4088    console.error(`Callback Error, errorCode: ${err.code}`);
4089    return;
4090  }
4091  console.info(`Focus state: ${focusState}`);
4092}
4093
4094function registerFocusStateChange(portraitPhotoSession: camera.PortraitPhotoSession): void {
4095  portraitPhotoSession.on('focusStateChange', callback);
4096}
4097```
4098
4099### off('focusStateChange')<sup>11+</sup>
4100
4101off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4102
4103Unsubscribes from focus state change events.
4104
4105**System API**: This is a system API.
4106
4107**System capability**: SystemCapability.Multimedia.Camera.Core
4108
4109**Parameters**
4110
4111| Name    | Type                                     | Mandatory| Description                      |
4112| -------- | ----------------------------------------- | ---- | ------------------------ |
4113| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
4114| 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.) |
4115
4116**Example**
4117
4118```ts
4119function unregisterFocusStateChange(portraitPhotoSession: camera.PortraitPhotoSession): void {
4120  portraitPhotoSession.off('focusStateChange');
4121}
4122```
4123
4124### on('smoothZoomInfoAvailable')<sup>11+</sup>
4125
4126on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
4127
4128Subscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
4129
4130**System API**: This is a system API.
4131
4132**System capability**: SystemCapability.Multimedia.Camera.Core
4133
4134**Parameters**
4135
4136| Name    | Type                  | Mandatory| Description                      |
4137| -------- | ----------------------- | ---- | ------------------------ |
4138| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
4139| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
4140
4141**Example**
4142
4143```ts
4144import { BusinessError } from '@kit.BasicServicesKit';
4145
4146function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
4147  if (err !== undefined && err.code !== 0) {
4148    console.error(`Callback Error, errorCode: ${err.code}`);
4149    return;
4150  }
4151  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
4152}
4153
4154function registerSmoothZoomInfo(portraitPhotoSession: camera.PortraitPhotoSession): void {
4155  portraitPhotoSession.on('smoothZoomInfoAvailable', callback);
4156}
4157```
4158
4159### off('smoothZoomInfoAvailable')<sup>11+</sup>
4160
4161off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
4162
4163Unsubscribes from smooth zoom state change events.
4164
4165**System API**: This is a system API.
4166
4167**System capability**: SystemCapability.Multimedia.Camera.Core
4168
4169**Parameters**
4170
4171| Name    | Type                                     | Mandatory| Description                      |
4172| -------- | ----------------------------------------- | ---- | ------------------------ |
4173| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
4174| 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.) |
4175
4176**Example**
4177
4178```ts
4179function unregisterSmoothZoomInfo(portraitPhotoSession: camera.PortraitPhotoSession): void {
4180  portraitPhotoSession.off('smoothZoomInfoAvailable');
4181}
4182```
4183
4184### on('lcdFlashStatus')<sup>13+</sup>
4185
4186on(type: 'lcdFlashStatus', callback: AsyncCallback\<LcdFlashStatus\>): void
4187
4188Subscribes to LCD flash status change events. This API uses an asynchronous callback to return the result.
4189
4190**System API**: This is a system API.
4191
4192**System capability**: SystemCapability.Multimedia.Camera.Core
4193
4194**Parameters**
4195
4196| Name    | Type                                     | Mandatory| Description                                      |
4197| -------- | ----------------------------------------- | ---- |------------------------------------------|
4198| type     | string      | Yes  | Event type. The value is fixed at **'lcdFlashStatus'**. The event can be listened for when a session is created.|
4199| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>     | Yes  | Callback used to return the LCD flash status change.                 |
4200
4201**Error codes**
4202
4203For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4204
4205| ID| Error Message                     |
4206|-------|---------------------------|
4207| 202   | Not System Application.   |
4208
4209**Example**
4210
4211```ts
4212import { BusinessError } from '@kit.BasicServicesKit';
4213
4214function callback(err: BusinessError, lcdFlashStatus: camera.LcdFlashStatus): void {
4215  if (err !== undefined && err.code !== 0) {
4216    console.error(`Callback Error, errorCode: ${err.code}`);
4217    return;
4218  }
4219  console.info(`isLcdFlashNeeded: ${lcdFlashStatus.isLcdFlashNeeded}`);
4220  console.info(`lcdCompensation: ${lcdFlashStatus.lcdCompensation}`);
4221}
4222
4223function registerLcdFlashStatus(portraitPhotoSession: camera.PortraitPhotoSession): void {
4224  portraitPhotoSession.on('lcdFlashStatus', callback);
4225}
4226```
4227
4228### off('lcdFlashStatus')<sup>13+</sup>
4229
4230off(type: 'lcdFlashStatus', callback?: AsyncCallback\<LcdFlashStatus\>): void
4231
4232Unsubscribes from LCD flash status change events.
4233
4234**System API**: This is a system API.
4235
4236**System capability**: SystemCapability.Multimedia.Camera.Core
4237
4238**Parameters**
4239
4240| Name   | Type                    | Mandatory| Description                                                              |
4241| -------- | ------------------------ | ---- |------------------------------------------------------------------|
4242| type     | string                   | Yes  | Event type. The value is fixed at **'lcdFlashStatus'**. The event can be listened for when a session is created.                      |
4243| 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.)|
4244
4245**Error codes**
4246
4247For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4248
4249| ID| Error Message                     |
4250|-------|---------------------------|
4251| 202   | Not System Application.   |
4252
4253**Example**
4254
4255```ts
4256function unregisterLcdFlashStatus(portraitPhotoSession: camera.PortraitPhotoSession): void {
4257  portraitPhotoSession.off('lcdFlashStatus');
4258}
4259```
4260
4261## NightPhotoSession<sup>11+</sup>
4262
4263NightPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ColorManagement, ManualExposure
4264
4265Implements 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).
4266
4267### on('error')<sup>11+</sup>
4268
4269on(type: 'error', callback: ErrorCallback): void
4270
4271Subscribes to **NightSession** error events. This API uses an asynchronous callback to return the result.
4272
4273**System API**: This is a system API.
4274
4275**System capability**: SystemCapability.Multimedia.Camera.Core
4276
4277**Parameters**
4278
4279| Name    | Type                                                         | Mandatory| Description                          |
4280| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
4281| 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).|
4282| 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).|
4283
4284**Example**
4285
4286```ts
4287import { BusinessError } from '@kit.BasicServicesKit';
4288
4289function callback(err: BusinessError): void {
4290  console.error(`Night photo session error code: ${err.code}`);
4291}
4292
4293function registerSessionError(nightPhotoSession: camera.NightPhotoSession): void {
4294  nightPhotoSession.on('error', callback);
4295}
4296```
4297
4298### off('error')<sup>11+</sup>
4299
4300off(type: 'error', callback?: ErrorCallback): void
4301
4302Unsubscribes from **NightSession** error events.
4303
4304**System API**: This is a system API.
4305
4306**System capability**: SystemCapability.Multimedia.Camera.Core
4307
4308**Parameters**
4309
4310| Name    | Type                       | Mandatory| Description                          |
4311| -------- | ------------------------ | ---- | ------------------------------ |
4312| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
4313| 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.)      |
4314
4315**Example**
4316
4317```ts
4318function unregisterSessionError(nightPhotoSession: camera.NightPhotoSession): void {
4319  nightPhotoSession.off('error');
4320}
4321```
4322
4323### on('focusStateChange')<sup>11+</sup>
4324
4325on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4326
4327Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
4328
4329**System API**: This is a system API.
4330
4331**System capability**: SystemCapability.Multimedia.Camera.Core
4332
4333**Parameters**
4334
4335| Name    | Type                   | Mandatory| Description                      |
4336| -------- | ---------------- | ---- | ------------------------ |
4337| 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.|
4338| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
4339
4340**Example**
4341
4342```ts
4343import { BusinessError } from '@kit.BasicServicesKit';
4344
4345function callback(err: BusinessError, focusState: camera.FocusState): void {
4346  if (err !== undefined && err.code !== 0) {
4347    console.error(`Callback Error, errorCode: ${err.code}`);
4348    return;
4349  }
4350  console.info(`Focus state: ${focusState}`);
4351}
4352
4353function registerFocusStateChange(nightPhotoSession: camera.NightPhotoSession): void {
4354  nightPhotoSession.on('focusStateChange', callback);
4355}
4356```
4357
4358### off('focusStateChange')<sup>11+</sup>
4359
4360off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4361
4362Unsubscribes from focus state change events.
4363
4364**System API**: This is a system API.
4365
4366**System capability**: SystemCapability.Multimedia.Camera.Core
4367
4368**Parameters**
4369
4370| Name    | Type                                     | Mandatory| Description                      |
4371| -------- | ----------------------------------------- | ---- | ------------------------ |
4372| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
4373| 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.) |
4374
4375**Example**
4376
4377```ts
4378function unregisterFocusStateChange(nightPhotoSession: camera.NightPhotoSession): void {
4379  nightPhotoSession.off('focusStateChange');
4380}
4381```
4382
4383### on('smoothZoomInfoAvailable')<sup>11+</sup>
4384
4385on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
4386
4387Subscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
4388
4389**System API**: This is a system API.
4390
4391**System capability**: SystemCapability.Multimedia.Camera.Core
4392
4393**Parameters**
4394
4395| Name    | Type                  | Mandatory| Description                      |
4396| -------- | ----------------------- | ---- | ------------------------ |
4397| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
4398| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
4399
4400**Example**
4401
4402```ts
4403import { BusinessError } from '@kit.BasicServicesKit';
4404
4405function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
4406  if (err !== undefined && err.code !== 0) {
4407    console.error(`Callback Error, errorCode: ${err.code}`);
4408    return;
4409  }
4410  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
4411}
4412
4413function registerSmoothZoomInfo(nightPhotoSession: camera.NightPhotoSession): void {
4414  nightPhotoSession.on('smoothZoomInfoAvailable', callback);
4415}
4416```
4417
4418### off('smoothZoomInfoAvailable')<sup>11+</sup>
4419
4420off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
4421
4422Unsubscribes from smooth zoom state change events.
4423
4424**System API**: This is a system API.
4425
4426**System capability**: SystemCapability.Multimedia.Camera.Core
4427
4428**Parameters**
4429
4430| Name    | Type                                     | Mandatory| Description                      |
4431| -------- | ----------------------------------------- | ---- | ------------------------ |
4432| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
4433| 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.) |
4434
4435**Example**
4436
4437```ts
4438function unregisterSmoothZoomInfo(nightPhotoSession: camera.NightPhotoSession): void {
4439  nightPhotoSession.off('smoothZoomInfoAvailable');
4440}
4441```
4442
4443### on('lcdFlashStatus')<sup>12+</sup>
4444
4445on(type: 'lcdFlashStatus', callback: AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>): void
4446
4447Subscribes to LCD flash status change events. This API uses an asynchronous callback to return the result.
4448
4449**System API**: This is a system API.
4450
4451**System capability**: SystemCapability.Multimedia.Camera.Core
4452
4453**Parameters**
4454
4455| Name    | Type                  | Mandatory| Description                      |
4456| -------- | ----------------------- | ---- | ------------------------ |
4457| type     | string                  | Yes  | Event type. The value is fixed at **'lcdFlashStatus'**. The event can be listened for when a session is created.|
4458| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\> | Yes  | Callback used to return the LCD flash status change. |
4459
4460**Error codes**
4461
4462For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4463
4464| ID| Error Message                     |
4465|-------|---------------------------|
4466| 202   | Not System Application.   |
4467
4468**Example**
4469
4470```ts
4471import { BusinessError } from '@kit.BasicServicesKit';
4472
4473function callback(err: BusinessError, lcdFlashStatus: camera.LcdFlashStatus): void {
4474  if (err !== undefined && err.code !== 0) {
4475    console.error(`Callback Error, errorCode: ${err.code}`);
4476    return;
4477  }
4478  console.info(`lcdFlashStatus: ${lcdFlashStatus}`);
4479}
4480
4481function registerLcdFlashStatus(nightPhotoSession: camera.NightPhotoSession): void {
4482  nightPhotoSession.on('lcdFlashStatus', callback);
4483}
4484```
4485
4486### off('lcdFlashStatus')<sup>12+</sup>
4487
4488off(type: 'lcdFlashStatus', callback?: AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>): void
4489
4490Unsubscribes from LCD flash status change events.
4491
4492**System API**: This is a system API.
4493
4494**System capability**: SystemCapability.Multimedia.Camera.Core
4495
4496**Parameters**
4497
4498| Name    | Type                                     | Mandatory| Description                      |
4499| -------- | ----------------------------------------- | ---- | ------------------------ |
4500| type     | string              | Yes  | Event type. The value is fixed at **'lcdFlashStatus'**. The event can be listened for when a session is created.|
4501| 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.) |
4502
4503**Error codes**
4504
4505For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4506
4507| ID| Error Message                     |
4508|-------|---------------------------|
4509| 202   | Not System Application.   |
4510
4511**Example**
4512
4513```ts
4514function unregisterLcdFlashStatus(nightPhotoSession: camera.NightPhotoSession): void {
4515  nightPhotoSession.off('lcdFlashStatus');
4516}
4517```
4518
4519## HighResolutionPhotoSession<sup>12+</sup>
4520
4521HighResolutionPhotoSession extends Session, AutoExposure, Focus
4522
4523Implements 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).
4524
4525### on('error')<sup>12+</sup>
4526
4527on(type: 'error', callback: ErrorCallback): void
4528
4529Subscribes to **HighResolutionPhotoSession** error events. This API uses an asynchronous callback to return the result.
4530
4531**System API**: This is a system API.
4532
4533**System capability**: SystemCapability.Multimedia.Camera.Core
4534
4535**Parameters**
4536
4537| Name    | Type       | Mandatory| Description                          |
4538| -------- | --------------------------------- | ---- | ------------------------------ |
4539| 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).|
4540| 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).       |
4541
4542**Error codes**
4543
4544For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4545
4546| ID        | Error Message       |
4547| --------------- | --------------- |
4548| 202                |   Not System Application.               |
4549
4550**Example**
4551
4552```ts
4553import { BusinessError } from '@kit.BasicServicesKit';
4554
4555function callback(err: BusinessError): void {
4556  console.error(`High resolution photo session error code: ${err.code}`);
4557}
4558
4559function registerSessionError(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4560  highResolutionPhotoSession.on('error', callback);
4561}
4562```
4563### off('error')<sup>12+</sup>
4564
4565off(type: 'error', callback?: ErrorCallback): void
4566
4567Unsubscribes from **HighResolutionPhotoSession** error events.
4568
4569**System API**: This is a system API.
4570
4571**System capability**: SystemCapability.Multimedia.Camera.Core
4572
4573**Parameters**
4574
4575| Name    | Type                       | Mandatory| Description                          |
4576| -------- | ------------------------ | ---- | ------------------------------ |
4577| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
4578| 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.)      |
4579
4580**Error codes**
4581
4582For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4583
4584| ID        | Error Message       |
4585| --------------- | --------------- |
4586| 202                |   Not System Application.               |
4587
4588**Example**
4589
4590```ts
4591function unregisterSessionError(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4592  highResolutionPhotoSession.off('error');
4593}
4594```
4595
4596### on('focusStateChange')<sup>12+</sup>
4597
4598on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4599
4600Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
4601
4602**System API**: This is a system API.
4603
4604**System capability**: SystemCapability.Multimedia.Camera.Core
4605
4606**Parameters**
4607
4608| Name    | Type                   | Mandatory| Description                      |
4609| -------- | ---------------- | ---- | ------------------------ |
4610| 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.|
4611| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
4612
4613**Error codes**
4614
4615For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4616
4617| ID        | Error Message       |
4618| --------------- | --------------- |
4619| 202                |   Not System Application.               |
4620
4621**Example**
4622
4623```ts
4624import { BusinessError } from '@kit.BasicServicesKit';
4625
4626function callback(err: BusinessError, focusState: camera.FocusState): void {
4627  if (err !== undefined && err.code !== 0) {
4628    console.error(`Callback Error, errorCode: ${err.code}`);
4629    return;
4630  }
4631  console.info(`Focus state: ${focusState}`);
4632}
4633
4634function registerFocusStateChange(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4635  highResolutionPhotoSession.on('focusStateChange', callback);
4636}
4637```
4638
4639### off('focusStateChange')<sup>12+</sup>
4640
4641off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4642
4643Unsubscribes from focus state change events.
4644
4645**System API**: This is a system API.
4646
4647**System capability**: SystemCapability.Multimedia.Camera.Core
4648
4649**Error codes**
4650
4651For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4652
4653| ID        | Error Message       |
4654| --------------- | --------------- |
4655| 202                |   Not System Application.               |
4656
4657**Parameters**
4658
4659| Name    | Type                                     | Mandatory| Description                      |
4660| -------- | ----------------------------------------- | ---- | ------------------------ |
4661| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
4662| 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.) |
4663
4664**Example**
4665
4666```ts
4667function unregisterFocusStateChange(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4668  highResolutionPhotoSession.off('focusStateChange');
4669}
4670```
4671
4672## SketchStatusData<sup>11+</sup>
4673
4674Defines the PiP status data.
4675
4676**System API**: This is a system API.
4677
4678**System capability**: SystemCapability.Multimedia.Camera.Core
4679
4680| Name         | Type     | Read-only| Mandatory| Description       |
4681| ------------- | -------- | ---- | ---- | ---------- |
4682| status        | number   | No  | Yes  | Status of PiP. The options are 0 (stopped), 1 (started), 2 (stopping), and 3 (starting).|
4683| sketchRatio   | number   | No  | Yes  | Zoom ratio of PiP.|
4684
4685## SlowMotionVideoSession<sup>12+</sup>
4686
4687SlowMotionVideoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect
4688
4689Implements 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).
4690
4691> **NOTE**
4692>
4693> In slow-motion video mode, only preview streams and video streams can be added.
4694### on('error')<sup>12+</sup>
4695
4696on(type: 'error', callback: ErrorCallback): void
4697
4698Subscribes to **SlowMotionVideoSession** error events. This API uses an asynchronous callback to return the result.
4699
4700**System API**: This is a system API.
4701
4702**System capability**: SystemCapability.Multimedia.Camera.Core
4703
4704**Parameters**
4705
4706| Name    | Type       | Mandatory| Description                          |
4707| -------- | --------------------------------- | ---- | ------------------------------ |
4708| 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).|
4709| 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).       |
4710
4711**Error codes**
4712
4713For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4714
4715| ID  | Error Message       |
4716|---------| --------------- |
4717| 202     |  Not System Application. |
4718
4719**Example**
4720
4721```ts
4722import { BusinessError } from '@kit.BasicServicesKit';
4723
4724function callback(err: BusinessError): void {
4725  console.error(`Portrait photo session error code: ${err.code}`);
4726}
4727
4728function registerSessionError(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4729  slowMotionVideoSession.on('error', callback);
4730}
4731```
4732
4733### off('error')<sup>12+</sup>
4734
4735off(type: 'error', callback?: ErrorCallback): void
4736
4737Unsubscribes from **SlowMotionVideoSession** error events.
4738
4739**System API**: This is a system API.
4740
4741**System capability**: SystemCapability.Multimedia.Camera.Core
4742
4743**Parameters**
4744
4745| Name    | Type       | Mandatory| Description                          |
4746| -------- | -------------------------- | ---- | ------------------------------ |
4747| type     | string                     | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
4748| 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.)   |
4749
4750**Error codes**
4751
4752For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4753
4754| ID  | Error Message       |
4755|---------| --------------- |
4756| 202     |  Not System Application. |
4757
4758**Example**
4759
4760```ts
4761function unregisterSessionError(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4762  slowMotionVideoSession.off('error');
4763}
4764```
4765
4766### on('focusStateChange')<sup>12+</sup>
4767
4768on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4769
4770Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
4771
4772**System API**: This is a system API.
4773
4774**System capability**: SystemCapability.Multimedia.Camera.Core
4775
4776**Parameters**
4777
4778| Name    | Type                   | Mandatory| Description                      |
4779| -------- | ---------------- | ---- | ------------------------ |
4780| 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.|
4781| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
4782
4783**Error codes**
4784
4785For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4786
4787| ID  | Error Message       |
4788|---------| --------------- |
4789| 202     |  Not System Application. |
4790
4791**Example**
4792
4793```ts
4794import { BusinessError } from '@kit.BasicServicesKit';
4795
4796function callback(err: BusinessError, focusState: camera.FocusState): void {
4797  if (err !== undefined && err.code !== 0) {
4798    console.error(`Callback Error, errorCode: ${err.code}`);
4799    return;
4800  }
4801  console.info(`Focus state: ${focusState}`);
4802}
4803
4804function registerFocusStateChange(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4805  slowMotionVideoSession.on('focusStateChange', callback);
4806}
4807```
4808
4809### off('focusStateChange')<sup>12+</sup>
4810
4811off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4812
4813Unsubscribes from focus state change events.
4814
4815**System API**: This is a system API.
4816
4817**System capability**: SystemCapability.Multimedia.Camera.Core
4818
4819**Parameters**
4820
4821| Name    | Type                                     | Mandatory| Description                      |
4822| -------- | ----------------------------------------- | ---- | ------------------------ |
4823| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
4824| 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.) |
4825
4826**Error codes**
4827
4828For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4829
4830| ID  | Error Message       |
4831|---------| --------------- |
4832| 202     |  Not System Application. |
4833
4834**Example**
4835
4836```ts
4837function unregisterFocusStateChange(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4838  slowMotionVideoSession.off('focusStateChange');
4839}
4840```
4841
4842### on('smoothZoomInfoAvailable')<sup>12+</sup>
4843
4844on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
4845
4846Subscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
4847
4848**System API**: This is a system API.
4849
4850**System capability**: SystemCapability.Multimedia.Camera.Core
4851
4852**Parameters**
4853
4854| Name    | Type                  | Mandatory| Description                      |
4855| -------- | ----------------------- | ---- | ------------------------ |
4856| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
4857| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
4858
4859**Error codes**
4860
4861For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4862
4863| ID  | Error Message       |
4864|---------| --------------- |
4865| 202     |  Not System Application. |
4866
4867**Example**
4868
4869```ts
4870import { BusinessError } from '@kit.BasicServicesKit';
4871
4872function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
4873  if (err !== undefined && err.code !== 0) {
4874    console.error(`Callback Error, errorCode: ${err.code}`);
4875    return;
4876  }
4877  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
4878}
4879
4880function registerSmoothZoomInfo(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4881  slowMotionVideoSession.on('smoothZoomInfoAvailable', callback);
4882}
4883```
4884
4885### off('smoothZoomInfoAvailable')<sup>12+</sup>
4886
4887off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
4888
4889Unsubscribes from smooth zoom state change events.
4890
4891**System API**: This is a system API.
4892
4893**System capability**: SystemCapability.Multimedia.Camera.Core
4894
4895**Parameters**
4896
4897| Name    | Type                                     | Mandatory| Description                      |
4898| -------- | ----------------------------------------- | ---- | ------------------------ |
4899| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
4900| 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.) |
4901
4902**Error codes**
4903
4904For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4905
4906| ID  | Error Message       |
4907|---------| --------------- |
4908| 202     |  Not System Application. |
4909
4910**Example**
4911
4912```ts
4913function unregisterSmoothZoomInfo(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4914  slowMotionVideoSession.off('smoothZoomInfoAvailable');
4915}
4916```
4917
4918### on('slowMotionStatus')<sup>12+</sup>
4919
4920on(type: 'slowMotionStatus', callback: AsyncCallback\<SlowMotionStatus\>): void
4921
4922Subscribes to slow-motion status change events. This API uses an asynchronous callback to return the result.
4923
4924**System API**: This is a system API.
4925
4926**System capability**: SystemCapability.Multimedia.Camera.Core
4927
4928**Parameters**
4929
4930| Name    | Type                                                                       | Mandatory| Description                                        |
4931| -------- |---------------------------------------------------------------------------| ---- |--------------------------------------------|
4932| type     | string                                                                    | Yes  | Event type. The value is fixed at **'slowMotionStatus'**. The event can be listened for when a session is created.|
4933| callback | AsyncCallback\<[SlowMotionStatus](#slowmotionstatus12)\> | Yes  | Callback used to return the slow-motion status change.    |
4934
4935**Error codes**
4936
4937For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4938
4939| ID  | Error Message       |
4940|---------| --------------- |
4941| 202     |  Not System Application. |
4942
4943**Example**
4944
4945```ts
4946import { BusinessError } from '@kit.BasicServicesKit';
4947
4948function callback(err: BusinessError, slowMotionStatus: camera.SlowMotionStatus): void {
4949  if (err !== undefined && err.code !== 0) {
4950    console.error(`Callback Error, errorCode: ${err.code}`);
4951    return;
4952  }
4953  console.info(`The slow motion status: ${slowMotionStatus}`);
4954}
4955
4956function registerSlowMotionStatus(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4957  slowMotionVideoSession.on('slowMotionStatus', callback);
4958}
4959```
4960
4961### off('slowMotionStatus')<sup>12+</sup>
4962
4963off(type: 'slowMotionStatus', callback?: AsyncCallback\<SlowMotionStatus\>): void
4964
4965Unsubscribes from slow-motion status change events.
4966
4967**System API**: This is a system API.
4968
4969**System capability**: SystemCapability.Multimedia.Camera.Core
4970
4971**Parameters**
4972
4973| Name    | Type                                     | Mandatory| Description                      |
4974| -------- | ----------------------------------------- | ---- | ------------------------ |
4975| type     | string              | Yes  | Event type. The value is fixed at **'slowMotionStatus'**. The event can be listened for when a session is created.|
4976| 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. |
4977
4978**Error codes**
4979
4980For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
4981
4982| ID  | Error Message       |
4983|---------| --------------- |
4984| 202     |  Not System Application.                               |
4985
4986**Example**
4987
4988```ts
4989function unregisterSlowMotionStatus(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4990  slowMotionVideoSession.off('slowMotionStatus');
4991}
4992```
4993### isSlowMotionDetectionSupported<sup>12+</sup>
4994
4995isSlowMotionDetectionSupported(): boolean
4996
4997Checks whether the device supports slow-motion detection.
4998
4999> **NOTE**
5000>
5001> This API must be called after [commitConfig](js-apis-camera.md#commitconfig11-1) is called.
5002
5003**System API**: This is a system API.
5004
5005**System capability**: SystemCapability.Multimedia.Camera.Core
5006
5007**Return value**
5008
5009| Type       | Description                                                                                    |
5010| ---------- |----------------------------------------------------------------------------------------|
5011| boolean    | Check result. The value **true** means that the device supports slow-motion detection, and **false** means the opposite. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5012
5013**Error codes**
5014
5015For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5016
5017| ID  | Error Message       |
5018|---------| --------------- |
5019| 202     |  Not System Application.                               |
5020| 7400103 |  Session not config.                                   |
5021
5022**Example**
5023
5024```ts
5025import { BusinessError } from '@kit.BasicServicesKit';
5026
5027function isSlowMotionDetectionSupported(slowMotionVideoSession: camera.SlowMotionVideoSession): boolean {
5028  let isSupported: boolean = false;
5029  try {
5030    isSupported = slowMotionVideoSession.isSlowMotionDetectionSupported();
5031  } catch (error) {
5032    // If the operation fails, error.code is returned and processed.
5033    let err = error as BusinessError;
5034    console.error(`The isFocusModeSupported call failed. error code: ${err.code}`);
5035  }
5036  return isSupported;
5037}
5038```
5039
5040### setSlowMotionDetectionArea<sup>12+</sup>
5041
5042setSlowMotionDetectionArea(area: Rect): void
5043
5044Sets an area for slow-motion detection.
5045
5046> **NOTE**
5047>
5048> Before the setting, call [isSlowMotionDetectionSupported](#isslowmotiondetectionsupported12) to check whether the device supports slow-motion detection.
5049This API must be called after [commitConfig](js-apis-camera.md#commitconfig11-1) is called.
5050
5051**System API**: This is a system API.
5052
5053**System capability**: SystemCapability.Multimedia.Camera.Core
5054
5055**Parameters**
5056
5057| Name    | Type                                           | Mandatory| Description                         |
5058| -------- | ---------------------------------------------- | ---- | --------------------------- |
5059| area  | [Rect](js-apis-camera.md#rect)      | Yes  | Area.                  |
5060
5061**Error codes**
5062
5063For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5064
5065| ID  | Error Message       |
5066|---------| --------------- |
5067| 202     |  Not System Application.                            |
5068| 7400101 |  Parameter missing or parameter type incorrect.     |
5069| 7400103 |  Session not config.                                |
5070
5071**Example**
5072
5073```ts
5074import { BusinessError } from '@kit.BasicServicesKit';
5075
5076function setSlowMotionDetectionArea(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
5077  try {
5078    slowMotionVideoSession.setSlowMotionDetectionArea({topLeftX: 0.1, topLeftY: 0.1, width: 0.8, height: 0.8});
5079  } catch (error) {
5080    // If the operation fails, error.code is returned and processed.
5081    let err = error as BusinessError;
5082    console.error(`The setSlowMotionDetectionArea call failed. error code: ${err.code}`);
5083  }
5084}
5085```
5086
5087## PanoramaPhotoSession<sup>12+</sup>
5088
5089PanoramaPhotoSession extends Session, Focus, AutoExposure, WhiteBalance, ColorEffect
5090
5091Implements 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).
5092
5093### on('error')<sup>12+</sup>
5094
5095on(type: 'error', callback: ErrorCallback): void
5096
5097Subscribes to **PanoramaPhotoSession** error events. This API uses an asynchronous callback to return the result.
5098
5099**System API**: This is a system API.
5100
5101**System capability**: SystemCapability.Multimedia.Camera.Core
5102
5103**Parameters**
5104
5105| Name    | Type                                                         | Mandatory| Description                          |
5106| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
5107| 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).|
5108| 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).|
5109
5110**Example**
5111
5112```ts
5113import { BusinessError } from '@kit.BasicServicesKit';
5114
5115function callback(err: BusinessError): void {
5116  console.error(`Panorama photo session error code: ${err.code}`);
5117}
5118
5119function registerSessionError(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
5120  panoramaPhotoSession.on('error', callback);
5121}
5122```
5123
5124### off('error')<sup>12+</sup>
5125
5126off(type: 'error', callback?: ErrorCallback): void
5127
5128Unsubscribes from **PanoramaPhotoSession** error events.
5129
5130**System API**: This is a system API.
5131
5132**System capability**: SystemCapability.Multimedia.Camera.Core
5133
5134**Parameters**
5135
5136| Name    | Type                       | Mandatory| Description                          |
5137| -------- | ------------------------ | ---- | ------------------------------ |
5138| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
5139| 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.)      |
5140
5141**Example**
5142
5143```ts
5144function unregisterSessionError(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
5145  panoramaPhotoSession.off('error');
5146}
5147```
5148
5149### on('focusStateChange')<sup>12+</sup>
5150
5151on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
5152
5153Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
5154
5155**System API**: This is a system API.
5156
5157**System capability**: SystemCapability.Multimedia.Camera.Core
5158
5159**Parameters**
5160
5161| Name    | Type                   | Mandatory| Description                      |
5162| -------- | ---------------- | ---- | ------------------------ |
5163| 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.|
5164| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
5165
5166**Example**
5167
5168```ts
5169import { BusinessError } from '@kit.BasicServicesKit';
5170
5171function callback(err: BusinessError, focusState: camera.FocusState): void {
5172  if (err !== undefined && err.code !== 0) {
5173    console.error(`Callback Error, errorCode: ${err.code}`);
5174    return;
5175  }
5176  console.info(`Focus state: ${focusState}`);
5177}
5178
5179function registerFocusStateChange(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
5180  panoramaPhotoSession.on('focusStateChange', callback);
5181}
5182```
5183
5184### off('focusStateChange')<sup>12+</sup>
5185
5186off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
5187
5188Unsubscribes from focus state change events.
5189
5190**System API**: This is a system API.
5191
5192**System capability**: SystemCapability.Multimedia.Camera.Core
5193
5194**Parameters**
5195
5196| Name    | Type                                     | Mandatory| Description                      |
5197| -------- | ----------------------------------------- | ---- | ------------------------ |
5198| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
5199| 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.) |
5200
5201**Example**
5202
5203```ts
5204function unregisterFocusStateChange(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
5205  panoramaPhotoSession.off('focusStateChange');
5206}
5207```
5208
5209## IsoInfo<sup>12+</sup>
5210
5211Describes the ISO information.
5212
5213**System API**: This is a system API.
5214
5215**System capability**: SystemCapability.Multimedia.Camera.Core
5216
5217| Name| Type   | Read-only| Optional| Description          |
5218| ---- | ------- | ---- |--| -------------- |
5219| iso  | number  | Yes  | Yes| ISO.       |
5220
5221---
5222
5223## ExposureInfo<sup>12+</sup>
5224
5225Describes the exposure information.
5226
5227**System API**: This is a system API.
5228
5229**System capability**: SystemCapability.Multimedia.Camera.Core
5230
5231| Name             | Type   | Read-only| Optional | Description              |
5232| ----------------- | ------- | ---- |-----| ------------------ |
5233| exposureTime | number  | Yes  | Yes  | Exposure time, in ms.|
5234
5235---
5236
5237## ApertureInfo<sup>12+</sup>
5238
5239Describes the aperture information.
5240
5241**System API**: This is a system API.
5242
5243**System capability**: SystemCapability.Multimedia.Camera.Core
5244
5245| Name     | Type   | Read-only| Optional | Description      |
5246| --------- | ------- | ---- |-----| ---------- |
5247| aperture  | number  | Yes  | Yes  | Aperture.  |
5248
5249---
5250
5251## LuminationInfo<sup>12+</sup>
5252
5253Describes the illumination information.
5254
5255**System API**: This is a system API.
5256
5257**System capability**: SystemCapability.Multimedia.Camera.Core
5258
5259| Name       | Type   | Read-only| Optional | Description      |
5260| ----------- | ------- | ---- |-----| ---------- |
5261| lumination  | number  | Yes  | Yes  | Illumination. The value range is [0,1].|
5262
5263## CameraFormat
5264
5265Enumerates the camera output formats.
5266
5267**System capability**: SystemCapability.Multimedia.Camera.Core
5268
5269| Name                    | Value       | Description        |
5270| ----------------------- | --------- | ------------ |
5271| CAMERA_FORMAT_DNG<sup>12+</sup>  | 4         | Raw image in DNG format. **System API**: This is a system API.        |
5272
5273## ExposureMeteringMode<sup>12+</sup>
5274
5275Enumerates the exposure metering modes.
5276
5277**System API**: This is a system API.
5278
5279**System capability**: SystemCapability.Multimedia.Camera.Core
5280
5281| Name                          | Value  | Description        |
5282| ----------------------------- | ---- | ----------- |
5283| MATRIX          | 0    | Performs metering on a wide area of the image.|
5284| CENTER          | 1    | Performs metering on the entire image, with the center allocated with the maximum weight.|
5285| SPOT            | 2    | Performs metering around 2.5% of the metering points.|
5286
5287## AutoExposureQuery<sup>12+</sup>
5288
5289Provides APIs to check whether a device supports an exposure mode or exposure metering mode and obtain the exposure compensation range.
5290
5291### isExposureMeteringModeSupported<sup>12+</sup>
5292
5293isExposureMeteringModeSupported(aeMeteringMode: ExposureMeteringMode): boolean
5294
5295Checks whether an exposure metering mode is supported.
5296
5297**System API**: This is a system API.
5298
5299**System capability**: SystemCapability.Multimedia.Camera.Core
5300
5301**Parameters**
5302
5303| Name     | Type                          | Mandatory | Description                          |
5304| -------- | -------------------------------| ---- | ----------------------------- |
5305| aeMeteringMode   | [ExposureMeteringMode](#exposuremeteringmode12)  | Yes  | Metering mode.                     |
5306
5307**Return value**
5308
5309| Type       | Description                         |
5310| ---------- | ----------------------------- |
5311| boolean    | Check result. The value **true** means that the exposure metering mode is supported, and **false** means the opposite. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5312
5313**Error codes**
5314
5315For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5316
5317| ID        | Error Message       |
5318| --------------- | --------------- |
5319| 202     | Not System Application. |
5320| 7400101                |  Parameter missing or parameter type incorrect.                                   |
5321| 7400103                |  Session not config.                                   |
5322
5323
5324**Example**
5325
5326```ts
5327import { BusinessError } from '@kit.BasicServicesKit';
5328
5329function isExposureMeteringModeSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5330  let isSupported: boolean = false;
5331  try {
5332    isSupported = professionalPhotoSession.isExposureModeSupported(camera.ExposureMeteringMode.CENTER);
5333  } catch (error) {
5334    // If the operation fails, error.code is returned and processed.
5335    let err = error as BusinessError;
5336    console.error(`The isExposureMeteringModeSupported call failed. error code: ${err.code}`);
5337  }
5338  return isSupported;
5339}
5340```
5341
5342## AutoExposure
5343
5344AutoExposure extends [AutoExposureQuery](#autoexposurequery12)
5345
5346Provides 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.
5347
5348### getExposureMeteringMode<sup>12+</sup>
5349
5350getExposureMeteringMode(): ExposureMeteringMode
5351
5352Obtains the exposure metering mode in use.
5353
5354**System API**: This is a system API.
5355
5356**System capability**: SystemCapability.Multimedia.Camera.Core
5357
5358**Return value**
5359
5360| Type       | Description                         |
5361| ---------- | ----------------------------- |
5362| [ExposureMeteringMode](#exposuremeteringmode12)    | Exposure metering mode obtained. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5363
5364**Error codes**
5365
5366For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5367
5368| ID        | Error Message       |
5369| --------------- | --------------- |
5370| 7400103                |  Session not config.                                   |
5371| 202     | Not System Application. |
5372
5373**Example**
5374
5375```ts
5376import { BusinessError } from '@kit.BasicServicesKit';
5377
5378function getExposureMeteringMode(professionalPhotoSession: camera.ProfessionalPhotoSession): camera.ExposureMeteringMode | undefined {
5379  let exposureMeteringMode: camera.ExposureMeteringMode | undefined = undefined;
5380  try {
5381    exposureMeteringMode = professionalPhotoSession.getExposureMeteringMode();
5382  } catch (error) {
5383    // If the operation fails, error.code is returned and processed.
5384    let err = error as BusinessError;
5385    console.error(`The getExposureMeteringMode call failed. error code: ${err.code}`);
5386  }
5387  return exposureMeteringMode;
5388}
5389```
5390
5391### setExposureMeteringMode<sup>12+</sup>
5392
5393setExposureMeteringMode(aeMeteringMode: ExposureMeteringMode): void
5394
5395Sets an exposure metering mode.
5396
5397Before the setting, call [isExposureMeteringModeSupported](#isexposuremeteringmodesupported12) to check whether the target exposure metering mode is supported.
5398
5399**System API**: This is a system API.
5400
5401**System capability**: SystemCapability.Multimedia.Camera.Core
5402
5403**Parameters**
5404
5405| Name     | Type                           | Mandatory| Description                   |
5406| -------- | -------------------------------| ---- | ----------------------- |
5407| aeMeteringMode   | [ExposureMeteringMode](#exposuremeteringmode12)  | Yes  | Metering mode.               |
5408
5409**Error codes**
5410
5411For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5412
5413| ID        | Error Message       |
5414| --------------- | --------------- |
5415| 202     | Not System Application. |
5416| 7400101                |  Parameter missing or parameter type incorrect.        |
5417| 7400103                |  Session not config.                                   |
5418
5419**Example**
5420
5421```ts
5422import { BusinessError } from '@kit.BasicServicesKit';
5423
5424function setExposureMeteringMode(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5425  try {
5426    professionalPhotoSession.setExposureMeteringMode(camera.ExposureMeteringMode.CENTER);
5427  } catch (error) {
5428    // If the operation fails, error.code is returned and processed.
5429    let err = error as BusinessError;
5430    console.error(`The setExposureMeteringMode call failed. error code: ${err.code}`);
5431  }
5432}
5433```
5434
5435## FocusRangeType<sup>15+</sup>
5436
5437Enumerates the focus range types.
5438
5439**System capability**: SystemCapability.Multimedia.Camera.Core
5440
5441| Name| Value  | Description      |
5442| ---- | ---- | ---------- |
5443| AUTO | 0    | Auto focus.    |
5444| NEAR | 1    | Focus on near objects.|
5445
5446## FocusDrivenType<sup>15+</sup>
5447
5448Enumerates the focus drive types.
5449
5450**System capability**: SystemCapability.Multimedia.Camera.Core
5451
5452| Name| Value  | Description      |
5453| ---- | ---- | ---------- |
5454| AUTO | 0    | Automatic.    |
5455| FACE | 1    | Face-driven.|
5456
5457## FocusQuery<sup>12+</sup>
5458
5459Provides the API to check whether the focus assist is supported.
5460
5461### isFocusAssistSupported<sup>12+</sup>
5462
5463isFocusAssistSupported(): boolean
5464
5465Checks whether the focus assist is supported.
5466
5467**System API**: This is a system API.
5468
5469**System capability**: SystemCapability.Multimedia.Camera.Core
5470
5471**Return value**
5472
5473| Type       | Description                         |
5474| ---------- | ----------------------------- |
5475| boolean    | Check result. The value **true** means that the focus assist is supported, and **false** means the opposite. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5476
5477**Error codes**
5478
5479For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5480
5481| ID        | Error Message       |
5482| --------------- | --------------- |
5483| 7400103                |  Session not config.                                   |
5484| 202     | Not System Application. |
5485
5486**Example**
5487
5488```ts
5489import { BusinessError } from '@kit.BasicServicesKit';
5490
5491function isFocusAssistSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5492  let status: boolean = false;
5493  try {
5494    status = professionalPhotoSession.isFocusAssistSupported();
5495  } catch (error) {
5496    // If the operation fails, error.code is returned and processed.
5497    let err = error as BusinessError;
5498    console.error(`The isFocusAssistSupported call failed. error code: ${err.code}`);
5499  }
5500  return status;
5501}
5502```
5503
5504### isFocusRangeTypeSupported<sup>15+</sup>
5505
5506isFocusRangeTypeSupported(type: FocusRangeType): boolean
5507
5508Checks whether a focus range type is supported.
5509
5510**System API**: This is a system API.
5511
5512**System capability**: SystemCapability.Multimedia.Camera.Core
5513
5514**Parameters**
5515
5516| Name| Type                               | Mandatory| Description                    |
5517| ------ | ----------------------------------- | ---- | ------------------------ |
5518| type   | [FocusRangeType](#focusrangetype15) | Yes  | Focus range type.|
5519
5520**Return value**
5521
5522| Type   | Description                                                        |
5523| ------- | ------------------------------------------------------------ |
5524| boolean | Check result. The value **true** means that the focus range type is supported, and **false** means the opposite. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5525
5526**Error codes**
5527
5528For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5529
5530| ID| Error Message                                                    |
5531| -------- | ------------------------------------------------------------ |
5532| 202      | Not System Application.                                      |
5533| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5534| 7400103  | Session not config.                                          |
5535
5536**Example**
5537
5538```ts
5539import { BusinessError } from '@kit.BasicServicesKit';
5540
5541function isFocusRangeTypeSupported(session: camera.VideoSessionForSys, type: camera.FocusRangeType): boolean {
5542  let status: boolean = false;
5543  try {
5544    status = session.isFocusRangeTypeSupported(type);
5545  } catch (error) {
5546    // If the operation fails, error.code is returned and processed.
5547    let err = error as BusinessError;
5548    console.error(`The isFocusRangeTypeSupported call failed. error code: ${err.code}`);
5549  }
5550  return status;
5551}
5552```
5553
5554### isFocusDrivenTypeSupported<sup>15+</sup>
5555
5556isFocusDrivenTypeSupported(type: FocusDrivenType): boolean
5557
5558Checks whether a focus drive type is supported.
5559
5560**System API**: This is a system API.
5561
5562**System capability**: SystemCapability.Multimedia.Camera.Core
5563
5564**Parameters**
5565
5566| Name| Type                                 | Mandatory| Description                    |
5567| ------ | ------------------------------------- | ---- | ------------------------ |
5568| type   | [FocusDrivenType](#focusdriventype15) | Yes  | Focus drive type.|
5569
5570**Return value**
5571
5572| Type   | Description                                                        |
5573| ------- | ------------------------------------------------------------ |
5574| boolean | Check result. The value **true** means that the focus drive type is supported, and **false** means the opposite. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5575
5576**Error codes**
5577
5578For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5579
5580| ID| Error Message                                                    |
5581| -------- | ------------------------------------------------------------ |
5582| 202      | Not System Application.                                      |
5583| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
5584| 7400103  | Session not config.                                          |
5585
5586**Example**
5587
5588```ts
5589import { BusinessError } from '@kit.BasicServicesKit';
5590
5591function isFocusDrivenTypeSupported(session: camera.VideoSessionForSys, type: camera.FocusDrivenType): boolean {
5592  let status: boolean = false;
5593  try {
5594    status = session.isFocusDrivenTypeSupported(type);
5595  } catch (error) {
5596    // If the operation fails, error.code is returned and processed.
5597    let err = error as BusinessError;
5598    console.error(`The isFocusDrivenTypeSupported call failed. error code: ${err.code}`);
5599  }
5600  return status;
5601}
5602```
5603
5604## Focus
5605
5606Focus extends [FocusQuery](#focusquery12)
5607
5608Provides APIs to obtain and set the camera focus mode and focus position.
5609
5610### setFocusAssist<sup>12+</sup>
5611
5612setFocusAssist(enabled: boolean): void
5613
5614Sets the focus assist.
5615
5616Before the setting, call [isFocusAssistSupported](#isfocusassistsupported12) to check whether the device supports the focus assist.
5617
5618**System API**: This is a system API.
5619
5620**System capability**: SystemCapability.Multimedia.Camera.Core
5621
5622**Parameters**
5623
5624| Name     | Type                    | Mandatory| Description                |
5625| -------- | ----------------------- | ---- | ------------------- |
5626| enabled | boolean | Yes  | Whether to enable or disable focus assist. The value **true** means to enable focus assist, and **false** means to disable it.|
5627
5628**Error codes**
5629
5630For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5631
5632| ID        | Error Message       |
5633| --------------- | --------------- |
5634| 202     | Not System Application. |
5635| 7400101                |  Parameter missing or parameter type incorrect.        |
5636| 7400103                |  Session not config.                                   |
5637
5638
5639**Example**
5640
5641```ts
5642import { BusinessError } from '@kit.BasicServicesKit';
5643
5644function setFocusAssist(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5645  try {
5646    professionalPhotoSession.setFocusAssist(false);
5647  } catch (error) {
5648    // If the operation fails, error.code is returned and processed.
5649    let err = error as BusinessError;
5650    console.error(`The setFocusAssist call failed. error code: ${err.code}`);
5651  }
5652}
5653```
5654
5655### getFocusAssist<sup>12+</sup>
5656
5657getFocusAssist(): boolean
5658
5659Checks whether the focus assist is enabled.
5660
5661**System API**: This is a system API.
5662
5663**System capability**: SystemCapability.Multimedia.Camera.Core
5664
5665**Return value**
5666
5667| Type       | Description                         |
5668| ---------- | ----------------------------- |
5669| boolean    | Check result. The value **true** means that the focus assist is enabled, and **false** means the opposite.|
5670
5671**Error codes**
5672
5673For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5674
5675| ID        | Error Message       |
5676| --------------- | --------------- |
5677| 7400103                |  Session not config.                                   |
5678| 202     | Not System Application. |
5679
5680**Example**
5681
5682```ts
5683import { BusinessError } from '@kit.BasicServicesKit';
5684
5685function getFocusAssist(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5686  let isFocusAssistOpened: boolean;
5687  try {
5688    isFocusAssistOpened = professionalPhotoSession.getFocusAssist();
5689  } catch (error) {
5690    // If the operation fails, error.code is returned and processed.
5691    let err = error as BusinessError;
5692    console.error(`The getFocusAssist call failed. error code: ${err.code}`);
5693  }
5694  return isFocusAssistOpened;
5695}
5696```
5697
5698### setFocusRange<sup>15+</sup>
5699
5700setFocusRange(type: FocusRangeType): void
5701
5702Sets a focus range type. Before the setting, call [isFocusRangeTypeSupported](#isfocusrangetypesupported15) to check whether the focus range type is supported.
5703
5704**System API**: This is a system API.
5705
5706**System capability**: SystemCapability.Multimedia.Camera.Core
5707
5708**Parameters**
5709
5710| Name| Type                               | Mandatory| Description          |
5711| ------ | ----------------------------------- | ---- | -------------- |
5712| type   | [FocusRangeType](#focusrangetype15) | Yes  | Focus range type.|
5713
5714**Error codes**
5715
5716For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5717
5718| ID| Error Message                                                    |
5719| -------- | ------------------------------------------------------------ |
5720| 202      | Not System Application.                                      |
5721| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3.Parameter verification failed. |
5722| 7400102  | Operation not allowed.                                       |
5723| 7400103  | Session not config.                                          |
5724| 7400201  | Camera service fatal error.                                  |
5725
5726**Example**
5727
5728```ts
5729import { BusinessError } from '@kit.BasicServicesKit';
5730
5731function setFocusRange(session: camera.VideoSessionForSys, type: camera.FocusRangeType): void {
5732  try {
5733    session.setFocusRange(type);
5734  } catch (error) {
5735    // If the operation fails, error.code is returned and processed.
5736    let err = error as BusinessError;
5737    console.error(`The setFocusRange call failed. error code: ${err.code}`);
5738  }
5739}
5740```
5741
5742### getFocusRange<sup>15+</sup>
5743
5744getFocusRange(): FocusRangeType
5745
5746Obtains the focus range type in use.
5747
5748**System API**: This is a system API.
5749
5750**System capability**: SystemCapability.Multimedia.Camera.Core
5751
5752**Return value**
5753
5754| Type                               | Description                    |
5755| ----------------------------------- | ------------------------ |
5756| [FocusRangeType](#focusrangetype15) | Focus range type.|
5757
5758**Error codes**
5759
5760For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5761
5762| ID| Error Message               |
5763| -------- | ----------------------- |
5764| 202      | Not System Application. |
5765| 7400103  | Session not config.     |
5766
5767**Example**
5768
5769```ts
5770import { BusinessError } from '@kit.BasicServicesKit';
5771
5772function getFocusRange(session: camera.VideoSessionForSys): camera.FocusRangeType | undefined {
5773  let focusRangeType: camera.FocusRangeType | undefined = undefined;
5774  try {
5775    focusRangeType = session.getFocusRange();
5776  } catch (error) {
5777    // If the operation fails, error.code is returned and processed.
5778    let err = error as BusinessError;
5779    console.error(`The getFocusRange call failed. error code: ${err.code}`);
5780  }
5781  return focusRangeType;
5782}
5783```
5784
5785### setFocusDriven<sup>15+</sup>
5786
5787setFocusDriven(type: FocusDrivenType): void
5788
5789Sets a focus drive type. Before the setting, call [isFocusDrivenTypeSupported](#isfocusdriventypesupported15) to check whether the focus drive type is supported.
5790
5791**System API**: This is a system API.
5792
5793**System capability**: SystemCapability.Multimedia.Camera.Core
5794
5795**Parameters**
5796
5797| Name| Type                                 | Mandatory| Description          |
5798| ------ | ------------------------------------- | ---- | -------------- |
5799| type   | [FocusDrivenType](#focusdriventype15) | Yes  | Focus drive type.|
5800
5801**Error codes**
5802
5803For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5804
5805| ID| Error Message                                                    |
5806| -------- | ------------------------------------------------------------ |
5807| 202      | Not System Application.                                      |
5808| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3.Parameter verification failed. |
5809| 7400102  | Operation not allowed.                                       |
5810| 7400103  | Session not config.                                          |
5811| 7400201  | Camera service fatal error.                                  |
5812
5813**Example**
5814
5815```ts
5816import { BusinessError } from '@kit.BasicServicesKit';
5817
5818function setFocusDriven(session: camera.VideoSessionForSys, type: camera.FocusDrivenType): void {
5819  try {
5820    session.setFocusDriven(type);
5821  } catch (error) {
5822    // If the operation fails, error.code is returned and processed.
5823    let err = error as BusinessError;
5824    console.error(`The setFocusDriven call failed. error code: ${err.code}`);
5825  }
5826}
5827```
5828
5829### getFocusDriven<sup>15+</sup>
5830
5831getFocusDriven(): FocusDrivenType
5832
5833Obtains the focus drive type in use.
5834
5835**System API**: This is a system API.
5836
5837**System capability**: SystemCapability.Multimedia.Camera.Core
5838
5839**Return value**
5840
5841| Type                                 | Description                    |
5842| ------------------------------------- | ------------------------ |
5843| [FocusDrivenType](#focusdriventype15) | Focus drive type.|
5844
5845**Error codes**
5846
5847For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5848
5849| ID| Error Message               |
5850| -------- | ----------------------- |
5851| 202      | Not System Application. |
5852| 7400103  | Session not config.     |
5853
5854**Example**
5855
5856```ts
5857import { BusinessError } from '@kit.BasicServicesKit';
5858
5859function getFocusDriven(session: camera.VideoSessionForSys): camera.FocusDrivenType | undefined {
5860  let focusDrivenType: camera.FocusDrivenType | undefined = undefined;
5861  try {
5862    focusDrivenType = session.getFocusDriven();
5863  } catch (error) {
5864    // If the operation fails, error.code is returned and processed.
5865    let err = error as BusinessError;
5866    console.error(`The getFocusDriven call failed. error code: ${err.code}`);
5867  }
5868  return focusDrivenType;
5869}
5870```
5871
5872## ManualFocus<sup>12+</sup>
5873
5874Provides APIs related to manual focus operations.
5875
5876### setFocusDistance<sup>12+</sup>
5877
5878setFocusDistance(distance: number): void
5879
5880Sets the manual focus distance.
5881
5882**System API**: This is a system API.
5883
5884**System capability**: SystemCapability.Multimedia.Camera.Core
5885
5886**Parameters**
5887
5888| Name     | Type                    | Mandatory| Description                |
5889| -------- | ----------------------- | ---- | ------------------- |
5890| 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> |
5891
5892**Error codes**
5893
5894For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5895
5896| ID        | Error Message       |
5897| --------------- | --------------- |
5898| 202     | Not System Application. |
5899| 7400101                |  Parameter missing or parameter type incorrect.        |
5900| 7400103                |  Session not config.                                   |
5901
5902**Example**
5903
5904```ts
5905import { BusinessError } from '@kit.BasicServicesKit';
5906
5907function setFocusDistance(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5908  try {
5909    let distance: number = 0.5;
5910    professionalPhotoSession.setFocusDistance(distance);
5911  } catch (error) {
5912    // If the operation fails, error.code is returned and processed.
5913    let err = error as BusinessError;
5914    console.error(`The setFocusDistance call failed. error code: ${err.code}`);
5915  }
5916}
5917```
5918
5919### getFocusDistance<sup>12+</sup>
5920
5921getFocusDistance(): number
5922
5923Obtains the focus distance in use.
5924
5925**System API**: This is a system API.
5926
5927**System capability**: SystemCapability.Multimedia.Camera.Core
5928
5929**Return value**
5930
5931| Type       | Description                         |
5932| ---------- | ----------------------------- |
5933| number    | Normalized value of the focus distance.|
5934
5935**Error codes**
5936
5937For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5938
5939| ID        | Error Message       |
5940| --------------- | --------------- |
5941| 7400103                |  Session not config.                                   |
5942| 202     | Not System Application. |
5943
5944**Example**
5945
5946```ts
5947import { BusinessError } from '@kit.BasicServicesKit';
5948
5949function getFocusDistance(professionalPhotoSession: camera.ProfessionalPhotoSession): number {
5950  let distance: number = 0;
5951  try {
5952    distance = professionalPhotoSession.getFocusDistance();
5953  } catch (error) {
5954    // If the operation fails, error.code is returned and processed.
5955    let err = error as BusinessError;
5956    console.error(`The getFocusDistance call failed. error code: ${err.code}`);
5957  }
5958  return distance;
5959}
5960```
5961
5962## ManualIsoQuery<sup>12+</sup>
5963
5964Provides APIs to check whether a camera device supports manual ISO setting and obtain the ISO range supported by the device.
5965
5966### isManualIsoSupported<sup>12+</sup>
5967
5968isManualIsoSupported(): boolean
5969
5970Checks whether manual ISO setting is supported.
5971
5972**System API**: This is a system API.
5973
5974**System capability**: SystemCapability.Multimedia.Camera.Core
5975
5976**Return value**
5977
5978| Type       | Description                         |
5979| ---------- | ----------------------------- |
5980| boolean    | The value **true** means that manual ISO setting is supported, and **false** means the opposite. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
5981
5982**Error codes**
5983
5984For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
5985
5986| ID        | Error Message       |
5987| --------------- | --------------- |
5988| 7400103                |  Session not config.                                   |
5989| 202     | Not System Application. |
5990
5991**Example**
5992
5993```ts
5994import { BusinessError } from '@kit.BasicServicesKit';
5995
5996function isManualIsoSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5997  let status: boolean = false;
5998  try {
5999    status = professionalPhotoSession.isManualIsoSupported();
6000  } catch (error) {
6001    // If the operation fails, error.code is returned and processed.
6002    let err = error as BusinessError;
6003    console.error(`The isManualIsoSupported call failed. error code: ${err.code}`);
6004  }
6005  return status;
6006}
6007```
6008
6009### getIsoRange<sup>12+</sup>
6010
6011getIsoRange(): Array\<number\>
6012
6013Obtains the supported ISO range.
6014
6015**System API**: This is a system API.
6016
6017**System capability**: SystemCapability.Multimedia.Camera.Core
6018
6019**Return value**
6020
6021| Type       | Description                         |
6022| ---------- | ----------------------------- |
6023| 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.|
6024
6025**Error codes**
6026
6027For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6028
6029| ID        | Error Message       |
6030| --------------- | --------------- |
6031| 202     | Not System Application. |
6032| 7400103                |  Session not config.                                   |
6033
6034**Example**
6035
6036```ts
6037import { BusinessError } from '@kit.BasicServicesKit';
6038
6039function getIsoRange(professionalPhotoSession: camera.ProfessionalPhotoSession): Array<number> {
6040  let isoRange: Array<number> = [];
6041  try {
6042    isoRange = professionalPhotoSession.getIsoRange();
6043  } catch (error) {
6044    // If the operation fails, error.code is returned and processed.
6045    let err = error as BusinessError;
6046    console.error(`The getIsoRange call failed. error code: ${err.code}`);
6047  }
6048  return isoRange;
6049}
6050```
6051
6052## ManualIso<sup>12+</sup>
6053
6054ManualIso extends [ManualIsoQuery](#manualisoquery12)
6055
6056Provides APIs for obtaining and setting the manual ISO (sensitivity) of a camera device.
6057
6058### setIso<sup>12+</sup>
6059setIso(iso: number): void
6060
6061Sets the ISO.
6062
6063**NOTE**: When the ISO is set to 0, automatic ISO is used.
6064
6065**System API**: This is a system API.
6066
6067**System capability**: SystemCapability.Multimedia.Camera.Core
6068
6069**Parameters**
6070
6071| Name     | Type                    | Mandatory| Description                |
6072| -------- | ----------------------- | ---- | ------------------- |
6073| iso | number | Yes  | ISO.|
6074
6075**Error codes**
6076
6077For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6078
6079| ID        | Error Message       |
6080| --------------- | --------------- |
6081| 202     | Not System Application. |
6082| 7400101                |  Parameter missing or parameter type incorrect.        |
6083| 7400103                |  Session not config.                                   |
6084
6085**Example**
6086
6087```ts
6088import { BusinessError } from '@kit.BasicServicesKit';
6089
6090function setIso(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6091  try {
6092    let iso: number = 200;
6093    professionalPhotoSession.setIso(iso);
6094  } catch (error) {
6095    // If the operation fails, error.code is returned and processed.
6096    let err = error as BusinessError;
6097    console.error(`The setIso call failed. error code: ${err.code}`);
6098  }
6099}
6100```
6101
6102### getIso<sup>12+</sup>
6103
6104getIso(): number
6105
6106Obtains the ISO in use.
6107
6108**System API**: This is a system API.
6109
6110**System capability**: SystemCapability.Multimedia.Camera.Core
6111
6112**Return value**
6113
6114| Type       | Description                         |
6115| ---------- | ----------------------------- |
6116| number    | ISO.|
6117
6118**Error codes**
6119
6120For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6121
6122| ID        | Error Message       |
6123| --------------- | --------------- |
6124| 202     | Not System Application. |
6125| 7400103                |  Session not config.                                   |
6126
6127**Example**
6128
6129```ts
6130import { BusinessError } from '@kit.BasicServicesKit';
6131
6132function getIso(professionalPhotoSession: camera.ProfessionalPhotoSession): number {
6133  let iso: number = 0;
6134  try {
6135    iso = professionalPhotoSession.getIso();
6136  } catch (error) {
6137    // If the operation fails, error.code is returned and processed.
6138    let err = error as BusinessError;
6139    console.error(`The getIso call failed. error code: ${err.code}`);
6140  }
6141  return iso;
6142}
6143```
6144
6145## WhiteBalanceMode<sup>12+</sup>
6146
6147Enumerates the white balance modes.
6148
6149**System API**: This is a system API.
6150
6151**System capability**: SystemCapability.Multimedia.Camera.Core
6152
6153| Name                          | Value  | Description        |
6154| ----------------------------- | ---- | ----------- |
6155| AUTO          | 0    | Automatic.|
6156| CLOUDY        | 1    | Cloudy.|
6157| INCANDESCENT  | 2    | Incandescent light.|
6158| FLUORESCENT   | 3    | Fluorescence light.|
6159| DAYLIGHT     	| 4    | Daylight.|
6160| MANUAL        | 5    | Manual.|
6161
6162## WhiteBalanceQuery<sup>12+</sup>
6163
6164Provides APIs to check whether a white balance mode is supported and obtain the white balance mode range supported.
6165
6166### isWhiteBalanceModeSupported<sup>12+</sup>
6167
6168isWhiteBalanceModeSupported(mode: WhiteBalanceMode): boolean
6169
6170Checks whether a white balance mode is supported.
6171
6172**System API**: This is a system API.
6173
6174**System capability**: SystemCapability.Multimedia.Camera.Core
6175**Parameters**
6176
6177| Name     | Type                          | Mandatory | Description                          |
6178| -------- | -------------------------------| ---- | ----------------------------- |
6179| mode   | [WhiteBalanceMode](#whitebalancemode12)  | Yes  | White balance mode.                     |
6180
6181**Return value**
6182
6183| Type       | Description                         |
6184| ---------- | ----------------------------- |
6185| boolean    | The value **true** means that the white balance mode is supported, and **false** means the opposite. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
6186
6187**Error codes**
6188
6189For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6190
6191| ID        | Error Message       |
6192| --------------- | --------------- |
6193| 202     | Not System Application. |
6194| 7400101                |  Parameter missing or parameter type incorrect.        |
6195| 7400103                |  Session not config.                                   |
6196
6197**Example**
6198
6199```ts
6200import { BusinessError } from '@kit.BasicServicesKit';
6201
6202function isWhiteBalanceModeSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
6203  let status: boolean = false;
6204  try {
6205	let mode: WhiteBalanceMode = camera.WhiteBalanceMode.DAYLIGHT;
6206    status = professionalPhotoSession.isWhiteBalanceModeSupported(mode);
6207  } catch (error) {
6208    // If the operation fails, error.code is returned and processed.
6209    let err = error as BusinessError;
6210    console.error(`The isWhiteBalanceModeSupported call failed. error code: ${err.code}`);
6211  }
6212  return status;
6213}
6214```
6215
6216### getWhiteBalanceRange<sup>12+</sup>
6217
6218getWhiteBalanceRange(): Array\<number\>
6219
6220Obtains the white balance range, in which users can manually adjust the white balance.
6221
6222**System API**: This is a system API.
6223
6224**System capability**: SystemCapability.Multimedia.Camera.Core
6225
6226**Return value**
6227
6228| Type       | Description                         |
6229| ---------- | ----------------------------- |
6230| 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.|
6231
6232**Error codes**
6233
6234For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6235
6236| ID        | Error Message       |
6237| --------------- | --------------- |
6238| 202     | Not System Application. |
6239| 7400103                |  Session not config.                                   |
6240
6241**Example**
6242
6243```ts
6244import { BusinessError } from '@kit.BasicServicesKit';
6245
6246function getWhiteBalanceRange(professionalPhotoSession: camera.ProfessionalPhotoSession): Array<number> {
6247  let range: Array<number> = [];
6248  try {
6249    range = professionalPhotoSession.getWhiteBalanceRange();
6250  } catch (error) {
6251    // If the operation fails, error.code is returned and processed.
6252    let err = error as BusinessError;
6253    console.error(`The getWhiteBalanceRange call failed. error code: ${err.code}`);
6254  }
6255  return range;
6256}
6257```
6258
6259## WhiteBalance<sup>12+</sup>
6260
6261WhiteBalance extends [WhiteBalanceQuery](#whitebalancequery12)
6262
6263Provides APIs to process white balance, including obtaining and setting the white balance mode and white balance value.
6264
6265### setWhiteBalanceMode<sup>12+</sup>
6266
6267setWhiteBalanceMode(mode: WhiteBalanceMode): void
6268
6269Sets a white balance mode.
6270
6271Before the setting, call [isWhiteBalanceModeSupported](#iswhitebalancemodesupported12) to check whether the target white balance mode is supported.
6272
6273**System API**: This is a system API.
6274
6275**System capability**: SystemCapability.Multimedia.Camera.Core
6276
6277**Parameters**
6278
6279| Name     | Type                           | Mandatory| Description                   |
6280| -------- | -------------------------------| ---- | ----------------------- |
6281| mode   | [WhiteBalanceMode](#whitebalancemode12)  | Yes  | White balance mode.               |
6282
6283**Error codes**
6284
6285For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6286
6287| ID        | Error Message       |
6288| --------------- | --------------- |
6289| 202     | Not System Application. |
6290| 7400101                |  Parameter missing or parameter type incorrect.        |
6291| 7400103                |  Session not config.                                   |
6292
6293**Example**
6294
6295```ts
6296import { BusinessError } from '@kit.BasicServicesKit';
6297
6298function setWhiteBalanceMode(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6299  try {
6300    professionalPhotoSession.setWhiteBalanceMode(camera.WhiteBalanceMode.DAYLIGHT);
6301  } catch (error) {
6302    // If the operation fails, error.code is returned and processed.
6303    let err = error as BusinessError;
6304    console.error(`The setWhiteBalanceMode call failed. error code: ${err.code}`);
6305  }
6306}
6307```
6308
6309### getWhiteBalanceMode<sup>12+</sup>
6310
6311getWhiteBalanceMode(): WhiteBalanceMode
6312
6313Obtains the white balance mode in use.
6314
6315**System API**: This is a system API.
6316
6317**System capability**: SystemCapability.Multimedia.Camera.Core
6318
6319**Return value**
6320
6321| Type       | Description                         |
6322| ---------- | ----------------------------- |
6323| [WhiteBalanceMode](#whitebalancemode12)    | White balance mode in use. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
6324
6325**Error codes**
6326
6327For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6328
6329| ID        | Error Message       |
6330| --------------- | --------------- |
6331| 202     | Not System Application. |
6332| 7400103                |  Session not config.                                   |
6333
6334**Example**
6335
6336```ts
6337import { BusinessError } from '@kit.BasicServicesKit';
6338
6339function getWhiteBalanceMode(professionalPhotoSession: camera.ProfessionalPhotoSession): camera.WhiteBalanceMode | undefined {
6340  let whiteBalanceMode: camera.WhiteBalanceMode | undefined = undefined;
6341  try {
6342    whiteBalanceMode = professionalPhotoSession.getWhiteBalanceMode();
6343  } catch (error) {
6344    // If the operation fails, error.code is returned and processed.
6345    let err = error as BusinessError;
6346    console.error(`The getWhiteBalanceMode call failed. error code: ${err.code}`);
6347  }
6348  return whiteBalanceMode;
6349}
6350```
6351
6352### setWhiteBalance<sup>12+</sup>
6353
6354setWhiteBalance(whiteBalance: number): void
6355
6356Sets a white balance value.
6357
6358**System API**: This is a system API.
6359
6360**System capability**: SystemCapability.Multimedia.Camera.Core
6361
6362**Parameters**
6363
6364| Name     | Type                    | Mandatory| Description                |
6365| -------- | ----------------------- | ---- | ------------------- |
6366| whiteBalance | number | Yes  | White balance value.|
6367
6368**Error codes**
6369
6370For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6371
6372| ID        | Error Message       |
6373| --------------- | --------------- |
6374| 202     | Not System Application. |
6375| 7400101                |  Parameter missing or parameter type incorrect.        |
6376| 7400103                |  Session not config.                                   |
6377
6378**Example**
6379
6380```ts
6381import { BusinessError } from '@kit.BasicServicesKit';
6382
6383function setWhiteBalance(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6384  try {
6385    let whiteBalance: number = 1000;
6386    professionalPhotoSession.setWhiteBalance(whiteBalance);
6387  } catch (error) {
6388    // If the operation fails, error.code is returned and processed.
6389    let err = error as BusinessError;
6390    console.error(`The setWhiteBalance call failed. error code: ${err.code}`);
6391  }
6392}
6393```
6394
6395### getWhiteBalance<sup>12+</sup>
6396
6397getWhiteBalance(): number
6398
6399Obtains the current white balance value.
6400
6401**System API**: This is a system API.
6402
6403**System capability**: SystemCapability.Multimedia.Camera.Core
6404
6405**Return value**
6406
6407| Type       | Description                         |
6408| ---------- | ----------------------------- |
6409| number    | White balance value.|
6410
6411**Error codes**
6412
6413For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6414
6415| ID        | Error Message       |
6416| --------------- | --------------- |
6417| 202     | Not System Application. |
6418| 7400103                |  Session not config.                                   |
6419
6420**Example**
6421
6422```ts
6423import { BusinessError } from '@kit.BasicServicesKit';
6424
6425function getWhiteBalance(professionalPhotoSession: camera.ProfessionalPhotoSession): number {
6426  let whiteBalance: number = 0;
6427  try {
6428    whiteBalance = professionalPhotoSession.getWhiteBalance();
6429  } catch (error) {
6430    // If the operation fails, error.code is returned and processed.
6431    let err = error as BusinessError;
6432    console.error(`The getWhiteBalance call failed. error code: ${err.code}`);
6433  }
6434  return whiteBalance;
6435}
6436```
6437
6438## ProfessionalPhotoSession<sup>12+</sup>
6439
6440ProfessionalPhotoSession extends Session, AutoExposure, ManualExposure, Focus, ManualFocus, WhiteBalance, ManualIso, Flash, Zoom, ColorEffect, Aperture
6441
6442Implements 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).
6443
6444### on('error')<sup>12+</sup>
6445
6446on(type: 'error', callback: ErrorCallback): void
6447
6448Subscribes to **ProfessionalPhotoSession** error events. This API uses an asynchronous callback to return the result.
6449
6450**System API**: This is a system API.
6451
6452**System capability**: SystemCapability.Multimedia.Camera.Core
6453
6454**Parameters**
6455
6456| Name    | Type                                                         | Mandatory| Description                          |
6457| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
6458| 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).|
6459| 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).|
6460
6461**Error codes**
6462
6463For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6464
6465| ID  | Error Message       |
6466|---------| --------------- |
6467| 202     |  Not System Application. |
6468
6469**Example**
6470
6471```ts
6472import { BusinessError } from '@kit.BasicServicesKit';
6473
6474function callback(err: BusinessError): void {
6475  console.error(`Professional photo session error code: ${err.code}`);
6476}
6477
6478function registerSessionError(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6479  professionalPhotoSession.on('error', callback);
6480}
6481```
6482
6483### off('error')<sup>12+</sup>
6484
6485off(type: 'error', callback?: ErrorCallback): void
6486
6487Unsubscribes from **ProfessionalPhotoSession** error events.
6488
6489**System API**: This is a system API.
6490
6491**System capability**: SystemCapability.Multimedia.Camera.Core
6492
6493**Parameters**
6494
6495| Name    | Type                       | Mandatory| Description                          |
6496| -------- | ------------------------ | ---- | ------------------------------ |
6497| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
6498| 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.      |
6499
6500**Error codes**
6501
6502For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6503
6504| ID  | Error Message       |
6505|---------| --------------- |
6506| 202     |  Not System Application. |
6507
6508**Example**
6509
6510```ts
6511function unregisterSessionError(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6512  professionalPhotoSession.off('error');
6513}
6514```
6515
6516### on('focusStateChange')<sup>12+</sup>
6517
6518on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
6519
6520Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
6521
6522**System API**: This is a system API.
6523
6524**System capability**: SystemCapability.Multimedia.Camera.Core
6525
6526**Parameters**
6527
6528| Name    | Type                   | Mandatory| Description                      |
6529| -------- | ---------------- | ---- | ------------------------ |
6530| 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.|
6531| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
6532
6533**Error codes**
6534
6535For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6536
6537| ID  | Error Message       |
6538|---------| --------------- |
6539| 202     |  Not System Application. |
6540
6541**Example**
6542
6543```ts
6544import { BusinessError } from '@kit.BasicServicesKit';
6545
6546function callback(err: BusinessError, focusState: camera.FocusState): void {
6547  if (err !== undefined && err.code !== 0) {
6548    console.error(`Callback Error, errorCode: ${err.code}`);
6549    return;
6550  }
6551  console.info(`Focus state: ${focusState}`);
6552}
6553
6554function registerFocusStateChange(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6555  professionalPhotoSession.on('focusStateChange', callback);
6556}
6557```
6558
6559### off('focusStateChange')<sup>12+</sup>
6560
6561off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
6562
6563Unsubscribes from focus state change events.
6564
6565**System API**: This is a system API.
6566
6567**System capability**: SystemCapability.Multimedia.Camera.Core
6568
6569**Parameters**
6570
6571| Name    | Type                                     | Mandatory| Description                      |
6572| -------- | ----------------------------------------- | ---- | ------------------------ |
6573| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
6574| 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.) |
6575
6576**Error codes**
6577
6578For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6579
6580| ID  | Error Message       |
6581|---------| --------------- |
6582| 202     |  Not System Application. |
6583
6584**Example**
6585
6586```ts
6587function unregisterFocusStateChange(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6588  professionalPhotoSession.off('focusStateChange');
6589}
6590```
6591
6592### on('smoothZoomInfoAvailable')<sup>12+</sup>
6593
6594on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
6595
6596Subscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
6597
6598**System API**: This is a system API.
6599
6600**System capability**: SystemCapability.Multimedia.Camera.Core
6601
6602**Parameters**
6603
6604| Name    | Type                  | Mandatory| Description                      |
6605| -------- | ----------------------- | ---- | ------------------------ |
6606| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
6607| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
6608
6609**Error codes**
6610
6611For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6612
6613| ID  | Error Message       |
6614|---------| --------------- |
6615| 202     |  Not System Application. |
6616
6617**Example**
6618
6619```ts
6620import { BusinessError } from '@kit.BasicServicesKit';
6621
6622function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
6623  if (err !== undefined && err.code !== 0) {
6624    console.error(`Callback Error, errorCode: ${err.code}`);
6625    return;
6626  }
6627  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
6628}
6629
6630function registerSmoothZoomInfo(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6631  professionalPhotoSession.on('smoothZoomInfoAvailable', callback);
6632}
6633```
6634
6635### off('smoothZoomInfoAvailable')<sup>12+</sup>
6636
6637off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
6638
6639Unsubscribes from smooth zoom state change events.
6640
6641**System API**: This is a system API.
6642
6643**System capability**: SystemCapability.Multimedia.Camera.Core
6644
6645**Parameters**
6646
6647| Name    | Type                                     | Mandatory| Description                      |
6648| -------- | ----------------------------------------- | ---- | ------------------------ |
6649| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
6650| 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.) |
6651
6652**Error codes**
6653
6654For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6655
6656| ID  | Error Message       |
6657|---------| --------------- |
6658| 202     |  Not System Application. |
6659
6660**Example**
6661
6662```ts
6663function unregisterSmoothZoomInfo(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6664  professionalPhotoSession.off('smoothZoomInfoAvailable');
6665}
6666```
6667
6668### on('isoInfoChange')<sup>12+</sup>
6669
6670on(type: 'isoInfoChange', callback: AsyncCallback\<IsoInfo\>): void
6671
6672Subscribes to automatic ISO change events to obtain real-time ISO information. This API uses an asynchronous callback to return the result.
6673
6674**System API**: This is a system API.
6675
6676**System capability**: SystemCapability.Multimedia.Camera.Core
6677
6678**Parameters**
6679
6680| Name    | Type                                                     | Mandatory| Description                              |
6681| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6682| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
6683| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| Yes  | Callback used to return the ISO information.        |
6684
6685**Error codes**
6686
6687| ID| Error Message                    |
6688| ------- | ---------------------- |
6689| 202     | Not System Application. |
6690
6691**Example**
6692
6693```ts
6694import { BusinessError } from '@kit.BasicServicesKit';
6695
6696function isoInfoCallback(err: BusinessError, info: camera.IsoInfo): void {
6697  if (err !== undefined && err.code !== 0) {
6698    console.error(`Callback Error, errorCode: ${err.code}`);
6699    return;
6700  }
6701  console.log(`ISO value: ${info.iso}`);
6702}
6703
6704function registerIsoInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6705  professionalPhotoSession.on('isoInfoChange', isoInfoCallback);
6706}
6707```
6708
6709### off('isoInfoChange')<sup>12+</sup>
6710
6711off(type: 'isoInfoChange', callback?: AsyncCallback\<IsoInfo\>): void
6712
6713Unsubscribes from automatic ISO change events.
6714
6715**System API**: This is a system API.
6716
6717**System capability**: SystemCapability.Multimedia.Camera.Core
6718
6719**Parameters**
6720
6721| Name    | Type                                                     | Mandatory| Description                              |
6722| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6723| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
6724| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('isoInfoChange')**.|
6725
6726**Error codes**
6727
6728| ID| Error Message                   |
6729| ------- | ---------------------- |
6730| 202     | Not System Application. |
6731
6732**Example**
6733
6734```ts
6735function unregisterIsoInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6736  professionalPhotoSession.off('isoInfoChange');
6737}
6738```
6739
6740### on('exposureInfoChange')<sup>12+</sup>
6741
6742on(type: 'exposureInfoChange', callback: AsyncCallback\<ExposureInfo\>): void
6743
6744Subscribes to exposure information change events to obtain the exposure information. This API uses an asynchronous callback to return the result.
6745
6746**System API**: This is a system API.
6747
6748**System capability**: SystemCapability.Multimedia.Camera.Core
6749
6750**Parameters**
6751
6752| Name    | Type                                                     | Mandatory| Description                              |
6753| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6754| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
6755| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| Yes  | Callback used to return the exposure information.        |
6756
6757**Error codes**
6758
6759| ID| Error Message                    |
6760| ------- | ---------------------- |
6761| 202     | Not System Application. |
6762
6763**Example**
6764
6765```ts
6766import { BusinessError } from '@kit.BasicServicesKit';
6767
6768function exposureInfoCallback(err: BusinessError, info: camera.ExposureInfo): void {
6769  if (err !== undefined && err.code !== 0) {
6770    console.error(`Callback Error, errorCode: ${err.code}`);
6771    return;
6772  }
6773  console.log(`exposureTimeValue: ${info.exposureTime}`);
6774}
6775
6776function registerExposureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6777  professionalPhotoSession.on('exposureInfoChange', exposureInfoCallback);
6778}
6779```
6780
6781### off('exposureInfoChange')<sup>12+</sup>
6782
6783off(type: 'exposureInfoChange', callback?: AsyncCallback\<ExposureInfo\>): void
6784
6785Unsubscribes from exposure information change events.
6786
6787**System API**: This is a system API.
6788
6789**System capability**: SystemCapability.Multimedia.Camera.Core
6790
6791**Parameters**
6792
6793| Name    | Type                                                     | Mandatory| Description                              |
6794| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6795| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
6796| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('exposureInfoChange')**.|
6797
6798**Error codes**
6799
6800| ID| Error Message                    |
6801| ------- | ---------------------- |
6802| 202     | Not System Application. |
6803
6804**Example**
6805
6806```ts
6807function unregisterExposureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6808  professionalPhotoSession.off('exposureInfoChange');
6809}
6810```
6811
6812### on('apertureInfoChange')<sup>12+</sup>
6813
6814on(type: 'apertureInfoChange', callback: AsyncCallback\<ApertureInfo\>): void
6815
6816Subscribes to aperture change events to obtain the real-time aperture information. This API uses an asynchronous callback to return the result.
6817
6818**System API**: This is a system API.
6819
6820**System capability**: SystemCapability.Multimedia.Camera.Core
6821
6822**Parameters**
6823
6824| Name    | Type                                                     | Mandatory| Description                              |
6825| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6826| type     | string                                                  | Yes  | Event type. The value is fixed at **'apertureInfoChange'**.        |
6827| callback | AsyncCallback\<[ApertureInfo](#apertureinfo12)\>| Yes  | Callback used to return the aperture information.        |
6828
6829**Error codes**
6830
6831| ID| Error Message                    |
6832| ------- | ---------------------- |
6833| 202     | Not System Application. |
6834
6835**Example**
6836
6837```ts
6838import { BusinessError } from '@kit.BasicServicesKit';
6839
6840function apertureInfoCallback(err: BusinessError, info: camera.ApertureInfo): void {
6841  if (err !== undefined && err.code !== 0) {
6842    console.error(`Callback Error, errorCode: ${err.code}`);
6843    return;
6844  }
6845  console.log(`Aperture value: ${info.aperture}`);
6846}
6847
6848function registerApertureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6849  professionalPhotoSession.on('apertureInfoChange', apertureInfoCallback);
6850}
6851```
6852
6853### off('apertureInfoChange')<sup>12+</sup>
6854
6855off(type: 'apertureInfoChange', callback?: AsyncCallback\<ApertureInfo\>): void
6856
6857Unsubscribes from aperture change events.
6858
6859**System API**: This is a system API.
6860
6861**System capability**: SystemCapability.Multimedia.Camera.Core
6862
6863**Parameters**
6864
6865| Name    | Type                                                     | Mandatory| Description                              |
6866| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6867| type     | string                                                  | Yes  | Event type. The value is fixed at **'apertureInfoChange'**.        |
6868| callback | AsyncCallback\<[ApertureInfo](#apertureinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('apertureInfoChange')**.|
6869
6870**Error codes**
6871
6872| ID| Error Message                    |
6873| ------- | ---------------------- |
6874| 202     | Not System Application. |
6875
6876**Example**
6877
6878```ts
6879function unregisterApertureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6880  professionalPhotoSession.off('apertureInfoChange');
6881}
6882```
6883
6884### on('luminationInfoChange')<sup>12+</sup>
6885
6886on(type: 'luminationInfoChange', callback: AsyncCallback\<LuminationInfo\>): void
6887
6888Subscribes to illumination change events to obtain real-time illumination information. This API uses an asynchronous callback to return the result.
6889
6890**System API**: This is a system API.
6891
6892**System capability**: SystemCapability.Multimedia.Camera.Core
6893
6894**Parameters**
6895
6896| Name    | Type                                                     | Mandatory| Description                              |
6897| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6898| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
6899| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| Yes  | Callback used to return the illumination information.        |
6900
6901**Error codes**
6902
6903| ID| Error Message                    |
6904| ------- | ---------------------- |
6905| 202     | Not System Application. |
6906
6907**Example**
6908
6909```ts
6910import { BusinessError } from '@kit.BasicServicesKit';
6911
6912function luminationInfoCallback(err: BusinessError, info: camera.LuminationInfo): void {
6913  if (err !== undefined && err.code !== 0) {
6914    console.error(`Callback Error, errorCode: ${err.code}`);
6915    return;
6916  }
6917  console.log(`Lumination: ${info.lumination}`);
6918}
6919
6920function registerLuminationInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6921  professionalPhotoSession.on('luminationInfoChange', luminationInfoCallback);
6922}
6923```
6924
6925### off('luminationInfoChange')<sup>12+</sup>
6926
6927off(type: 'luminationInfoChange', callback?: AsyncCallback\<LuminationInfo\>): void
6928
6929Unsubscribes from illumination change events.
6930
6931**System API**: This is a system API.
6932
6933**System capability**: SystemCapability.Multimedia.Camera.Core
6934
6935**Parameters**
6936
6937| Name    | Type                                                     | Mandatory| Description                              |
6938| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6939| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
6940| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('luminationInfoChange')**.|
6941
6942**Error codes**
6943
6944| ID| Error Message                    |
6945| ------- | ---------------------- |
6946| 202     | Not System Application. |
6947
6948**Example**
6949
6950```ts
6951function unregisterLuminationInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6952  professionalPhotoSession.off('luminationInfoChange');
6953}
6954```
6955
6956## ProfessionalVideoSession<sup>12+</sup>
6957
6958ProfessionalVideoSession extends Session, AutoExposure, ManualExposure, Focus, ManualFocus, WhiteBalance, ManualIso, Flash, Zoom, ColorEffect, Aperture
6959
6960Implements 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).
6961
6962### on('error')<sup>12+</sup>
6963
6964on(type: 'error', callback: ErrorCallback): void
6965
6966Subscribes to **ProfessionalVideo** error events. This API uses an asynchronous callback to return the result.
6967
6968**System API**: This is a system API.
6969
6970**System capability**: SystemCapability.Multimedia.Camera.Core
6971
6972**Parameters**
6973
6974| Name    | Type                                                         | Mandatory| Description                          |
6975| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
6976| 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).|
6977| 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).|
6978
6979**Error codes**
6980
6981For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
6982
6983| ID  | Error Message       |
6984|---------| --------------- |
6985| 202     |  Not System Application. |
6986
6987**Example**
6988
6989```ts
6990import { BusinessError } from '@kit.BasicServicesKit';
6991
6992function callback(err: BusinessError): void {
6993  console.error(`Professional video session error code: ${err.code}`);
6994}
6995
6996function registerSessionError(professionalVideoSession: camera.ProfessionalVideoSession): void {
6997  professionalVideoSession.on('error', callback);
6998}
6999```
7000
7001### off('error')<sup>12+</sup>
7002
7003off(type: 'error', callback?: ErrorCallback): void
7004
7005Unsubscribes from **ProfessionalVideo** error events.
7006
7007**System API**: This is a system API.
7008
7009**System capability**: SystemCapability.Multimedia.Camera.Core
7010
7011**Parameters**
7012
7013| Name    | Type                       | Mandatory| Description                          |
7014| -------- | ------------------------ | ---- | ------------------------------ |
7015| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
7016| 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.      |
7017
7018**Error codes**
7019
7020For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7021
7022| ID  | Error Message       |
7023|---------| --------------- |
7024| 202     |  Not System Application. |
7025
7026**Example**
7027
7028```ts
7029function unregisterSessionError(professionalVideoSession: camera.ProfessionalVideoSession): void {
7030  professionalVideoSession.off('error');
7031}
7032```
7033
7034### on('focusStateChange')<sup>12+</sup>
7035
7036on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
7037
7038Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
7039
7040**System API**: This is a system API.
7041
7042**System capability**: SystemCapability.Multimedia.Camera.Core
7043
7044**Parameters**
7045
7046| Name    | Type                   | Mandatory| Description                      |
7047| -------- | ---------------- | ---- | ------------------------ |
7048| 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.|
7049| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
7050
7051**Error codes**
7052
7053For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7054
7055| ID  | Error Message       |
7056|---------| --------------- |
7057| 202     |  Not System Application. |
7058
7059**Example**
7060
7061```ts
7062import { BusinessError } from '@kit.BasicServicesKit';
7063
7064function callback(err: BusinessError, focusState: camera.FocusState): void {
7065  if (err !== undefined && err.code !== 0) {
7066    console.error(`Callback Error, errorCode: ${err.code}`);
7067    return;
7068  }
7069  console.info(`Focus state: ${focusState}`);
7070}
7071
7072function registerFocusStateChange(professionalVideoSession: camera.ProfessionalVideoSession): void {
7073  professionalVideoSession.on('focusStateChange', callback);
7074}
7075```
7076
7077### off('focusStateChange')<sup>12+</sup>
7078
7079off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
7080
7081Unsubscribes from focus state change events.
7082
7083**System API**: This is a system API.
7084
7085**System capability**: SystemCapability.Multimedia.Camera.Core
7086
7087**Parameters**
7088
7089| Name    | Type                                     | Mandatory| Description                      |
7090| -------- | ----------------------------------------- | ---- | ------------------------ |
7091| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
7092| 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.) |
7093
7094**Error codes**
7095
7096For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7097
7098| ID  | Error Message       |
7099|---------| --------------- |
7100| 202     |  Not System Application. |
7101
7102**Example**
7103
7104```ts
7105function unregisterFocusStateChange(professionalVideoSession: camera.ProfessionalVideoSession): void {
7106  professionalVideoSession.off('focusStateChange');
7107}
7108```
7109
7110### on('smoothZoomInfoAvailable')<sup>12+</sup>
7111
7112on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
7113
7114Subscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
7115
7116**System API**: This is a system API.
7117
7118**System capability**: SystemCapability.Multimedia.Camera.Core
7119
7120**Parameters**
7121
7122| Name    | Type                  | Mandatory| Description                      |
7123| -------- | ----------------------- | ---- | ------------------------ |
7124| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
7125| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
7126
7127**Error codes**
7128
7129For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7130
7131| ID  | Error Message       |
7132|---------| --------------- |
7133| 202     |  Not System Application. |
7134
7135**Example**
7136
7137```ts
7138import { BusinessError } from '@kit.BasicServicesKit';
7139
7140function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
7141  if (err !== undefined && err.code !== 0) {
7142    console.error(`Callback Error, errorCode: ${err.code}`);
7143    return;
7144  }
7145  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
7146}
7147
7148function registerSmoothZoomInfo(professionalVideoSession: camera.ProfessionalVideoSession): void {
7149  professionalVideoSession.on('smoothZoomInfoAvailable', callback);
7150}
7151```
7152
7153### off('smoothZoomInfoAvailable')<sup>12+</sup>
7154
7155off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
7156
7157Unsubscribes from smooth zoom state change events.
7158
7159**System API**: This is a system API.
7160
7161**System capability**: SystemCapability.Multimedia.Camera.Core
7162
7163**Parameters**
7164
7165| Name    | Type                                     | Mandatory| Description                      |
7166| -------- | ----------------------------------------- | ---- | ------------------------ |
7167| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
7168| 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.) |
7169
7170**Error codes**
7171
7172For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7173
7174| ID  | Error Message       |
7175|---------| --------------- |
7176| 202     |  Not System Application. |
7177
7178**Example**
7179
7180```ts
7181function unregisterSmoothZoomInfo(professionalVideoSession: camera.ProfessionalVideoSession): void {
7182  professionalVideoSession.off('smoothZoomInfoAvailable');
7183}
7184```
7185
7186### on('isoInfoChange')<sup>12+</sup>
7187
7188on(type: 'isoInfoChange', callback: AsyncCallback\<IsoInfo\>): void
7189
7190Subscribes to automatic ISO change events to obtain real-time ISO information. This API uses an asynchronous callback to return the result.
7191
7192**System API**: This is a system API.
7193
7194**System capability**: SystemCapability.Multimedia.Camera.Core
7195
7196**Parameters**
7197
7198| Name    | Type                                                     | Mandatory| Description                              |
7199| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7200| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
7201| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| Yes  | Callback used to return the ISO information.        |
7202
7203**Error codes**
7204
7205| ID| Error Message                    |
7206| ------- | ---------------------- |
7207| 202     | Not System Application. |
7208
7209**Example**
7210
7211```ts
7212import { BusinessError } from '@kit.BasicServicesKit';
7213
7214function isoInfoCallback(err: BusinessError, info: camera.IsoInfo): void {
7215  if (err !== undefined && err.code !== 0) {
7216    console.error(`Callback Error, errorCode: ${err.code}`);
7217    return;
7218  }
7219  console.log(`ISO value: ${info.iso}`);
7220}
7221
7222function registerIsoInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7223  professionalVideoSession.on('isoInfoChange', isoInfoCallback);
7224}
7225```
7226
7227### off('isoInfoChange')<sup>12+</sup>
7228
7229off(type: 'isoInfoChange', callback?: AsyncCallback\<IsoInfo\>): void
7230
7231Unsubscribes from automatic ISO change events.
7232
7233**System API**: This is a system API.
7234
7235**System capability**: SystemCapability.Multimedia.Camera.Core
7236
7237**Parameters**
7238
7239| Name    | Type                                                     | Mandatory| Description                              |
7240| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7241| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
7242| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('isoInfoChange')**.|
7243
7244**Error codes**
7245
7246| ID| Error Message                    |
7247| ------- | ---------------------- |
7248| 202     | Not System Application. |
7249
7250**Example**
7251
7252```ts
7253function unregisterIsoInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7254  professionalVideoSession.off('isoInfoChange');
7255}
7256```
7257
7258### on('exposureInfoChange')<sup>12+</sup>
7259
7260on(type: 'exposureInfoChange', callback: AsyncCallback\<ExposureInfo\>): void
7261
7262Subscribes to exposure information change events to obtain the exposure information. This API uses an asynchronous callback to return the result.
7263
7264**System API**: This is a system API.
7265
7266**System capability**: SystemCapability.Multimedia.Camera.Core
7267
7268**Parameters**
7269
7270| Name    | Type                                                     | Mandatory| Description                              |
7271| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7272| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
7273| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| Yes  | Callback used to return the exposure information.        |
7274
7275**Error codes**
7276
7277| ID| Error Message                    |
7278| ------- | ---------------------- |
7279| 202     | Not System Application. |
7280
7281**Example**
7282
7283```ts
7284import { BusinessError } from '@kit.BasicServicesKit';
7285
7286function exposureInfoCallback(err: BusinessError, info: camera.ExposureInfo): void {
7287  if (err !== undefined && err.code !== 0) {
7288    console.error(`Callback Error, errorCode: ${err.code}`);
7289    return;
7290  }
7291  console.log(`exposureTimeValue: ${info.exposureTime}`);
7292}
7293
7294function registerExposureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7295  professionalVideoSession.on('exposureInfoChange', exposureInfoCallback);
7296}
7297```
7298
7299### off('exposureInfoChange')<sup>12+</sup>
7300
7301off(type: 'exposureInfoChange', callback?: AsyncCallback\<ExposureInfo\>): void
7302
7303Unsubscribes from exposure information change events.
7304
7305**System API**: This is a system API.
7306
7307**System capability**: SystemCapability.Multimedia.Camera.Core
7308
7309**Parameters**
7310
7311| Name    | Type                                                     | Mandatory| Description                              |
7312| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7313| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
7314| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('exposureInfoChange')**.|
7315
7316**Error codes**
7317
7318| ID| Error Message                    |
7319| ------- | ---------------------- |
7320| 202     | Not System Application. |
7321
7322**Example**
7323
7324```ts
7325function unregisterExposureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7326  professionalVideoSession.off('exposureInfoChange');
7327}
7328```
7329
7330### on('apertureInfoChange')<sup>12+</sup>
7331
7332on(type: 'apertureInfoChange', callback: AsyncCallback\<ApertureInfo\>): void
7333
7334Subscribes to aperture change events to obtain the aperture information. This API uses an asynchronous callback to return the result.
7335
7336**System API**: This is a system API.
7337
7338**System capability**: SystemCapability.Multimedia.Camera.Core
7339
7340**Parameters**
7341
7342| Name    | Type                                                     | Mandatory| Description                              |
7343| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7344| type     | string                                                  | Yes  | Event type. The value is fixed at **'apertureInfoChange'**.        |
7345| callback | AsyncCallback\<[ApertureInfo](#apertureinfo12)\>| Yes  | Callback used to return the aperture information.        |
7346
7347**Error codes**
7348
7349| ID| Error Message                    |
7350| ------- | ---------------------- |
7351| 202     | Not System Application. |
7352
7353**Example**
7354
7355```ts
7356import { BusinessError } from '@kit.BasicServicesKit';
7357
7358function apertureInfoCallback(err: BusinessError, info: camera.ApertureInfo): void {
7359  if (err !== undefined && err.code !== 0) {
7360    console.error(`Callback Error, errorCode: ${err.code}`);
7361    return;
7362  }
7363  console.log(`Aperture value: ${info.aperture}`);
7364}
7365
7366function registerApertureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7367  professionalVideoSession.on('apertureInfoChange', apertureInfoCallback);
7368}
7369```
7370
7371### off('apertureInfoChange')<sup>12+</sup>
7372
7373off(type: 'apertureInfoChange', callback?: AsyncCallback\<ApertureInfo\>): void
7374
7375Unsubscribes from aperture change events.
7376
7377**System API**: This is a system API.
7378
7379**System capability**: SystemCapability.Multimedia.Camera.Core
7380
7381**Parameters**
7382
7383| Name    | Type                                                     | Mandatory| Description                              |
7384| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7385| type     | string                                                  | Yes  | Event type. The value is fixed at **'apertureInfoChange'**.        |
7386| callback | AsyncCallback\<[ApertureInfo](#apertureinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('apertureInfoChange')**.|
7387
7388**Error codes**
7389
7390| ID| Error Message                    |
7391| ------- | ---------------------- |
7392| 202     | Not System Application. |
7393
7394**Example**
7395
7396```ts
7397function unregisterApertureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7398  professionalVideoSession.off('apertureInfoChange');
7399}
7400```
7401
7402### on('luminationInfoChange')<sup>12+</sup>
7403
7404on(type: 'luminationInfoChange', callback: AsyncCallback\<LuminationInfo\>): void
7405
7406Subscribes to illumination change events to obtain illumination information. This API uses an asynchronous callback to return the result.
7407
7408**System API**: This is a system API.
7409
7410**System capability**: SystemCapability.Multimedia.Camera.Core
7411
7412**Parameters**
7413
7414| Name    | Type                                                     | Mandatory| Description                              |
7415| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7416| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
7417| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| Yes  | Callback used to return the illumination information.        |
7418
7419**Error codes**
7420
7421| ID| Error Message                    |
7422| ------- | ---------------------- |
7423| 202     | Not System Application. |
7424
7425**Example**
7426
7427```ts
7428import { BusinessError } from '@kit.BasicServicesKit';
7429
7430function luminationInfoCallback(err: BusinessError, info: camera.LuminationInfo): void {
7431  if (err !== undefined && err.code !== 0) {
7432    console.error(`Callback Error, errorCode: ${err.code}`);
7433    return;
7434  }
7435  console.log(`Lumination: ${info.lumination}`);
7436}
7437
7438function registerLuminationInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7439  professionalVideoSession.on('luminationInfoChange', luminationInfoCallback);
7440}
7441```
7442
7443### off('luminationInfoChange')<sup>12+</sup>
7444
7445off(type: 'luminationInfoChange', callback?: AsyncCallback\<LuminationInfo\>): void
7446
7447Unsubscribes from illumination change events.
7448
7449**System API**: This is a system API.
7450
7451**System capability**: SystemCapability.Multimedia.Camera.Core
7452
7453**Parameters**
7454
7455| Name    | Type                                                     | Mandatory| Description                              |
7456| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7457| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
7458| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('luminationInfoChange')**.|
7459
7460**Error codes**
7461
7462| ID| Error Message                    |
7463| ------- | ---------------------- |
7464| 202     | Not System Application. |
7465
7466**Example**
7467
7468```ts
7469function unregisterLuminationInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7470  professionalVideoSession.off('luminationInfoChange');
7471}
7472```
7473
7474## MacroPhotoSession<sup>12+</sup>
7475
7476MacroPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ManualFocus
7477
7478Implements 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).
7479
7480### on('error')<sup>12+</sup>
7481
7482on(type: 'error', callback: ErrorCallback): void
7483
7484Subscribes to **MacroPhotoSession** error events. This API uses an asynchronous callback to return the result.
7485
7486**System API**: This is a system API.
7487
7488**System capability**: SystemCapability.Multimedia.Camera.Core
7489
7490**Parameters**
7491
7492| Name     | Type                                                                       | Mandatory | Description                                                                                                                                                                     |
7493|----------|---------------------------------------------------------------------------|-----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
7494| 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).|
7495| 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).                                                                                                          |
7496
7497**Error codes**
7498
7499For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7500
7501| ID| Error Message                      |
7502|-------|----------------------------|
7503| 202   | Not System Application.    |
7504
7505**Example**
7506
7507```ts
7508import { BusinessError } from '@kit.BasicServicesKit';
7509
7510function callback(err: BusinessError): void {
7511  console.error(`MacroPhotoSession error code: ${err.code}`);
7512}
7513
7514function registerSessionError(macroPhotoSession: camera.MacroPhotoSession): void {
7515  macroPhotoSession.on('error', callback);
7516}
7517```
7518
7519### off('error')<sup>12+</sup>
7520
7521off(type: 'error', callback?: ErrorCallback): void
7522
7523Unsubscribes from **MacroPhotoSession** error events.
7524
7525**System API**: This is a system API.
7526
7527**System capability**: SystemCapability.Multimedia.Camera.Core
7528
7529**Parameters**
7530
7531| Name     | Type                                                                       | Mandatory| Description                                                         |
7532|----------|---------------------------------------------------------------------------|----|-------------------------------------------------------------|
7533| type     | string                                                                    | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.                       |
7534| 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.|
7535
7536**Error codes**
7537
7538For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7539
7540| ID| Error Message                      |
7541|-------|----------------------------|
7542| 202   | Not System Application.    |
7543
7544**Example**
7545
7546```ts
7547function unregisterSessionError(macroPhotoSession: camera.MacroPhotoSession): void {
7548  macroPhotoSession.off('error');
7549}
7550```
7551
7552### on('focusStateChange')<sup>12+</sup>
7553
7554on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
7555
7556Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
7557
7558**System API**: This is a system API.
7559
7560**System capability**: SystemCapability.Multimedia.Camera.Core
7561
7562**Parameters**
7563
7564| Name      | Type                                         | Mandatory| Description                                                                     |
7565|-----------|---------------------------------------------|----|-------------------------------------------------------------------------|
7566| 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.|
7567| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | Yes | Callback used to return the focus state change.                                                       |
7568
7569**Error codes**
7570
7571For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7572
7573| ID| Error Message                      |
7574|-------|----------------------------|
7575| 202   | Not System Application.    |
7576
7577**Example**
7578
7579```ts
7580import { BusinessError } from '@kit.BasicServicesKit';
7581
7582function callback(err: BusinessError, focusState: camera.FocusState): void {
7583  if (err !== undefined && err.code !== 0) {
7584    console.error(`Callback Error, errorCode: ${err.code}`);
7585    return;
7586  }
7587  console.info(`Focus state: ${focusState}`);
7588}
7589
7590function registerFocusStateChange(macroPhotoSession: camera.MacroPhotoSession): void {
7591  macroPhotoSession.on('focusStateChange', callback);
7592}
7593```
7594
7595### off('focusStateChange')<sup>12+</sup>
7596
7597off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
7598
7599Unsubscribes from focus state change events.
7600
7601**System API**: This is a system API.
7602
7603**System capability**: SystemCapability.Multimedia.Camera.Core
7604
7605**Parameters**
7606
7607| Name      | Type                                         | Mandatory| Description                                                          |
7608|-----------|---------------------------------------------|----|--------------------------------------------------------------|
7609| type      | string                                      | Yes | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.                  |
7610| 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. |
7611
7612**Error codes**
7613
7614For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7615
7616| ID| Error Message                      |
7617|-------|----------------------------|
7618| 202   | Not System Application.    |
7619
7620**Example**
7621
7622```ts
7623function unregisterFocusStateChange(macroPhotoSession: camera.MacroPhotoSession): void {
7624  macroPhotoSession.off('focusStateChange');
7625}
7626```
7627
7628### on('smoothZoomInfoAvailable')<sup>12+</sup>
7629
7630on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
7631
7632Subscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
7633
7634**System API**: This is a system API.
7635
7636**System capability**: SystemCapability.Multimedia.Camera.Core
7637
7638**Parameters**
7639
7640| Name    | Type                  | Mandatory| Description                      |
7641| -------- | ----------------------- | ---- | ------------------------ |
7642| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
7643| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
7644
7645**Error codes**
7646
7647For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7648
7649| ID| Error Message                      |
7650|-------|----------------------------|
7651| 202   | Not System Application.    |
7652
7653**Example**
7654
7655```ts
7656import { BusinessError } from '@kit.BasicServicesKit';
7657
7658function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
7659  if (err !== undefined && err.code !== 0) {
7660    console.error(`Callback Error, errorCode: ${err.code}`);
7661    return;
7662  }
7663  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
7664}
7665
7666function registerSmoothZoomInfo(macroPhotoSession: camera.MacroPhotoSession): void {
7667  macroPhotoSession.on('smoothZoomInfoAvailable', callback);
7668}
7669```
7670
7671### off('smoothZoomInfoAvailable')<sup>12+</sup>
7672
7673off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
7674
7675Unsubscribes from smooth zoom state change events.
7676
7677**System API**: This is a system API.
7678
7679**System capability**: SystemCapability.Multimedia.Camera.Core
7680
7681**Parameters**
7682
7683| Name    | Type                                     | Mandatory| Description                      |
7684| -------- | ----------------------------------------- | ---- | ------------------------ |
7685| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
7686| 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.|
7687
7688**Error codes**
7689
7690For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7691
7692| ID| Error Message                      |
7693|-------|----------------------------|
7694| 202   | Not System Application.    |
7695
7696**Example**
7697
7698```ts
7699function unregisterSmoothZoomInfo(macroPhotoSession: camera.MacroPhotoSession): void {
7700  macroPhotoSession.off('smoothZoomInfoAvailable');
7701}
7702```
7703
7704## MacroVideoSession<sup>12+</sup>
7705
7706MacroVideoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ManualFocus
7707
7708Implements 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).
7709
7710### on('error')<sup>12+</sup>
7711
7712on(type: 'error', callback: ErrorCallback): void
7713
7714Subscribes to **MacroVideoSession** error events. This API uses an asynchronous callback to return the result.
7715
7716**System API**: This is a system API.
7717
7718**System capability**: SystemCapability.Multimedia.Camera.Core
7719
7720**Parameters**
7721
7722| Name     | Type                                                                       | Mandatory | Description                                                                                                                                                                     |
7723|----------|---------------------------------------------------------------------------|-----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
7724| 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).|
7725| 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).                                                                                                          |
7726
7727**Error codes**
7728
7729For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7730
7731| ID| Error Message                      |
7732|-------|----------------------------|
7733| 202   | Not System Application.    |
7734
7735**Example**
7736
7737```ts
7738import { BusinessError } from '@kit.BasicServicesKit';
7739
7740function callback(err: BusinessError): void {
7741  console.error(`MacroPhotoSession error code: ${err.code}`);
7742}
7743
7744function registerSessionError(macroVideoSession: camera.MacroVideoSession): void {
7745  macroVideoSession.on('error', callback);
7746}
7747```
7748
7749### off('error')<sup>12+</sup>
7750
7751off(type: 'error', callback?: ErrorCallback): void
7752
7753Unsubscribes from **MacroVideoSession** error events.
7754
7755**System API**: This is a system API.
7756
7757**System capability**: SystemCapability.Multimedia.Camera.Core
7758
7759**Parameters**
7760
7761| Name     | Type                                                                       | Mandatory| Description                                                         |
7762|----------|---------------------------------------------------------------------------|----|-------------------------------------------------------------|
7763| type     | string                                                                    | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.                       |
7764| 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.|
7765
7766**Error codes**
7767
7768For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7769
7770| ID| Error Message                      |
7771|-------|----------------------------|
7772| 202   | Not System Application.    |
7773
7774**Example**
7775
7776```ts
7777function unregisterSessionError(macroVideoSession: camera.MacroVideoSession): void {
7778  macroVideoSession.off('error');
7779}
7780```
7781
7782### on('focusStateChange')<sup>12+</sup>
7783
7784on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
7785
7786Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
7787
7788**System API**: This is a system API.
7789
7790**System capability**: SystemCapability.Multimedia.Camera.Core
7791
7792**Parameters**
7793
7794| Name      | Type                                         | Mandatory| Description                                                                     |
7795|-----------|---------------------------------------------|----|-------------------------------------------------------------------------|
7796| 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.|
7797| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | Yes | Callback used to return the focus state change.                                                       |
7798
7799**Error codes**
7800
7801For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7802
7803| ID| Error Message                      |
7804|-------|----------------------------|
7805| 202   | Not System Application.    |
7806
7807**Example**
7808
7809```ts
7810import { BusinessError } from '@kit.BasicServicesKit';
7811
7812function callback(err: BusinessError, focusState: camera.FocusState): void {
7813  if (err !== undefined && err.code !== 0) {
7814    console.error(`Callback Error, errorCode: ${err.code}`);
7815    return;
7816  }
7817  console.info(`Focus state: ${focusState}`);
7818}
7819
7820function registerFocusStateChange(macroVideoSession: camera.MacroVideoSession): void {
7821  macroVideoSession.on('focusStateChange', callback);
7822}
7823```
7824
7825### off('focusStateChange')<sup>12+</sup>
7826
7827off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
7828
7829Unsubscribes from focus state change events.
7830
7831**System API**: This is a system API.
7832
7833**System capability**: SystemCapability.Multimedia.Camera.Core
7834
7835**Parameters**
7836
7837| Name      | Type                                         | Mandatory| Description                                                          |
7838|-----------|---------------------------------------------|----|--------------------------------------------------------------|
7839| type      | string                                      | Yes | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.                  |
7840| 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. |
7841
7842**Error codes**
7843
7844For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7845
7846| ID| Error Message                      |
7847|-------|----------------------------|
7848| 202   | Not System Application.    |
7849
7850**Example**
7851
7852```ts
7853function unregisterFocusStateChange(macroVideoSession: camera.MacroVideoSession): void {
7854  macroVideoSession.off('focusStateChange');
7855}
7856```
7857
7858### on('smoothZoomInfoAvailable')<sup>12+</sup>
7859
7860on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
7861
7862Subscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
7863
7864**System API**: This is a system API.
7865
7866**System capability**: SystemCapability.Multimedia.Camera.Core
7867
7868**Parameters**
7869
7870| Name    | Type                  | Mandatory| Description                      |
7871| -------- | ----------------------- | ---- | ------------------------ |
7872| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
7873| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
7874
7875**Error codes**
7876
7877For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7878
7879| ID| Error Message                      |
7880|-------|----------------------------|
7881| 202   | Not System Application.    |
7882
7883**Example**
7884
7885```ts
7886import { BusinessError } from '@kit.BasicServicesKit';
7887
7888function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
7889  if (err !== undefined && err.code !== 0) {
7890    console.error(`Callback Error, errorCode: ${err.code}`);
7891    return;
7892  }
7893  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
7894}
7895
7896function registerSmoothZoomInfo(macroVideoSession: camera.MacroVideoSession): void {
7897  macroVideoSession.on('smoothZoomInfoAvailable', callback);
7898}
7899```
7900
7901### off('smoothZoomInfoAvailable')<sup>12+</sup>
7902
7903off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
7904
7905Unsubscribes from smooth zoom state change events.
7906
7907**System API**: This is a system API.
7908
7909**System capability**: SystemCapability.Multimedia.Camera.Core
7910
7911**Parameters**
7912
7913| Name    | Type                                     | Mandatory| Description                      |
7914| -------- | ----------------------------------------- | ---- | ------------------------ |
7915| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
7916| 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.|
7917
7918**Error codes**
7919
7920For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7921
7922| ID| Error Message                      |
7923|-------|----------------------------|
7924| 202   | Not System Application.    |
7925
7926**Example**
7927
7928```ts
7929function unregisterSmoothZoomInfo(macroVideoSession: camera.MacroVideoSession): void {
7930  macroVideoSession.off('smoothZoomInfoAvailable');
7931}
7932```
7933
7934## FlashQuery<sup>12+</sup>
7935
7936Provides APIs to obtain the flash information of a camera device, including whether the LCD flash is supported.
7937
7938### isLcdFlashSupported<sup>12+</sup>
7939
7940isLcdFlashSupported(): boolean
7941
7942Checks whether the LCD flash is supported.
7943
7944**System API**: This is a system API.
7945
7946**System capability**: SystemCapability.Multimedia.Camera.Core
7947
7948**Return value**
7949
7950| Type           | Description                    |
7951| -------------- | ----------------------- |
7952| boolean | Check result. The value **true** means that the LCD flash is supported, and **false** means the opposite.|
7953
7954**Error codes**
7955
7956For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7957
7958| ID        | Error Message       |
7959| --------------- | --------------- |
7960| 202 | Not System Application. |
7961| 7400103                |  Session not config, only throw in session usage. |
7962
7963**Example**
7964
7965```ts
7966function isLcdFlashSupported(nightPhotoSession: camera.NightPhotoSession): boolean {
7967  return nightPhotoSession.isLcdFlashSupported();
7968}
7969```
7970
7971## Flash<sup>11+</sup>
7972
7973Flash extends [FlashQuery](js-apis-camera.md#flashquery12)
7974
7975Provides APIs related to the flash.
7976
7977### enableLcdFlash<sup>13+</sup>
7978
7979enableLcdFlash(enabled: boolean): void
7980
7981Enables or disables the LCD flash.
7982
7983Before the setting, call [isLcdFlashSupported](#islcdflashsupported12) to check whether the device supports the LCD flash.
7984
7985**System capability**: SystemCapability.Multimedia.Camera.Core
7986
7987**Parameters**
7988
7989| Name      | Type                    | Mandatory| Description                                              |
7990| --------- | ----------------------- | ---- |--------------------------------------------------|
7991| enabled | boolean | Yes  | Whether to enable or disable the LCD flash. The value **true** means to enable the LCD flash, and **false** means to disable it. If null or undefined is passed, it is treated as 0 and the LCD flash is disabled.|
7992
7993**Error codes**
7994
7995For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
7996
7997| ID        | Error Message       |
7998| --------------- | --------------- |
7999| 7400103                |  Session not config.                                   |
8000
8001**Example**
8002
8003```ts
8004import { BusinessError } from '@kit.BasicServicesKit';
8005
8006function enableLcdFlash(session: camera.PhotoSessionForSys | camera.VideoSessionForSys | camera.NightPhotoSession): void {
8007  try {
8008    session.enableLcdFlash(true);
8009  } catch (error) {
8010    // If the operation fails, error.code is returned and processed.
8011    let err = error as BusinessError;
8012    console.error(`The setFlashMode call failed. error code: ${err.code}`);
8013  }
8014}
8015```
8016
8017## TimeLapseRecordState<sup>12+</sup>
8018
8019Enumerates the time-lapse recording states.
8020
8021**System API**: This is a system API.
8022
8023**System capability**: SystemCapability.Multimedia.Camera.Core
8024
8025| Name                          | Value  | Description        |
8026| ----------------------------- | ---- | ----------- |
8027| IDLE          | 0    | Recording not started.|
8028| RECORDING     | 1    | Recording.|
8029
8030## TimeLapsePreviewType<sup>12+</sup>
8031
8032Enumerates the time-lapse preview types, which affect the shooting algorithm.
8033
8034**System API**: This is a system API.
8035
8036**System capability**: SystemCapability.Multimedia.Camera.Core
8037
8038| Name                          | Value  | Description        |
8039| ----------------------------- | ---- | ----------- |
8040| DARK         | 1    | Dark environment, a scenario with poor illumination, for example, at night or in a dark area.|
8041| LIGHT        | 2    | Bright environment, a scenario with good illumination, for example, in the daytime or under light.|
8042
8043## TryAEInfo<sup>12+</sup>
8044
8045Describes the Try AE parameters. Try AE indicates that the hardware reports the status based on the ambient illumination change during time-lapse photographing.
8046
8047**System API**: This is a system API.
8048
8049**System capability**: SystemCapability.Multimedia.Camera.Core
8050
8051| Name| Type   | Read-only| Optional| Description          |
8052| ---- | ------- | ---- |--| -------------- |
8053| isTryAEDone        | boolean  | Yes  | No| Whether Try AE is complete.       |
8054| isTryAEHintNeeded  | boolean  | Yes  | Yes| Whether Try AE is required.       |
8055| previewType        | [TimeLapsePreviewType](#timelapsepreviewtype12) | Yes  | Yes| Preview type.       |
8056| captureInterval    | number   | Yes  | Yes| Shooting interval, in ms.       |
8057
8058## TimeLapsePhotoSession<sup>12+</sup>
8059
8060TimeLapsePhotoSession extends Session, Focus, ManualFocus, AutoExposure, ManualExposure, ManualIso, WhiteBalance, Zoom, ColorEffect
8061
8062Implements 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).
8063
8064### on('error')<sup>12+</sup>
8065
8066on(type: 'error', callback: ErrorCallback): void
8067
8068Subscribes to **TimeLapsePhotoSession** error events. This API uses an asynchronous callback to return the result.
8069
8070**System API**: This is a system API.
8071
8072**System capability**: SystemCapability.Multimedia.Camera.Core
8073
8074**Parameters**
8075
8076| Name    | Type                                                         | Mandatory| Description                          |
8077| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
8078| 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).|
8079| 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).|
8080
8081**Error codes**
8082
8083For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8084
8085| ID  | Error Message       |
8086|---------| --------------- |
8087| 202     |  Not System Application. |
8088
8089**Example**
8090
8091```ts
8092import { BusinessError } from '@kit.BasicServicesKit';
8093
8094function callback(err: BusinessError): void {
8095  console.error(`Time lapse photo session error code: ${err.code}`);
8096}
8097
8098function registerSessionError(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8099  timeLapsePhotoSession.on('error', callback);
8100}
8101```
8102
8103### off('error')<sup>12+</sup>
8104
8105off(type: 'error', callback?: ErrorCallback): void
8106
8107Unsubscribes from **TimeLapsePhotoSession** error events.
8108
8109**System API**: This is a system API.
8110
8111**System capability**: SystemCapability.Multimedia.Camera.Core
8112
8113**Parameters**
8114
8115| Name    | Type                       | Mandatory| Description                          |
8116| -------- | ------------------------ | ---- | ------------------------------ |
8117| type     | string    | Yes  | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.|
8118| 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.      |
8119
8120**Error codes**
8121
8122For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8123
8124| ID  | Error Message       |
8125|---------| --------------- |
8126| 202     |  Not System Application. |
8127
8128**Example**
8129
8130```ts
8131function unregisterSessionError(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8132  timeLapsePhotoSession.off('error');
8133}
8134```
8135
8136### on('focusStateChange')<sup>12+</sup>
8137
8138on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
8139
8140Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
8141
8142**System API**: This is a system API.
8143
8144**System capability**: SystemCapability.Multimedia.Camera.Core
8145
8146**Parameters**
8147
8148| Name    | Type                   | Mandatory| Description                      |
8149| -------- | ---------------- | ---- | ------------------------ |
8150| 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.|
8151| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | Yes  | Callback used to return the focus state change. |
8152
8153**Error codes**
8154
8155For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8156
8157| ID  | Error Message       |
8158|---------| --------------- |
8159| 202     |  Not System Application. |
8160
8161**Example**
8162
8163```ts
8164import { BusinessError } from '@kit.BasicServicesKit';
8165
8166function callback(err: BusinessError, focusState: camera.FocusState): void {
8167  if (err !== undefined && err.code !== 0) {
8168    console.error(`Callback Error, errorCode: ${err.code}`);
8169    return;
8170  }
8171  console.info(`Focus state: ${focusState}`);
8172}
8173
8174function registerFocusStateChange(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8175  timeLapsePhotoSession.on('focusStateChange', callback);
8176}
8177```
8178
8179### off('focusStateChange')<sup>12+</sup>
8180
8181off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
8182
8183Unsubscribes from focus state change events.
8184
8185**System API**: This is a system API.
8186
8187**System capability**: SystemCapability.Multimedia.Camera.Core
8188
8189**Parameters**
8190
8191| Name    | Type                                     | Mandatory| Description                      |
8192| -------- | ----------------------------------------- | ---- | ------------------------ |
8193| type     | string                                    | Yes  | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.|
8194| 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.) |
8195
8196**Error codes**
8197
8198For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8199
8200| ID  | Error Message       |
8201|---------| --------------- |
8202| 202     |  Not System Application. |
8203
8204**Example**
8205
8206```ts
8207function unregisterFocusStateChange(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8208  timeLapsePhotoSession.off('focusStateChange');
8209}
8210```
8211
8212### on('isoInfoChange')<sup>12+</sup>
8213
8214on(type: 'isoInfoChange', callback: AsyncCallback\<IsoInfo\>): void
8215
8216Subscribes to automatic ISO change events to obtain real-time ISO information. This API uses an asynchronous callback to return the result.
8217
8218**System API**: This is a system API.
8219
8220**System capability**: SystemCapability.Multimedia.Camera.Core
8221
8222**Parameters**
8223
8224| Name    | Type                                                     | Mandatory| Description                              |
8225| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8226| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
8227| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| Yes  | Callback used to return the ISO information.        |
8228
8229**Error codes**
8230
8231| ID| Error Message                    |
8232| ------- | ---------------------- |
8233| 202     | Not System Application. |
8234
8235**Example**
8236
8237```ts
8238import { BusinessError } from '@kit.BasicServicesKit';
8239
8240function isoInfoCallback(err: BusinessError, info: camera.IsoInfo): void {
8241  if (err !== undefined && err.code !== 0) {
8242    console.error(`Callback Error, errorCode: ${err.code}`);
8243    return;
8244  }
8245  console.log(`ISO value: ${info.iso}`);
8246}
8247
8248function registerIsoInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8249  timeLapsePhotoSession.on('isoInfoChange', isoInfoCallback);
8250}
8251```
8252
8253### off('isoInfoChange')<sup>12+</sup>
8254
8255off(type: 'isoInfoChange', callback?: AsyncCallback\<IsoInfo\>): void
8256
8257Unsubscribes from automatic ISO change events.
8258
8259**System API**: This is a system API.
8260
8261**System capability**: SystemCapability.Multimedia.Camera.Core
8262
8263**Parameters**
8264
8265| Name    | Type                                                     | Mandatory| Description                              |
8266| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8267| type     | string                                                  | Yes  | Event type. The value is fixed at **'isoInfoChange'**.        |
8268| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('isoInfoChange')**.|
8269
8270**Error codes**
8271
8272| ID| Error Message                   |
8273| ------- | ---------------------- |
8274| 202     | Not System Application. |
8275
8276**Example**
8277
8278```ts
8279function unregisterIsoInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8280  timeLapsePhotoSession.off('isoInfoChange');
8281}
8282```
8283
8284### on('exposureInfoChange')<sup>12+</sup>
8285
8286on(type: 'exposureInfoChange', callback: AsyncCallback\<ExposureInfo\>): void
8287
8288Subscribes to exposure information change events to obtain the exposure information. This API uses an asynchronous callback to return the result.
8289
8290**System API**: This is a system API.
8291
8292**System capability**: SystemCapability.Multimedia.Camera.Core
8293
8294**Parameters**
8295
8296| Name    | Type                                                     | Mandatory| Description                              |
8297| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8298| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
8299| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| Yes  | Callback used to return the exposure information.        |
8300
8301**Error codes**
8302
8303| ID| Error Message                    |
8304| ------- | ---------------------- |
8305| 202     | Not System Application. |
8306
8307**Example**
8308
8309```ts
8310import { BusinessError } from '@kit.BasicServicesKit';
8311
8312function exposureInfoCallback(err: BusinessError, info: camera.ExposureInfo): void {
8313  if (err !== undefined && err.code !== 0) {
8314    console.error(`Callback Error, errorCode: ${err.code}`);
8315    return;
8316  }
8317  console.log(`exposureTimeValue: ${info.exposureTime}`);
8318}
8319
8320function registerExposureInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8321  timeLapsePhotoSession.on('exposureInfoChange', exposureInfoCallback);
8322}
8323```
8324
8325### off('exposureInfoChange')<sup>12+</sup>
8326
8327off(type: 'exposureInfoChange', callback?: AsyncCallback\<ExposureInfo\>): void
8328
8329Unsubscribes from exposure information change events.
8330
8331**System API**: This is a system API.
8332
8333**System capability**: SystemCapability.Multimedia.Camera.Core
8334
8335**Parameters**
8336
8337| Name    | Type                                                     | Mandatory| Description                              |
8338| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8339| type     | string                                                  | Yes  | Event type. The value is fixed at **'exposureInfoChange'**.        |
8340| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('exposureInfoChange')**.|
8341
8342**Error codes**
8343
8344| ID| Error Message                    |
8345| ------- | ---------------------- |
8346| 202     | Not System Application. |
8347
8348**Example**
8349
8350```ts
8351function unregisterExposureInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8352  timeLapsePhotoSession.off('exposureInfoChange');
8353}
8354```
8355
8356### on('luminationInfoChange')<sup>12+</sup>
8357
8358on(type: 'luminationInfoChange', callback: AsyncCallback\<LuminationInfo\>): void
8359
8360Subscribes to illumination change events to obtain real-time illumination information. This API uses an asynchronous callback to return the result.
8361
8362**System API**: This is a system API.
8363
8364**System capability**: SystemCapability.Multimedia.Camera.Core
8365
8366**Parameters**
8367
8368| Name    | Type                                                     | Mandatory| Description                              |
8369| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8370| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
8371| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| Yes  | Callback used to return the illumination information.        |
8372
8373**Error codes**
8374
8375| ID| Error Message                    |
8376| ------- | ---------------------- |
8377| 202     | Not System Application. |
8378
8379**Example**
8380
8381```ts
8382import { BusinessError } from '@kit.BasicServicesKit';
8383
8384function luminationInfoCallback(err: BusinessError, info: camera.LuminationInfo): void {
8385  if (err !== undefined && err.code !== 0) {
8386    console.error(`Callback Error, errorCode: ${err.code}`);
8387    return;
8388  }
8389  console.log(`Lumination: ${info.lumination}`);
8390}
8391
8392function registerLuminationInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8393  timeLapsePhotoSession.on('luminationInfoChange', luminationInfoCallback);
8394}
8395```
8396
8397### off('luminationInfoChange')<sup>12+</sup>
8398
8399off(type: 'luminationInfoChange', callback?: AsyncCallback\<LuminationInfo\>): void
8400
8401Unsubscribes from illumination change events.
8402
8403**System API**: This is a system API.
8404
8405**System capability**: SystemCapability.Multimedia.Camera.Core
8406
8407**Parameters**
8408
8409| Name    | Type                                                     | Mandatory| Description                              |
8410| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8411| type     | string                                                  | Yes  | Event type. The value is fixed at **'luminationInfoChange'**.        |
8412| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('luminationInfoChange')**.|
8413
8414**Error codes**
8415
8416| ID| Error Message                    |
8417| ------- | ---------------------- |
8418| 202     | Not System Application. |
8419
8420**Example**
8421
8422```ts
8423function unregisterLuminationInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8424  timeLapsePhotoSession.off('luminationInfoChange');
8425}
8426```
8427
8428### on('tryAEInfoChange')<sup>12+</sup>
8429
8430on(type: 'tryAEInfoChange', callback: AsyncCallback\<TryAEInfo\>): void
8431
8432Subscribes to Try AE change events to obtain real-time Try AE parameters. This API uses an asynchronous callback to return the result.
8433
8434**System API**: This is a system API.
8435
8436**System capability**: SystemCapability.Multimedia.Camera.Core
8437
8438**Parameters**
8439
8440| Name    | Type                                                     | Mandatory| Description                              |
8441| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8442| type     | string                                                  | Yes  | Event type. The value is fixed at **'tryAEInfoChange'**.        |
8443| callback | AsyncCallback\<[TryAEInfo](#tryaeinfo12)\>| Yes  | Callback used to return the Try AE parameters.        |
8444
8445**Error codes**
8446
8447| ID| Error Message                    |
8448| ------- | ---------------------- |
8449| 202     | Not System Application. |
8450
8451**Example**
8452
8453```ts
8454import { BusinessError } from '@kit.BasicServicesKit';
8455
8456function tryAEInfoCallback(err: BusinessError, info: camera.TryAEInfo): void {
8457  if (err !== undefined && err.code !== 0) {
8458    console.error(`Callback Error, errorCode: ${err.code}`);
8459    return;
8460  }
8461  console.log(`TryAEInfo: ${info.isTryAEDone}, ${info.isTryAEHintNeeded}, ${info.previewType}, ${info.captureInterval}`);
8462}
8463
8464function registerTryAEInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8465  timeLapsePhotoSession.on('tryAEInfoChange', tryAEInfoCallback);
8466}
8467```
8468
8469### off('tryAEInfoChange')<sup>12+</sup>
8470
8471off(type: 'tryAEInfoChange', callback?: AsyncCallback\<TryAEInfo\>): void
8472
8473Unsubscribes from Try AE change events.
8474
8475**System API**: This is a system API.
8476
8477**System capability**: SystemCapability.Multimedia.Camera.Core
8478
8479**Parameters**
8480
8481| Name    | Type                                                     | Mandatory| Description                              |
8482| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8483| type     | string                                                  | Yes  | Event type. The value is fixed at **'tryAEInfoChange'**.        |
8484| callback | AsyncCallback\<[TryAEInfo](#tryaeinfo12)\>| No  | Callback, which is optional and is used to match **callback** in **on('tryAEInfoChange')**.|
8485
8486**Error codes**
8487
8488| ID| Error Message                    |
8489| ------- | ---------------------- |
8490| 202     | Not System Application. |
8491
8492**Example**
8493
8494```ts
8495function unregisterTryAEInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8496  timeLapsePhotoSession.off('tryAEInfoChange');
8497}
8498```
8499
8500### isTryAENeeded<sup>12+</sup>
8501
8502isTryAENeeded(): boolean
8503
8504Checks whether Try AE is required.
8505
8506**System API**: This is a system API.
8507
8508**System capability**: SystemCapability.Multimedia.Camera.Core
8509
8510**Return value**
8511
8512| Type       | Description                         |
8513| ---------- | ----------------------------- |
8514| boolean   | Check result. The value **true** means that Try AE is required, and **false** means the opposite. The error code type is defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode).|
8515
8516**Error codes**
8517
8518For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8519
8520| ID        | Error Message       |
8521| --------------- | --------------- |
8522| 202     | Not System Application. |
8523| 7400103 |  Session not config.    |
8524
8525**Example**
8526
8527```ts
8528import { BusinessError } from '@kit.BasicServicesKit';
8529
8530function isTryAENeeded(timeLapsePhotoSession: camera.TimeLapsePhotoSession): boolean {
8531  let needed = false;
8532  try {
8533    needed = timeLapsePhotoSession.isTryAENeeded();
8534  } catch (error) {
8535    // If the operation fails, error.code is returned and processed.
8536    let err = error as BusinessError;
8537    console.error(`The isTryAENeeded call failed. error code: ${err.code}`);
8538  }
8539  return needed;
8540}
8541```
8542
8543### startTryAE<sup>12+</sup>
8544
8545startTryAE(): void
8546
8547Starts to execute Try AE.
8548
8549**System API**: This is a system API.
8550
8551**System capability**: SystemCapability.Multimedia.Camera.Core
8552
8553**Error codes**
8554
8555For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8556
8557| ID        | Error Message       |
8558| --------------- | --------------- |
8559| 202     | Not System Application. |
8560| 7400103 | Session not config.     |
8561
8562**Example**
8563
8564```ts
8565import { BusinessError } from '@kit.BasicServicesKit';
8566
8567function startTryAE(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8568  try {
8569    timeLapsePhotoSession.startTryAE();
8570  } catch (error) {
8571    // If the operation fails, error.code is returned and processed.
8572    let err = error as BusinessError;
8573    console.error(`The startTryAE call failed. error code: ${err.code}`);
8574  }
8575}
8576```
8577
8578### stopTryAE<sup>12+</sup>
8579
8580stopTryAE(): void
8581
8582Stops the execution of Try AE.
8583
8584**System API**: This is a system API.
8585
8586**System capability**: SystemCapability.Multimedia.Camera.Core
8587
8588**Error codes**
8589
8590For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8591
8592| ID        | Error Message       |
8593| --------------- | --------------- |
8594| 202     | Not System Application. |
8595| 7400103 | Session not config.     |
8596
8597**Example**
8598
8599```ts
8600import { BusinessError } from '@kit.BasicServicesKit';
8601
8602function stopTryAE(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8603  try {
8604    timeLapsePhotoSession.stopTryAE();
8605  } catch (error) {
8606    // If the operation fails, error.code is returned and processed.
8607    let err = error as BusinessError;
8608    console.error(`The stopTryAE call failed. error code: ${err.code}`);
8609  }
8610}
8611```
8612
8613### getSupportedTimeLapseIntervalRange<sup>12+</sup>
8614
8615getSupportedTimeLapseIntervalRange(): Array\<number\>
8616
8617Obtains the supported time-lapse shooting interval range.
8618
8619**System API**: This is a system API.
8620
8621**System capability**: SystemCapability.Multimedia.Camera.Core
8622
8623**Return value**
8624
8625| Type       | Description                         |
8626| ---------- | ----------------------------- |
8627| 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.|
8628
8629**Error codes**
8630
8631For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8632
8633| ID        | Error Message       |
8634| --------------- | --------------- |
8635| 202     | Not System Application. |
8636| 7400103                |  Session not config.                                   |
8637
8638**Example**
8639
8640```ts
8641import { BusinessError } from '@kit.BasicServicesKit';
8642
8643function getSupportedTimeLapseIntervalRange(timeLapsePhotoSession: camera.TimeLapsePhotoSession): Array<number> {
8644  let intervalRange: Array<number> = [];
8645  try {
8646    intervalRange = timeLapsePhotoSession.getSupportedTimeLapseIntervalRange();
8647  } catch (error) {
8648    // If the operation fails, error.code is returned and processed.
8649    let err = error as BusinessError;
8650    console.error(`The getSupportedTimeLapseIntervalRange call failed. error code: ${err.code}`);
8651  }
8652  return intervalRange;
8653}
8654```
8655
8656### getTimeLapseInterval<sup>12+</sup>
8657
8658getTimeLapseInterval(): number
8659
8660Obtains the current time-lapse shooting interval.
8661
8662**System API**: This is a system API.
8663
8664**System capability**: SystemCapability.Multimedia.Camera.Core
8665
8666**Return value**
8667
8668| Type       | Description                         |
8669| ---------- | ----------------------------- |
8670| number    | Shooting interval, in ms.|
8671
8672**Error codes**
8673
8674For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8675
8676| ID        | Error Message       |
8677| --------------- | --------------- |
8678| 202     | Not System Application. |
8679| 7400103                |  Session not config.                                   |
8680
8681**Example**
8682
8683```ts
8684import { BusinessError } from '@kit.BasicServicesKit';
8685
8686function getTimeLapseInterval(timeLapsePhotoSession: camera.TimeLapsePhotoSession): number {
8687  let interval: number = 0;
8688  try {
8689    interval = timeLapsePhotoSession.getTimeLapseInterval();
8690  } catch (error) {
8691    // If the operation fails, error.code is returned and processed.
8692    let err = error as BusinessError;
8693    console.error(`The getTimeLapseInterval call failed. error code: ${err.code}`);
8694  }
8695  return interval;
8696}
8697```
8698
8699### setTimeLapseInterval<sup>12+</sup>
8700setTimeLapseInterval(interval: number): void
8701
8702Sets a time-lapse shooting interval.
8703
8704**System API**: This is a system API.
8705
8706**System capability**: SystemCapability.Multimedia.Camera.Core
8707
8708**Parameters**
8709
8710| Name     | Type                    | Mandatory| Description                |
8711| -------- | ----------------------- | ---- | ------------------- |
8712| interval | number | Yes  | Shooting interval, in ms.|
8713
8714**Error codes**
8715
8716For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8717
8718| ID        | Error Message       |
8719| --------------- | --------------- |
8720| 202     | Not System Application. |
8721| 7400101                |  Parameter missing or parameter type incorrect.        |
8722| 7400103                |  Session not config.                                   |
8723
8724**Example**
8725
8726```ts
8727import { BusinessError } from '@kit.BasicServicesKit';
8728
8729function setTimeLapseInterval(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8730  try {
8731    let interval: number = 10000;
8732    timeLapsePhotoSession.setTimeLapseInterval(interval);
8733  } catch (error) {
8734    // If the operation fails, error.code is returned and processed.
8735    let err = error as BusinessError;
8736    console.error(`The setTimeLapseInterval call failed. error code: ${err.code}`);
8737  }
8738}
8739```
8740
8741### getTimeLapseRecordState<sup>12+</sup>
8742
8743getTimeLapseRecordState(): TimeLapseRecordState
8744
8745Obtains the time-lapse shooting state.
8746
8747**System API**: This is a system API.
8748
8749**System capability**: SystemCapability.Multimedia.Camera.Core
8750
8751**Return value**
8752
8753| Type       | Description                         |
8754| ---------- | ----------------------------- |
8755| [TimeLapseRecordState](#timelapserecordstate12)    | Shooting state. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
8756
8757**Error codes**
8758
8759For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8760
8761| ID        | Error Message       |
8762| --------------- | --------------- |
8763| 202     | Not System Application. |
8764| 7400103                |  Session not config.                                   |
8765
8766**Example**
8767
8768```ts
8769import { BusinessError } from '@kit.BasicServicesKit';
8770
8771function getTimeLapseRecordState(timeLapsePhotoSession: camera.TimeLapsePhotoSession): camera.TimeLapseRecordState {
8772  let state = camera.TimeLapseRecordState.IDLE;
8773  try {
8774    state = timeLapsePhotoSession.getTimeLapseRecordState();
8775  } catch (error) {
8776    // If the operation fails, error.code is returned and processed.
8777    let err = error as BusinessError;
8778    console.error(`The getTimeLapseRecordState call failed. error code: ${err.code}`);
8779  }
8780  return state;
8781}
8782```
8783
8784### setTimeLapseRecordState<sup>12+</sup>
8785
8786setTimeLapseRecordState(state: TimeLapseRecordState): void
8787
8788Sets the time-lapse shooting state.
8789
8790**System API**: This is a system API.
8791
8792**System capability**: SystemCapability.Multimedia.Camera.Core
8793
8794**Parameters**
8795
8796| Name     | Type                           | Mandatory| Description                   |
8797| -------- | -------------------------------| ---- | ----------------------- |
8798| state   | [TimeLapseRecordState](#timelapserecordstate12)  | Yes  | Shooting state.               |
8799
8800**Error codes**
8801
8802For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8803
8804| ID        | Error Message       |
8805| --------------- | --------------- |
8806| 202     | Not System Application. |
8807| 7400101                |  Parameter missing or parameter type incorrect.        |
8808| 7400103                |  Session not config.                                   |
8809
8810**Example**
8811
8812```ts
8813import { BusinessError } from '@kit.BasicServicesKit';
8814
8815function setTimeLapseRecordState(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8816  try {
8817    timeLapsePhotoSession.setTimeLapseRecordState(camera.TimeLapseRecordState.RECORDING);
8818  } catch (error) {
8819    // If the operation fails, error.code is returned and processed.
8820    let err = error as BusinessError;
8821    console.error(`The setTimeLapseRecordState call failed. error code: ${err.code}`);
8822  }
8823}
8824```
8825
8826### getTimeLapsePreviewType<sup>12+</sup>
8827
8828getTimeLapsePreviewType(): TimeLapsePreviewType
8829
8830Obtains the time-lapse preview type.
8831
8832**System API**: This is a system API.
8833
8834**System capability**: SystemCapability.Multimedia.Camera.Core
8835
8836**Return value**
8837
8838| Type       | Description                         |
8839| ---------- | ----------------------------- |
8840| [TimeLapsePreviewType](#timelapsepreviewtype12)    | Preview type. If the operation fails, an error code defined in [CameraErrorCode](js-apis-camera.md#cameraerrorcode) is returned.|
8841
8842**Error codes**
8843
8844For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8845
8846| ID        | Error Message       |
8847| --------------- | --------------- |
8848| 202     | Not System Application. |
8849| 7400103                |  Session not config.                                   |
8850
8851**Example**
8852
8853```ts
8854import { BusinessError } from '@kit.BasicServicesKit';
8855
8856function getTimeLapsePreviewType(timeLapsePhotoSession: camera.TimeLapsePhotoSession): camera.TimeLapsePreviewType {
8857  let type = camera.TimeLapsePreviewType.DARK;
8858  try {
8859    type = timeLapsePhotoSession.getTimeLapsePreviewType();
8860  } catch (error) {
8861    // If the operation fails, error.code is returned and processed.
8862    let err = error as BusinessError;
8863    console.error(`The getTimeLapsePreviewType call failed. error code: ${err.code}`);
8864  }
8865  return type;
8866}
8867```
8868
8869### setTimeLapsePreviewType<sup>12+</sup>
8870
8871setTimeLapsePreviewType(type: TimeLapsePreviewType): void
8872
8873Sets the time-lapse preview type.
8874
8875**System API**: This is a system API.
8876
8877**System capability**: SystemCapability.Multimedia.Camera.Core
8878
8879**Parameters**
8880
8881| Name     | Type                           | Mandatory| Description                   |
8882| -------- | -------------------------------| ---- | ----------------------- |
8883| state   | [TimeLapsePreviewType](#timelapsepreviewtype12)  | Yes  | Preview type.               |
8884
8885**Error codes**
8886
8887For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8888
8889| ID        | Error Message       |
8890| --------------- | --------------- |
8891| 202     | Not System Application. |
8892| 7400101                |  Parameter missing or parameter type incorrect.        |
8893| 7400103                |  Session not config.                                   |
8894
8895**Example**
8896
8897```ts
8898import { BusinessError } from '@kit.BasicServicesKit';
8899
8900function setTimeLapsePreviewType(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8901  try {
8902    timeLapsePhotoSession.setTimeLapsePreviewType(camera.TimeLapsePreviewType.LIGHT);
8903  } catch (error) {
8904    // If the operation fails, error.code is returned and processed.
8905    let err = error as BusinessError;
8906    console.error(`The setTimeLapsePreviewType call failed. error code: ${err.code}`);
8907  }
8908}
8909```
8910
8911## LightPaintingPhotoSession<sup>12+</sup>
8912
8913LightPaintingPhotoSession extends Session, Flash, Focus, Zoom, ColorEffect
8914
8915Implements a light painting photo session, which sets the parameters of the light painting 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).
8916
8917### on('error')<sup>12+</sup>
8918
8919on(type: 'error', callback: ErrorCallback): void
8920
8921Subscribes to **LightPaintingPhotoSession** error events. This API uses an asynchronous callback to return the result.
8922
8923**System API**: This is a system API.
8924
8925**System capability**: SystemCapability.Multimedia.Camera.Core
8926
8927**Parameters**
8928
8929| Name     | Type                                                                       | Mandatory | Description                                                                                                                                                                     |
8930|----------|---------------------------------------------------------------------------|-----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
8931| 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).|
8932| 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).                                                                                                          |
8933
8934**Error codes**
8935
8936For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8937
8938| ID| Error Message                      |
8939|-------|----------------------------|
8940| 202   | Not System Application.    |
8941
8942**Example**
8943
8944```ts
8945import { BusinessError } from '@kit.BasicServicesKit';
8946
8947function callback(err: BusinessError): void {
8948  console.error(`LightPaintingPhotoSession error code: ${err.code}`);
8949}
8950
8951function registerSessionError(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
8952  lightPaintingPhotoSession.on('error', callback);
8953}
8954```
8955
8956### off('error')<sup>12+</sup>
8957
8958off(type: 'error', callback?: ErrorCallback): void
8959
8960Unsubscribes from **LightPaintingPhotoSession** error events.
8961
8962**System API**: This is a system API.
8963
8964**System capability**: SystemCapability.Multimedia.Camera.Core
8965
8966**Parameters**
8967
8968| Name     | Type                                                                       | Mandatory| Description                                                         |
8969|----------|---------------------------------------------------------------------------|----|-------------------------------------------------------------|
8970| type     | string                                                                    | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created.                       |
8971| 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.|
8972
8973**Error codes**
8974
8975For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
8976
8977| ID| Error Message                      |
8978|-------|----------------------------|
8979| 202   | Not System Application.    |
8980
8981**Example**
8982
8983```ts
8984function unregisterSessionError(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
8985  lightPaintingPhotoSession.off('error');
8986}
8987```
8988
8989### on('focusStateChange')<sup>12+</sup>
8990
8991on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
8992
8993Subscribes to focus state change events. This API uses an asynchronous callback to return the result.
8994
8995**System API**: This is a system API.
8996
8997**System capability**: SystemCapability.Multimedia.Camera.Core
8998
8999**Parameters**
9000
9001| Name      | Type                                         | Mandatory| Description                                                                     |
9002|-----------|---------------------------------------------|----|-------------------------------------------------------------------------|
9003| 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.|
9004| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | Yes | Callback used to return the focus state change.                                                       |
9005
9006**Error codes**
9007
9008For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
9009
9010| ID| Error Message                      |
9011|-------|----------------------------|
9012| 202   | Not System Application.    |
9013
9014**Example**
9015
9016```ts
9017import { BusinessError } from '@kit.BasicServicesKit';
9018
9019function callback(err: BusinessError, focusState: camera.FocusState): void {
9020  if (err !== undefined && err.code !== 0) {
9021    console.error(`Callback Error, errorCode: ${err.code}`);
9022    return;
9023  }
9024  console.info(`Focus state: ${focusState}`);
9025}
9026
9027function registerFocusStateChange(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
9028  lightPaintingPhotoSession.on('focusStateChange', callback);
9029}
9030```
9031
9032### off('focusStateChange')<sup>12+</sup>
9033
9034off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
9035
9036Unsubscribes from focus state change events.
9037
9038**System API**: This is a system API.
9039
9040**System capability**: SystemCapability.Multimedia.Camera.Core
9041
9042**Parameters**
9043
9044| Name      | Type                                         | Mandatory| Description                                                          |
9045|-----------|---------------------------------------------|----|--------------------------------------------------------------|
9046| type      | string                                      | Yes | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created.                  |
9047| 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. |
9048
9049**Error codes**
9050
9051For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
9052
9053| ID| Error Message                      |
9054|-------|----------------------------|
9055| 202   | Not System Application.    |
9056
9057**Example**
9058
9059```ts
9060function unregisterFocusStateChange(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
9061  lightPaintingPhotoSession.off('focusStateChange');
9062}
9063```
9064
9065### on('smoothZoomInfoAvailable')<sup>12+</sup>
9066
9067on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
9068
9069Subscribes to smooth zoom state change events. This API uses an asynchronous callback to return the result.
9070
9071**System API**: This is a system API.
9072
9073**System capability**: SystemCapability.Multimedia.Camera.Core
9074
9075**Parameters**
9076
9077| Name    | Type                  | Mandatory| Description                      |
9078| -------- | ----------------------- | ---- | ------------------------ |
9079| type     | string                  | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
9080| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | Yes  | Callback used to return the smooth zoom state change. |
9081
9082**Error codes**
9083
9084For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
9085
9086| ID| Error Message                      |
9087|-------|----------------------------|
9088| 202   | Not System Application.    |
9089
9090**Example**
9091
9092```ts
9093import { BusinessError } from '@kit.BasicServicesKit';
9094
9095function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
9096  if (err !== undefined && err.code !== 0) {
9097    console.error(`Callback Error, errorCode: ${err.code}`);
9098    return;
9099  }
9100  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
9101}
9102
9103function registerSmoothZoomInfo(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
9104  lightPaintingPhotoSession.on('smoothZoomInfoAvailable', callback);
9105}
9106```
9107
9108### off('smoothZoomInfoAvailable')<sup>12+</sup>
9109
9110off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
9111
9112Unsubscribes from smooth zoom state change events.
9113
9114**System API**: This is a system API.
9115
9116**System capability**: SystemCapability.Multimedia.Camera.Core
9117
9118**Parameters**
9119
9120| Name    | Type                                     | Mandatory| Description                      |
9121| -------- | ----------------------------------------- | ---- | ------------------------ |
9122| type     | string              | Yes  | Event type. The value is fixed at **'smoothZoomInfoAvailable'**. The event can be listened for when a session is created.|
9123| 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.|
9124
9125**Error codes**
9126
9127For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
9128
9129| ID| Error Message                      |
9130|-------|----------------------------|
9131| 202   | Not System Application.    |
9132
9133**Example**
9134
9135```ts
9136function unregisterSmoothZoomInfo(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
9137  lightPaintingPhotoSession.off('smoothZoomInfoAvailable');
9138}
9139```
9140
9141### getLightPaintingType<sup>12+</sup>
9142
9143getLightPaintingType(): LightPaintingType
9144
9145Obtains the type of light painting shutter mode in use.
9146
9147**System API**: This is a system API.
9148
9149**System capability**: SystemCapability.Multimedia.Camera.Core
9150
9151**Return value**
9152| Type                                            | Description                   |
9153|------------------------------------------------- | --------------------- |
9154| [LightPaintingType](#lightpaintingtype12) | Type of light painting shutter mode. |
9155
9156**Error codes**
9157
9158For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
9159
9160| ID        | Error Message       |
9161| --------------- | --------------- |
9162| 202                    |  Not System Application.                               |
9163| 7400103                |  Session not config.                                   |
9164
9165**Example**
9166
9167```ts
9168function getLightPaintingType(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): camera.LightPaintingType {
9169  let type: camera.LightPaintingType = lightPaintingPhotoSession.getLightPaintingType();
9170  return type;
9171}
9172```
9173
9174### setLightPaintingType<sup>12+</sup>
9175
9176setLightPaintingType(type: LightPaintingType): void
9177
9178Sets the type of light painting shutter mode.
9179
9180**System API**: This is a system API.
9181
9182**System capability**: SystemCapability.Multimedia.Camera.Core
9183
9184**Return value**
9185| Name     | Type                    | Mandatory| Description                |
9186| -------- | ----------------------- | ---- | ------------------- |
9187| type | [LightPaintingType](#lightpaintingtype12) | Yes  | Type of light painting mode.|
9188
9189**Error codes**
9190
9191For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
9192
9193| ID        | Error Message       |
9194| --------------- | --------------- |
9195| 202                    |  Not System Application.                               |
9196| 7400101                |  Parameter missing or parameter type incorrect.        |
9197| 7400103                |  Session not config.                                   |
9198
9199**Example**
9200
9201```ts
9202import { BusinessError } from '@kit.BasicServicesKit';
9203
9204function setLightPaintingType(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
9205  try {
9206    let type: camera.LightPaintingType = camera.LightPaintingType.TRAFFIC_TRAILS;
9207    lightPaintingPhotoSession.setLightPaintingType(type);
9208  } catch (error) {
9209    // If the operation fails, error.code is returned and processed.
9210    let err = error as BusinessError;
9211    console.error(`The setLightPaintingType call failed. error code: ${err.code}`);
9212  }
9213}
9214```
9215
9216### getSupportedLightPaintingTypes<sup>12+</sup>
9217
9218getSupportedLightPaintingTypes(): Array\<LightPaintingType\>
9219
9220Obtains the supported types of light painting shutter mode.
9221
9222**System API**: This is a system API.
9223
9224**System capability**: SystemCapability.Multimedia.Camera.Core
9225
9226**Return value**
9227| Type                                            | Description                   |
9228|------------------------------------------------- | --------------------- |
9229| Array\<[LightPaintingType](#lightpaintingtype12)\> | Supported types of light painting shutter mode. |
9230
9231**Error codes**
9232
9233For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
9234
9235| ID        | Error Message       |
9236| --------------- | --------------- |
9237| 202                    |  Not System Application.                               |
9238| 7400103                |  Session not config.                                   |
9239
9240**Example**
9241
9242```ts
9243function getSupportedLightPaintingTypes(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): Array<camera.LightPaintingType> {
9244  let types: Array<camera.LightPaintingType> = lightPaintingPhotoSession.getSupportedLightPaintingTypes();
9245  return types
9246}
9247```
9248
9249## ColorReservationType<sup>15+</sup>
9250
9251Enumerates the color reservation types.
9252
9253**System capability**: SystemCapability.Multimedia.Camera.Core
9254
9255| Name    | Value  | Description            |
9256| -------- | ---- | ---------------- |
9257| NONE     | 0    | No color reservation.|
9258| PORTRAIT | 1    | Portrait color reservation.      |
9259
9260## ColorReservationQuery<sup>15+</sup>
9261
9262Provides APIs for querying the color retention type supported by the device.
9263
9264### getSupportedColorReservationTypes<sup>15+</sup>
9265
9266getSupportedColorReservationTypes(): Array\<ColorReservationType\>
9267
9268Obtains the supported color reservation types.
9269
9270**System API**: This is a system API.
9271
9272**System capability**: SystemCapability.Multimedia.Camera.Core
9273
9274**Return value**
9275
9276| Type                                                  | Description                    |
9277| ------------------------------------------------------ | ------------------------ |
9278| Array<[ColorReservationType](#colorreservationtype15)> | Array of color reservation types supported.|
9279
9280**Error codes**
9281
9282For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
9283
9284| ID| Error Message               |
9285| -------- | ----------------------- |
9286| 202      | Not System Application. |
9287| 7400103  | Session not config.     |
9288
9289**Example**
9290
9291```ts
9292import { BusinessError } from '@kit.BasicServicesKit';
9293
9294function getSupportedColorReservationTypes(session: camera.VideoSessionForSys): Array<camera.ColorReservationType> {
9295  let colorReservationTypes: Array<camera.ColorReservationType> = [];
9296  try {
9297    colorReservationTypes = session.getSupportedColorReservationTypes();
9298  } catch (error) {
9299    // If the operation fails, error.code is returned and processed.
9300    let err = error as BusinessError;
9301    console.error(`The getSupportedColorReservationTypes call failed. error code: ${err.code}`);
9302  }
9303  return colorReservationTypes;
9304}
9305```
9306
9307## ColorReservation<sup>15+</sup>
9308
9309ColorReservation extends [ColorReservationQuery](#colorreservationquery15)
9310
9311Provides API for obtaining and setting a color reservation type.
9312
9313### setColorReservation<sup>15+</sup>
9314
9315setColorReservation(type: ColorReservationType): void
9316
9317Sets a color reservation type. Before the setting, call [getSupportedColorReservationTypes](#getsupportedcolorreservationtypes15) to obtain the supported color reservation types.
9318
9319**System API**: This is a system API.
9320
9321**System capability**: SystemCapability.Multimedia.Camera.Core
9322
9323**Parameters**
9324
9325| Name| Type                                           | Mandatory| Description                                                        |
9326| ------ | ----------------------------------------------- | ---- | ------------------------------------------------------------ |
9327| type   | [ColorReservationType](#colorreservationtype15) | Yes  | Color reservation type, which is obtained by calling [getSupportedColorReservationTypes](#getsupportedcolorreservationtypes15).|
9328
9329**Error codes**
9330
9331For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
9332
9333| ID| Error Message                                                    |
9334| -------- | ------------------------------------------------------------ |
9335| 202      | Not System Application.                                      |
9336| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3.Parameter verification failed. |
9337| 7400102  | Operation not allowed.                                       |
9338| 7400103  | Session not config.                                          |
9339| 7400201  | Camera service fatal error.                                  |
9340
9341**Example**
9342
9343```ts
9344import { BusinessError } from '@kit.BasicServicesKit';
9345
9346function setColorReservation(session: camera.VideoSessionForSys, type: camera.ColorReservationType): void {
9347  try {
9348    session.setColorReservation(type);
9349  } catch (error) {
9350    // If the operation fails, error.code is returned and processed.
9351    let err = error as BusinessError;
9352    console.error(`The setColorReservation call failed. error code: ${err.code}`);
9353  }
9354}
9355```
9356
9357### getColorReservation<sup>15+</sup>
9358
9359getColorReservation(): ColorReservationType
9360
9361Obtains the color reservation type in use.
9362
9363**System API**: This is a system API.
9364
9365**System capability**: SystemCapability.Multimedia.Camera.Core
9366
9367**Return value**
9368
9369| Type                                           | Description                    |
9370| ----------------------------------------------- | ------------------------ |
9371| [ColorReservationType](#colorreservationtype15) | Color reservation type.|
9372
9373**Error codes**
9374
9375For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
9376
9377| ID| Error Message               |
9378| -------- | ----------------------- |
9379| 202      | Not System Application. |
9380| 7400103  | Session not config.     |
9381
9382**Example**
9383
9384```ts
9385import { BusinessError } from '@kit.BasicServicesKit';
9386
9387function getColorReservation(session: camera.VideoSessionForSys): camera.ColorReservationType | undefined {
9388  let colorReservation: camera.ColorReservationType | undefined = undefined;
9389  try {
9390    colorReservation = session.getColorReservation();
9391  } catch (error) {
9392    // If the operation fails, error.code is returned and processed.
9393    let err = error as BusinessError;
9394    console.error(`The setColorReservation call failed. error code: ${err.code}`);
9395  }
9396  return colorReservation;
9397}
9398```
9399