• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.multimedia.camera (相机管理)(系统接口)
2
3本模块为开发者提供一套简单且易于理解的相机服务接口,开发者通过调用接口可以开发相机应用。应用通过访问和操作相机硬件,实现基础操作,如预览、拍照和录像;还可以通过接口组合完成更多操作,如控制闪光灯和曝光时间、对焦或调焦等。
4
5> **说明:**
6>
7> - 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8> - 当前页面仅包含本模块的系统接口,其他公开接口参见[@ohos.multimedia.camera (相机管理)](js-apis-camera.md)。
9
10## 导入模块
11
12```ts
13import { camera } from '@kit.CameraKit';
14```
15
16## CameraDevice
17
18相机设备信息。
19
20**系统能力:** SystemCapability.Multimedia.Camera.Core
21
22| 名称           | 类型                               | 只读 | 必填 | 说明        |
23| -------------- | --------------------------------- | ---- | ---- |---------- |
24| hostDeviceName | string                            | 是   | 是   | 远端设备名称。**系统接口:** 此接口为系统接口。 |
25| hostDeviceType | [HostDeviceType](#hostdevicetype) | 是   | 是   | 远端相机设备类型。**系统接口:** 此接口为系统接口。 |
26
27## HostDeviceType
28
29枚举,远端相机设备类型。
30
31**系统接口:** 此接口为系统接口。
32
33**系统能力:** SystemCapability.Multimedia.Camera.Core
34
35| 名称                          | 值       | 说明           |
36| ---------------------------- | ----     | ------------- |
37| UNKNOWN_TYPE                 | 0        | 未知设备类型。      |
38| PHONE                        | 0x0E     | 手机相机。 |
39| TABLET                       | 0x11     | 平板相机。 |
40
41## SceneMode<sup>11+</sup>
42
43枚举,相机支持模式。
44
45**系统能力:** SystemCapability.Multimedia.Camera.Core
46
47| 名称                     | 值        | 说明         |
48| ----------------------- | --------- | ------------ |
49| PORTRAIT_PHOTO       | 3      | 人像拍照模式。**系统接口:** 此接口为系统接口。            |
50| NIGHT_PHOTO        | 4      | 夜景拍照模式。**系统接口:** 此接口为系统接口。             |
51| PROFESSIONAL_PHOTO<sup>12+</sup>        | 5      | 专业拍照模式。**系统接口:** 此接口为系统接口。             |
52| PROFESSIONAL_VIDEO<sup>12+</sup>        | 6      | 专业录像模式。**系统接口:** 此接口为系统接口。             |
53| SLOW_MOTION_VIDEO<sup>12+</sup>        | 7   | 慢动作模式。**系统接口:** 此接口为系统接口。  |
54| HIGH_RESOLUTION_PHOTO<sup>12+</sup>        | 11     | 高像素拍照模式。 **系统接口:** 此接口为系统接口。          |
55| PANORAMA_PHOTO<sup>12+</sup>        | 15     | 全景拍照模式。 **系统接口:** 此接口为系统接口。          |
56| TIME_LAPSE_PHOTO<sup>12+</sup>        | 16     | 延时摄影模式。 **系统接口:** 此接口为系统接口。          |
57
58## SlowMotionStatus<sup>12+</sup>
59
60枚举,慢动作状态。
61
62**系统能力:** SystemCapability.Multimedia.Camera.Core
63
64| 名称             | 值   | 说明            |
65|----------------|-----|---------------|
66| DISABLED       | 0   | 慢动作关闭状态。      |
67| READY          | 1   | 慢动作就绪状态。      |
68| VIDEO_START    | 2   | 慢动作视频开始状态。    |
69| VIDEO_DONE     | 3   | 慢动作视频完成状态。    |
70| FINISHED       | 4   | 慢动作结束状态。      |
71
72## LcdFlashStatus<sup>12+</sup>
73
74lcd闪光灯信息项。
75
76**系统接口:** 此接口为系统接口。
77
78**系统能力:** SystemCapability.Multimedia.Camera.Core
79
80| 名称      | 类型                          | 只读 | 可选  | 说明         |
81| -------- | ----------------------------- |---- |-----| ------------- |
82| isLcdFlashNeeded   | boolean | 是  | 否   | 是否需要lcd闪光灯。      |
83| lcdCompensation     | number                 | 是  | 否   | lcd闪光灯补偿值。       |
84
85## Photo<sup>11+</sup>
86
87全质量图对象。
88
89**系统接口:** 此接口为系统接口。
90
91**系统能力:** SystemCapability.Multimedia.Camera.Core
92
93| 名称   | 类型                            | 只读  | 可选       | 说明 |
94| ------ | ----------------------------- |-----| ---------- | ---------- |
95| raw<sup>12+</sup> | [image.Image](../apis-image-kit/js-apis-image.md#image9)| NA  | 是   | raw图。 |
96
97## ExposureMode
98
99枚举,曝光模式。
100
101**系统接口:** 此接口为系统接口。
102
103**系统能力:** SystemCapability.Multimedia.Camera.Core
104
105| 名称                           | 值   | 说明      |
106| ----------------------------- |-----|---------|
107| EXPOSURE_MODE_MANUAL<sup>12+</sup>          | 3   | 手动曝光模式。 |
108
109## PolicyType<sup>12+</sup>
110
111枚举,策略类型。
112
113**系统接口:** 此接口为系统接口。
114
115**系统能力:** SystemCapability.Multimedia.Camera.Core
116
117| 名称                           | 值   | 说明      |
118| ----------------------------- |-----|---------|
119| PRIVACY<sup>12+</sup>          | 1   | 隐私类型。 |
120
121## LightPaintingType<sup>12+</sup>
122
123枚举,流光快门模式类型。
124
125**系统接口:** 此接口为系统接口。
126
127**系统能力:** SystemCapability.Multimedia.Camera.Core
128
129| 名称                           | 值   | 说明      |
130| ----------------------------- |-----|---------|
131| TRAFFIC_TRAILS         | 0   | 车水马龙。 |
132| STAR_TRAILS          | 1   | 绚丽星轨。 |
133| SILKY_WATER          | 2   | 丝绢流水。 |
134| LIGHT_GRAFFITI          | 3   | 光绘涂鸦。 |
135
136## CameraManager
137
138相机管理器类,使用前需要通过[getCameraManager](js-apis-camera.md#cameragetcameramanager)获取相机管理实例。
139
140### createDepthDataOutput<sup>12+</sup>
141
142createDepthDataOutput(profile: Profile): DepthDataOutput
143
144创建深度输出对象,同步返回结果。
145
146**系统接口:** 此接口为系统接口。
147
148**系统能力:** SystemCapability.Multimedia.Camera.Core
149
150**参数:**
151
152| 参数名     | 类型                                             | 必填 | 说明                              |
153| -------- | ----------------------------------------------- | ---- | ------------------------------- |
154| profile  | [Profile](js-apis-camera.md#profile)                             | 是   | 支持的预览配置信息,通过[getSupportedOutputCapability](js-apis-camera.md#getsupportedoutputcapability11)接口获取。|
155
156**返回值:**
157
158| 类型        | 说明                          |
159| ---------- | ----------------------------- |
160| [DepthDataOutput](#depthdataoutput12)    | DepthDataOutput实例。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
161
162**错误码:**
163
164以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
165
166| 错误码ID         | 错误信息        |
167| --------------- | --------------- |
168| 7400101                |  Parameter missing or parameter type incorrect.               |
169| 7400201                |  Camera service fatal error.               |
170
171**示例:**
172
173```ts
174import { BusinessError } from '@kit.BasicServicesKit';
175
176function createDepthDataOutput(cameraOutputCapability: camera.CameraOutputCapability, cameraManager: camera.CameraManager): camera.DepthDataOutput | undefined {
177  let profile: camera.Profile = cameraOutputCapability.depthProfiles[0];
178  let depthDataOutput: camera.DepthDataOutput | undefined = undefined;
179  try {
180    depthDataOutput = cameraManager.createDepthDataOutput(profile);
181  } catch (error) {
182    // 失败返回错误码error.code并处理
183    let err = error as BusinessError;
184    console.error(`The createDepthDataOutput call failed. error code: ${err.code}`);
185  }
186  return depthDataOutput;
187}
188```
189
190### isCameraMuteSupported
191
192isCameraMuteSupported(): boolean
193
194查询当前设备是否支持禁用相机。
195
196**系统接口:** 此接口为系统接口。
197
198**系统能力:** SystemCapability.Multimedia.Camera.Core
199
200**返回值:**
201
202| 类型        | 说明                          |
203| ---------- | ----------------------------- |
204| boolean    | 返回true表示相机可以被禁用,返回false表示相机不能被禁用。 |
205
206**示例:**
207
208```ts
209function isCameraMuteSupported(cameraManager: camera.CameraManager): boolean {
210  let isMuteSupported: boolean = cameraManager.isCameraMuteSupported();
211  return isMuteSupported;
212}
213```
214
215### muteCamera
216
217muteCamera(mute: boolean): void
218
219禁用相机。
220
221> **说明:**
222>从 API version 10开始支持,从API version 12开始废弃。建议使用[muteCameraPersistent](#mutecamerapersistent12)替代。
223
224**系统接口:** 此接口为系统接口。
225
226**系统能力:** SystemCapability.Multimedia.Camera.Core
227
228**参数:**
229
230| 参数名      | 类型                              | 必填  | 说明        |
231| -------- | --------------------------------- | ---- | ---------- |
232| mute     | boolean                           |  是  |  禁用相机。true为禁用;false为解除禁用。  |
233
234**示例:**
235
236```ts
237function muteCamera(cameraManager: camera.CameraManager): void {
238  let mute: boolean = true;
239  cameraManager.muteCamera(mute);
240}
241```
242
243### muteCameraPersistent<sup>12+</sup>
244
245muteCameraPersistent(mute: boolean, type: PolicyType): void
246
247以持久化的方式禁用相机。
248
249**系统接口:** 此接口为系统接口。
250
251**系统能力:** SystemCapability.Multimedia.Camera.Core
252
253**参数:**
254
255| 参数名      | 类型                          | 必填  | 说明                                         |
256| -------- |-----------------------------| ---- |--------------------------------------------|
257| mute     | boolean                     |  是  | 禁用相机。true为禁用;false为解除禁用。                   |
258| type     | [PolicyType](#policytype12) |  是  | 策略类型。请使用[PolicyType](#policytype12)里面支持的类型 |
259
260**示例:**
261
262```ts
263function muteCameraPersistent(cameraManager: camera.CameraManager): void {
264  let mute: boolean = true;
265  cameraManager.muteCameraPersistent(mute, camera.PolicyType.PRIVACY);
266}
267```
268
269### on('cameraMute')
270
271on(type: 'cameraMute', callback: AsyncCallback\<boolean\>): void
272
273禁用回调,通过注册回调函数获取相机禁用状态变化。使用callback异步回调。
274
275**系统接口:** 此接口为系统接口。
276
277**系统能力:** SystemCapability.Multimedia.Camera.Core
278
279**参数:**
280
281| 参数名     | 类型             | 必填 | 说明       |
282| -------- | --------------- | ---- | --------- |
283| type     | string          | 是   | 监听事件,固定为'cameraMute',系统相机摄像头开关,cameraManager对象获取成功后可监听。系统设置打开或禁用相机会触发该事件并返回状态。 |
284| callback | AsyncCallback\<boolean> | 是   | 回调函数,用于获取禁用状态变化信息,返回true是开启状态,返回false是禁用状态。               |
285
286**示例:**
287
288```ts
289import { BusinessError } from '@kit.BasicServicesKit';
290
291function callback(err: BusinessError, curMuted: boolean): void {
292  if (err !== undefined && err.code !== 0) {
293    console.error(`Callback Error, errorCode: ${err.code}`);
294    return;
295  }
296  let isMuted: boolean = curMuted;
297  console.info(`cameraMute status: ${isMuted}`);
298}
299
300function registerCameraMute(cameraManager: camera.CameraManager): void {
301  cameraManager.on('cameraMute', callback);
302}
303```
304
305### off('cameraMute')
306
307off(type: 'cameraMute', callback?: AsyncCallback\<boolean\>): void
308
309禁用回调,通过注销注册回调函数获取相机禁用状态变化。
310
311**系统接口:** 此接口为系统接口。
312
313**系统能力:** SystemCapability.Multimedia.Camera.Core
314
315**参数:**
316
317| 参数名     | 类型             | 必填 | 说明                                                      |
318| -------- | --------------- | ---- |---------------------------------------------------------|
319| type     | string          | 是   | 监听事件,固定为'cameraMute',系统相机摄像头开关,cameraManager对象获取成功后可监听。 |
320| callback | AsyncCallback\<boolean> | 否   | 回调函数,可选参数,有就是匹配on('cameraMute') callback(callback对象不可是匿名函数)。                  |
321
322**示例:**
323
324```ts
325import { BusinessError } from '@kit.BasicServicesKit';
326
327function callback(err: BusinessError, curMuted: boolean): void {
328  let isMuted: boolean = curMuted;
329}
330
331function unregisterCameraMute(cameraManager: camera.CameraManager): void {
332  cameraManager.off('cameraMute', callback);
333}
334```
335
336### isPrelaunchSupported
337
338isPrelaunchSupported(camera: CameraDevice): boolean
339
340检查指定cameraDevice是否支持预热启动。
341
342**系统接口:** 此接口为系统接口。
343
344**系统能力:** SystemCapability.Multimedia.Camera.Core
345
346**参数:**
347
348| 参数名     | 类型             | 必填 | 说明       |
349| -------- | --------------- | ---- | --------- |
350| camera | [CameraDevice](#cameradevice) | 是 | 相机信息。|
351
352**返回值:**
353
354| 类型 | 说明 |
355| -------- | --------------- |
356| boolean | 返回指定cameraDevice是否支持预热启动。|
357
358**错误码:**
359
360以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
361
362| 错误码ID         | 错误信息        |
363| --------------- | --------------- |
364| 202 | Not System Application. |
365| 7400101 | Parameter missing or parameter type incorrect. |
366
367**示例:**
368
369```ts
370import { common } from '@kit.AbilityKit';
371
372function isPreLaunchSupported(context: common.BaseContext): boolean {
373  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
374  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
375  let isSupported: boolean = false;
376  if (cameras && cameras.length >= 1) {
377    isSupported = cameraManager.isPrelaunchSupported(cameras[0]);
378    console.info(`PreLaunch supported states: ${isSupported}`);
379    return isSupported;
380  }
381  return isSupported;
382}
383```
384
385### setPrelaunchConfig
386
387setPrelaunchConfig(prelaunchConfig: PrelaunchConfig): void
388
389设置预热启动的配置参数。
390
391在调用setPrelaunchConfig接口前,需要先检查设备是否支持预热启动,使用[isPrelaunchSupported](#isprelaunchsupported)判断指定cameraDevice是否支持预热启动。
392
393**系统接口:** 此接口为系统接口。
394
395**需要权限:** ohos.permission.CAMERA
396
397**系统能力:** SystemCapability.Multimedia.Camera.Core
398
399**参数:**
400
401| 参数名     | 类型             | 必填 | 说明       |
402| -------- | --------------- | ---- | --------- |
403| prelaunchConfig | [PrelaunchConfig](#prelaunchconfig) | 是 | 预启动配置参数。|
404
405**错误码:**
406
407以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
408
409| 错误码ID         | 错误信息        |
410| --------------- | --------------- |
411| 202 | Not System Application. |
412| 7400101 | Parameter missing or parameter type incorrect. |
413| 7400102 | Operation not allowed. |
414| 7400201 | Camera service fatal error. |
415
416**示例:**
417
418```ts
419import { common } from '@kit.AbilityKit';
420import { BusinessError } from '@kit.BasicServicesKit';
421
422function setPrelaunchConfig(context: common.BaseContext): void {
423  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
424  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
425  if (cameras && cameras.length >= 1) {
426    let cameraDevice: camera.CameraDevice = cameras[0];
427    if(cameraManager.isPrelaunchSupported(cameraDevice)) {
428      try {
429        cameraManager.setPrelaunchConfig({cameraDevice: cameraDevice});
430      } catch (error) {
431        let err = error as BusinessError;
432        console.error(`setPrelaunchConfig error. Code: ${err.code}, message: ${err.message}`);
433      }
434    }
435  }
436}
437```
438
439### prelaunch
440
441prelaunch(): void
442
443用户点击系统相机图标,拉起相机应用同时调用,下发预热请求,使能相机预热启动。
444
445**系统接口:** 此接口为系统接口。
446
447**系统能力:** SystemCapability.Multimedia.Camera.Core
448
449**示例:**
450
451```ts
452import { common } from '@kit.AbilityKit';
453import { BusinessError } from '@kit.BasicServicesKit';
454
455function preLaunch(context: common.BaseContext): void {
456  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
457  try {
458    cameraManager.prelaunch();
459  } catch (error) {
460    let err = error as BusinessError;
461    console.error(`prelaunch error. Code: ${err.code}, message: ${err.message}`);
462  }
463}
464```
465
466### createDeferredPreviewOutput
467
468createDeferredPreviewOutput(profile: Profile): PreviewOutput
469
470创建延迟预览输出对象,在配流时替代普通的预览输出对象加入数据流。
471
472**系统接口:** 此接口为系统接口。
473
474**系统能力:** SystemCapability.Multimedia.Camera.Core
475
476**参数:**
477
478| 参数名     | 类型             | 必填 | 说明       |
479| -------- | --------------- | ---- | --------- |
480| profile | [Profile](js-apis-camera.md#profile) | 是 | 相机预览流的配置文件。 |
481
482**返回值:**
483
484| 类型 | 说明 |
485| -------- | --------------- |
486| [PreviewOutput](#previewoutput) | 返回预览输出对象。 |
487
488**错误码:**
489
490以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
491
492| 错误码ID         | 错误信息        |
493| --------------- | --------------- |
494| 202         	  |  Not System Application.       |
495| 7400101 	      |  Parameter missing or parameter type incorrect. |
496
497**示例:**
498
499```ts
500import { common } from '@kit.AbilityKit';
501
502function getDeferredPreviewOutput(context: common.BaseContext, previewProfile: camera.Profile): camera.PreviewOutput {
503  const cameraManager: camera.CameraManager = camera.getCameraManager(context);
504  const output: camera.PreviewOutput = cameraManager.createDeferredPreviewOutput(previewProfile);
505  return output;
506}
507```
508
509### preSwitchCamera<sup>11+</sup>
510
511preSwitchCamera(cameraId: string): void
512
513预切换摄像头,提升摄像头启动速度。
514
515**系统接口:** 此接口为系统接口。
516
517**系统能力:** SystemCapability.Multimedia.Camera.Core
518
519**参数:**
520
521| 参数名     | 类型             | 必填 | 说明       |
522| -------- | --------------- | ---- | --------- |
523| cameraId | string | 是 | 相机id。 |
524
525**错误码:**
526
527以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
528
529| 错误码ID   | 错误信息                                           |
530| ------- |------------------------------------------------|
531| 202     | Not System Application.                        |
532| 7400101 | Parameter missing or parameter type incorrect. |
533| 7400201 | Camera service fatal error.                    |
534
535**示例:**
536
537```ts
538import { common } from '@kit.AbilityKit';
539import { BusinessError } from '@kit.BasicServicesKit';
540
541function preSwitch(cameraDevice: camera.CameraDevice, context: common.BaseContext): void {
542  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
543  try {
544    cameraManager.preSwitchCamera(cameraDevice.cameraId);
545  } catch (error) {
546    let err = error as BusinessError;
547    console.error(`prelaunch error. Code: ${err.code}, message: ${err.message}`);
548  }
549}
550```
551
552## CameraOcclusionDetectionResult<sup>12+</sup>
553摄像头模组被遮挡状态。
554
555**系统接口:** 此接口为系统接口。
556
557**系统能力:** SystemCapability.Multimedia.Camera.Core
558
559| 名称                           | 类型                                                | 只读 | 可选 | 说明                |
560| ----------------------------- | --------------------------------------------------- | ---- | ---- |-------------------|
561| isCameraOccluded                 | boolean              |  是  | 否 |遮挡状态。        |
562
563## CameraOutputCapability<sup>12+</sup>
564
565相机输出能力项。
566
567**系统接口:** 此接口为系统接口。
568
569**系统能力:** SystemCapability.Multimedia.Camera.Core
570
571| 名称                           | 类型                                                | 只读 | 可选 | 说明                |
572| ----------------------------- | --------------------------------------------------- | ---- | ---- |-------------------|
573| depthProfiles                 | Array\<[DepthProfile](#depthprofile12)\>              |  是  | 否 | 支持的深度流配置信息集合。        |
574
575## CameraFormat
576
577枚举,输出格式。
578
579**系统接口:** 此接口为系统接口。
580
581**系统能力:** SystemCapability.Multimedia.Camera.Core
582
583| 名称                     | 值        | 说明         |
584| ----------------------- | --------- | ------------ |
585| CAMERA_FORMAT_DEPTH_16<sup>12+</sup> |   3000   | DEPTH_16格式的深度图。      |
586| CAMERA_FORMAT_DEPTH_32<sup>12+</sup> |   3001   | DEPTH_32格式的深度图。      |
587
588## CameraInput
589
590相机设备输入对象。
591
592会话中[Session](js-apis-camera.md#session11)使用的相机信息。
593
594### on('cameraOcclusionDetection')<sup>12+</sup>
595
596on(type: 'cameraOcclusionDetection', callback: AsyncCallback\<CameraOcclusionDetectionResult\>): void
597
598监听CameraInput的遮挡事件,通过注册回调函数获取结果。使用callback异步回调。
599
600**系统能力:** SystemCapability.Multimedia.Camera.Core
601
602**参数:**
603
604| 参数名     | 类型                              | 必填 | 说明                                          |
605| -------- | -------------------------------- | --- | ------------------------------------------- |
606| type     | string                           | 是   | 监听事件,固定为'cameraOcclusionDetection',CameraInput对象创建成功可监听。相机模组遮挡状态发生改变时触发该事件并返回结果。 |
607| callback | AsyncCallback\<[CameraOcclusionDetectionResult](#cameraocclusiondetectionresult12)\> | 是   | 回调函数,用于获取结果。返回遮挡状态。  |
608
609**示例:**
610
611```ts
612import { BusinessError } from '@kit.BasicServicesKit';
613
614function callback(err: BusinessError, CameraOcclusionDetectionResult: camera.CameraOcclusionDetectionResult): void {
615  if (err !== undefined && err.code !== 0) {
616    console.error('cameraOcclusionDetection with errorCode = ' + err.code);
617    return;
618  }
619  console.info(`isCameraOccluded : ${CameraOcclusionDetectionResult.isCameraOccluded}`);
620}
621
622function registerCameraOcclusionDetection(cameraInput: camera.CameraInput): void {
623  cameraInput.on('cameraOcclusionDetection', callback);
624}
625```
626
627### off('cameraOcclusionDetection')<sup>12+</sup>
628
629off(type: 'cameraOcclusionDetection', callback?: AsyncCallback\<CameraOcclusionDetectionResult\>): void
630
631注销CameraInput遮挡监听事件。
632
633**系统能力:** SystemCapability.Multimedia.Camera.Core
634
635**参数:**
636
637| 参数名     | 类型             | 必填 | 说明                                                      |
638| -------- | --------------- | ---- |---------------------------------------------------------|
639| type     | string          | 是   | 监听事件,固定为'cameraOcclusionDetection',CameraInput对象创建成功可监听。 |
640| callback | AsyncCallback\<[CameraOcclusionDetectionResult](#cameraocclusiondetectionresult12)\> | 否   | 回调函数,可选参数,有就是匹配on('cameraOcclusionDetection') callback(callback对象不可是匿名函数)。                  |
641
642**示例:**
643
644```ts
645import { BusinessError } from '@kit.BasicServicesKit';
646
647function callback(err: BusinessError, CameraOcclusionDetectionResult: camera.CameraOcclusionDetectionResult): void {
648  if (err !== undefined && err.code !== 0) {
649    console.error('cameraOcclusionDetection with errorCode = ' + err.code);
650    return;
651  }
652  console.info(`isCameraOccluded : ${CameraOcclusionDetectionResult.isCameraOccluded}`);
653}
654
655function unregisterCameraOcclusionDetection(cameraInput: camera.CameraInput): void {
656  cameraInput.off('cameraOcclusionDetection', callback);
657}
658```
659
660## DepthDataAccuracy<sup>12+</sup>
661
662深度数据的精度。
663
664**系统接口:** 此接口为系统接口。
665
666**系统能力:** SystemCapability.Multimedia.Camera.Core
667
668| 名称      | 类型                          | 只读 | 可选 | 说明            |
669| -------- | ----------------------------- |----- |---| -------------- |
670| DEPTH_DATA_ACCURACY_RELATIVE      | number                        |  是  | 否 | 相对精度,基于视差计算得到的深度图。      |
671| DEPTH_DATA_ACCURACY_ABSOLUTE      | number                        |  是  | 否 | 绝对精度,基于测距计算得到的深度图。      |
672
673## DepthProfile<sup>12+</sup>
674
675深度数据配置信息项,继承[Profile](js-apis-camera.md#profile)。
676
677**系统接口:** 此接口为系统接口。
678
679**系统能力:** SystemCapability.Multimedia.Camera.Core
680
681| 名称                       | 类型                                      | 只读 | 可选 | 说明        |
682| ------------------------- | ----------------------------------------- | --- | ---- |----------- |
683| depthDataAccuracy            | [DepthDataAccuracy](#depthdataaccuracy12)         | 是  |  否  | 深度数据的精度,分为相对精度和绝对精度 |
684
685## DepthDataQualityLevel<sup>12+</sup>
686
687深度数据的质量。
688
689**系统接口:** 此接口为系统接口。
690
691**系统能力:** SystemCapability.Multimedia.Camera.Core
692
693| 名称      | 类型                          | 只读 | 可选 | 说明            |
694| -------- | ----------------------------- |----- |---| -------------- |
695| DEPTH_DATA_QUALITY_BAD     | number            |  是  | 否 | 深度图的质量很差,无法用于虚化等。      |
696| DEPTH_DATA_QUALITY_FAIR      | number          |  是  | 否 | 深度图的质量一般,无法生成高质量的虚化等。      |
697| DEPTH_DATA_QUALITY_GOOD      | number          |  是  | 否 | 深度图的质量较高,可以生成高质量的虚化等。      |
698
699## DepthData<sup>12+</sup>
700
701深度数据对象。
702
703### 属性
704
705**系统接口:** 此接口为系统接口。
706
707**系统能力:** SystemCapability.Multimedia.Camera.Core
708
709| 名称      | 类型                          | 只读 | 可选 | 说明            |
710| -------- | ----------------------------- |----- |---| -------------- |
711| format | [CameraFormat](#cameraformat)   | 是 |  否  | 深度图的格式。 |
712| depthMap | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)    | 是 |  否  | 深度图。 |
713| qualityLevel | [DepthDataQualityLevel](#depthdataqualitylevel12)   | 是 |  否  | 深度图的质量。 |
714| accuracy | [DepthDataAccuracy](#depthdataaccuracy12) | 是 |  否  | 深度图的精度。 |
715
716### release<sup>12+</sup>
717
718release(): void
719
720释放输出资源。
721
722**系统接口:** 此接口为系统接口。
723
724**系统能力:** SystemCapability.Multimedia.Camera.Core
725
726**示例:**
727
728```ts
729function releaseDepthData(depthData: camera.DepthData): void {
730  await depthData.release();
731}
732```
733
734## DepthDataOutput<sup>12+</sup>
735
736深度信息输出类。继承[CameraOutput](js-apis-camera.md#cameraoutput)。
737
738### start<sup>12+</sup>
739
740start(): Promise\<void\>
741
742启动深度信息输出流,通过Promise获取结果。
743
744**系统接口:** 此接口为系统接口。
745
746**系统能力:** SystemCapability.Multimedia.Camera.Core
747
748**返回值:**
749
750| 类型            | 说明                     |
751| -------------- | ----------------------- |
752| Promise\<void\> | 无返回结果的Promise对象。 |
753
754**错误码:**
755
756以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
757
758| 错误码ID         | 错误信息        |
759| --------------- | --------------- |
760| 7400103                |  Session not config.                                   |
761| 7400201                |  Camera service fatal error.                           |
762
763**示例:**
764
765```ts
766import { BusinessError } from '@kit.BasicServicesKit';
767
768function startDepthDataOutput(depthDataOutput: camera.DepthDataOutput): void {
769  depthDataOutput.start().then(() => {
770    console.info('Promise returned to indicate that start method execution success.');
771  }).catch((error: BusinessError) => {
772    console.error(`Failed to depth data output start, error code: ${error.code}.`);
773  });
774}
775```
776
777### stop<sup>12+</sup>
778
779stop(): Promise\<void\>
780
781结束深度信息输出,通过Promise获取结果。
782
783**系统接口:** 此接口为系统接口。
784
785**系统能力:** SystemCapability.Multimedia.Camera.Core
786
787**返回值:**
788
789| 类型            | 说明                     |
790| -------------- | ----------------------- |
791| Promise\<void\> | 无返回结果的Promise对象。 |
792
793**示例:**
794
795```ts
796import { BusinessError } from '@kit.BasicServicesKit';
797
798function stopDepthDataOutput(depthDataOutput: camera.DepthDataOutput): void {
799  depthDataOutput.stop().then(() => {
800    console.info('Promise returned to indicate that stop method execution success.');
801  }).catch((error: BusinessError) => {
802    console.error(`Failed to depth data output stop, error code: ${error.code}.`);
803  });
804}
805```
806
807### on('depthDataAvailable')<sup>12+</sup>
808
809on(type: 'depthDataAvailable', callback: AsyncCallback\<DepthData\>): void
810
811注册监听深度数据上报。使用callback异步回调。
812
813> **说明:**
814>
815> 当前注册监听接口,不支持在on监听的回调方法里,调用off注销回调。
816
817**系统接口:** 此接口为系统接口。
818
819**系统能力:** SystemCapability.Multimedia.Camera.Core
820
821**参数:**
822
823| 参数名     | 类型      | 必填 | 说明                                  |
824| -------- | ---------- | --- | ------------------------------------ |
825| type     | string     | 是   | 监听事件,固定为'depthDataAvailable',depthDataOutput创建成功后可监听。 |
826| callback | AsyncCallback\<[DepthData](#depthdata12)\> | 是   | 回调函数,用于监听深度信息上报。 |
827
828**示例:**
829
830```ts
831import { BusinessError } from '@kit.BasicServicesKit';
832
833function callback(err: BusinessError, depthData: camera.DepthData): void {
834  if (err !== undefined && err.code !== 0) {
835    console.error(`Callback Error, errorCode: ${err.code}`);
836    return;
837  }
838}
839
840function registerDepthDataAvailable(depthDataOutput: camera.DepthDataOutput): void {
841  depthDataOutput.on('depthDataAvailable', callback);
842}
843```
844
845### off('depthDataAvailable')<sup>12+</sup>
846
847off(type: 'depthDataAvailable', callback?: AsyncCallback\<DepthData\>): void
848
849注销监听深度信息上报。
850
851**系统接口:** 此接口为系统接口。
852
853**系统能力:** SystemCapability.Multimedia.Camera.Core
854
855**参数:**
856
857| 参数名      | 类型                    | 必填 | 说明                                       |
858| -------- | ---------------------- | ---- | ------------------------------------------ |
859| type     | string                 | 是   | 监听事件,固定为'depthDataAvailable',depthDataOutput创建成功后可监听。 |
860| callback | AsyncCallback\<[DepthData](#depthdata12)\> | 否   | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。 |
861
862**示例:**
863
864```ts
865import { BusinessError } from '@kit.BasicServicesKit';
866
867function callback(err: BusinessError, depthData: camera.DepthData): void {
868  if (err !== undefined && err.code !== 0) {
869    console.error(`Callback Error, errorCode: ${err.code}`);
870    return;
871  }
872}
873
874function unRegisterDepthDataAvailable(depthDataOutput: camera.DepthDataOutput): void {
875  depthDataOutput.off('depthDataAvailable', callback);
876}
877```
878
879### on('error')<sup>12+</sup>
880
881on(type: 'error', callback: ErrorCallback): void
882
883监听深度信息输出的错误事件,通过注册回调函数获取结果。使用callback异步回调。
884
885> **说明:**
886>
887> 当前注册监听接口,不支持在on监听的回调方法里,调用off注销回调。
888
889**系统接口:** 此接口为系统接口。
890
891**系统能力:** SystemCapability.Multimedia.Camera.Core
892
893**参数:**
894
895| 参数名     | 类型         | 必填 | 说明                       |
896| -------- | --------------| ---- | ------------------------ |
897| type     | string        | 是   | 监听事件,固定为'error',depthDataOutput创建成功可监听。 |
898| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。  |
899
900**示例:**
901
902```ts
903import { BusinessError } from '@kit.BasicServicesKit';
904
905function callback(depthDataOutputError: BusinessError): void {
906  console.error(`Depth data output error code: ${depthDataOutputError.code}`);
907}
908
909function registerDepthDataOutputError(depthDataOutput: camera.DepthDataOutput): void {
910  depthDataOutput.on('error', callback)
911}
912```
913
914### off('error')<sup>12+</sup>
915
916off(type: 'error', callback?: ErrorCallback): void
917
918注销监听深度信息输出的错误事件。
919
920**系统接口:** 此接口为系统接口。
921
922**系统能力:** SystemCapability.Multimedia.Camera.Core
923
924**参数:**
925
926| 参数名     | 类型         | 必填 | 说明                       |
927| -------- | --------------| ---- | ------------------------ |
928| type     | string        | 是   | 监听事件,固定为'error',depthDataOutput创建成功可监听。 |
929| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | 否   | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。 |
930
931**示例:**
932
933```ts
934function unregisterDepthDataOutputError(depthDataOutput: camera.DepthDataOutput): void {
935  depthDataOutput.off('error');
936}
937```
938
939## PrelaunchConfig
940
941相机预启动配置参数。
942
943当前sensor级别预热,待扩展流预热参数。
944
945**系统接口:** 此接口为系统接口。
946
947**系统能力:** SystemCapability.Multimedia.Camera.Core
948
949|            名称                 |                     类型                  |     只读    |     必填     | 说明       |
950| ------------------------------- | ---------------------------------------- | ----------- | ------------ | ---------- |
951| cameraDevice                    | [CameraDevice](#cameradevice)            |      否     |       是      | 相机信息。         |
952| restoreParamType<sup>11+</sup>  | [RestoreParamType](#restoreparamtype11)  |      否     |       否      | 预保存参数类型。    |
953| activeTime<sup>11+</sup>        | number                                   |      否     |       否      | 激活时间,单位min。 |
954| settingParam<sup>11+</sup>      |  [SettingParam](#settingparam11)         |      否     |       否      | 设置参数内容。      |
955
956## RestoreParamType<sup>11+</sup>
957
958预保存参数类型。
959
960**系统接口:** 此接口为系统接口。
961
962**系统能力:** SystemCapability.Multimedia.Camera.Core
963
964| 名称             | 值    | 说明     |
965| ----------------| ----  | ---------|
966| NO_NEED_RESTORE_PARAM           | 0      | 不需要预保存参数类型。     |
967| PRESISTENT_DEFAULT_PARAM    | 1      | 持久化参数类型,指某一时间点后,使用该参数恢复流信息。     |
968| TRANSIENT_ACTIVE_PARAM   | 2      | 临时参数类型,只在关闭相机后一段时间内,使用该参数恢复流信息,优先级高于持久化参数。     |
969
970## SettingParam<sup>11+</sup>
971
972用于预热出图的效果参数。
973
974**系统接口:** 此接口为系统接口。
975
976**系统能力:** SystemCapability.Multimedia.Camera.Core
977
978| 名称             | 类型   |   只读    | 可选  | 说明                                                                                                |
979| --------------- | ------ | --------- |-----|---------------------------------------------------------------------------------------------------|
980| skinSmoothLevel | number |  否       | 否   | 美颜类型光滑信息,从[Beauty.getSupportedBeautyRange](#getsupportedbeautyrange12)获取支持的光滑范围,例如1表示1级光滑。        |
981| faceSlender     | number |  否       | 否   | 美颜类型瘦脸信息,从[Beauty.getSupportedBeautyRange](#getsupportedbeautyrange12)获取支持的瘦脸范围,例如1表示1级瘦脸。        |
982| skinTone        | number |  否       | 否   | 美颜类型肤色信息,从[Beauty.getSupportedBeautyRange](#getsupportedbeautyrange12)获取支持的肤色范围,例如0xBF986C表示一个颜色。 |
983
984## PreviewOutput
985
986预览输出类。继承[CameraOutput](js-apis-camera.md#cameraoutput)。
987
988### addDeferredSurface
989
990addDeferredSurface(surfaceId: string): void
991
992配置延迟预览的Surface,可以在[Session.commitConfig](js-apis-camera.md#commitconfig11-1)配流和[Session.start](js-apis-camera.md#start11-1)启流之后运行。
993
994**系统接口:** 此接口为系统接口。
995
996**系统能力:** SystemCapability.Multimedia.Camera.Core
997
998**参数:**
999
1000| 参数名     | 类型         | 必填 | 说明                       |
1001| -------- | --------------| ---- | ------------------------ |
1002| surfaceId | string | 是 | 从[XComponent](../apis-arkui/arkui-ts/ts-basic-components-xcomponent.md)组件获取的surfaceId。|
1003
1004**错误码:**
1005
1006以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1007
1008| 错误码ID         | 错误信息        |
1009| --------------- | --------------- |
1010| 7400101                |  Parameter missing or parameter type incorrect.        |
1011
1012**示例:**
1013
1014```ts
1015import { common } from '@kit.AbilityKit';
1016
1017async function preview(context: common.BaseContext, cameraDevice: camera.CameraDevice, previewProfile: camera.Profile, photoProfile: camera.Profile, mode: camera.SceneMode, previewSurfaceId: string): Promise<void> {
1018  const cameraManager: camera.CameraManager = camera.getCameraManager(context);
1019  const cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameraDevice);
1020  const previewOutput: camera.PreviewOutput = cameraManager.createDeferredPreviewOutput(previewProfile);
1021  const photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
1022  const session: camera.Session  = cameraManager.createSession(mode);
1023  session.beginConfig();
1024  session.addInput(cameraInput);
1025  session.addOutput(previewOutput);
1026  session.addOutput(photoOutput);
1027  await session.commitConfig();
1028  await session.start();
1029  previewOutput.addDeferredSurface(previewSurfaceId);
1030}
1031```
1032
1033### isSketchSupported<sup>11+</sup>
1034
1035isSketchSupported(): boolean
1036
1037查询是否支持画中画能力。
1038
1039**系统接口:** 此接口为系统接口。
1040
1041**系统能力:** SystemCapability.Multimedia.Camera.Core
1042
1043**返回值:**
1044
1045| 类型            | 说明                     |
1046| -------------- | ----------------------- |
1047| boolean | 返回是否支持画中画。 |
1048
1049**错误码:**
1050
1051以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1052
1053| 错误码ID         | 错误信息                    |
1054| --------------- |-------------------------|
1055| 202             | Not System Application. |
1056
1057**示例:**
1058
1059```ts
1060function isSketchSupported(previewOutput: camera.PreviewOutput): boolean {
1061  try {
1062    let isSupported: boolean = previewOutput.isSketchSupported();
1063    return isSupported;
1064  } catch (error) {
1065    // 失败返回错误码error.code并处理
1066    let err = error as BusinessError;
1067    console.error(`The isSketchSupported call failed. error code: ${err.code}`);
1068  }
1069  return false;
1070}
1071```
1072
1073### getSketchRatio<sup>11+</sup>
1074
1075getSketchRatio(): number
1076
1077获取当前状态下启动画中画的Zoom倍率。
1078
1079**系统接口:** 此接口为系统接口。
1080
1081**系统能力:** SystemCapability.Multimedia.Camera.Core
1082
1083**返回值:**
1084
1085| 类型            | 说明                     |
1086| -------------- | ----------------------- |
1087| number | 当前状态下启动画中画的Zoom倍率。不支持画中画的情况下,该接口返回-1。 |
1088
1089**错误码:**
1090
1091以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1092
1093| 错误码ID         | 错误信息        |
1094| --------------- | --------------- |
1095| 7400103         |  Session not config.                      |
1096| 202             |  Not System Application.                  |
1097
1098**示例:**
1099
1100```ts
1101function getSketchRatio(previewOutput: camera.PreviewOutput): number {
1102  let sketchRatio: number = previewOutput.getSketchRatio();
1103  return sketchRatio;
1104}
1105```
1106
1107### enableSketch<sup>11+</sup>
1108
1109enableSketch(enabled: boolean): void
1110
1111使能画中画。
1112
1113**系统接口:** 此接口为系统接口。
1114
1115**系统能力:** SystemCapability.Multimedia.Camera.Core
1116
1117**参数:**
1118
1119| 参数名     | 类型      | 必填 | 说明                       |
1120|---------|---------| ---- | ------------------------ |
1121| enabled | boolean | 是 | true表明开启画中画流进行预览。|
1122
1123**错误码:**
1124
1125以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1126
1127| 错误码ID     | 错误信息                        |
1128|-----------|-----------------------------|
1129| 202       | Not System Application.     |
1130| 7400102   | Operation not allowed.      |
1131| 7400103   | Session not config.         |
1132| 7400201   | Camera service fatal error. |
1133
1134**示例:**
1135
1136```ts
1137import { BusinessError } from '@kit.BasicServicesKit';
1138
1139function enableSketch(previewOutput: camera.PreviewOutput, session: camera.Session, cameraInput: camera.CameraInput): void {
1140  try {
1141    session.beginConfig();
1142    session.addInput(cameraInput);
1143    session.addOutput(previewOutput);
1144    previewOutput.enableSketch(true);
1145    session.commitConfig();
1146  } catch (error) {
1147    // 失败返回错误码error.code并处理
1148    let err = error as BusinessError;
1149    console.error(`The enableSketch call failed. error code: ${err.code}`);
1150  }
1151}
1152```
1153
1154### attachSketchSurface<sup>11+</sup>
1155
1156attachSketchSurface(surfaceId: string): void
1157
1158添加画中画预览的Surface。
1159
1160**系统接口:** 此接口为系统接口。
1161
1162**系统能力:** SystemCapability.Multimedia.Camera.Core
1163
1164**参数:**
1165
1166| 参数名     | 类型         | 必填 | 说明                       |
1167| -------- | --------------| ---- | ------------------------ |
1168| surfaceId | string | 是 | 从[XComponent](../apis-arkui/arkui-ts/ts-basic-components-xcomponent.md)组件获取的surfaceId。|
1169
1170**错误码:**
1171
1172以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1173
1174| 错误码ID   | 错误信息                                           |
1175|---------|------------------------------------------------|
1176| 202     | Not System Application.                        |
1177| 7400101 | Parameter missing or parameter type incorrect. |
1178| 7400103 | Session not config.                            |
1179| 7400201 | Camera service fatal error.                    |
1180
1181**示例:**
1182
1183```ts
1184import { BusinessError } from '@kit.BasicServicesKit';
1185
1186function attachSketchSurface(previewOutput: camera.PreviewOutput, session: camera.Session, cameraInput: camera.CameraInput, sketchSurfaceId: string): void {
1187  try {
1188    session.beginConfig();
1189    session.addInput(cameraInput);
1190    session.addOutput(previewOutput);
1191    previewOutput.enableSketch(true);
1192    session.commitConfig();
1193    previewOutput.attachSketchSurface(sketchSurfaceId);
1194  } catch (error) {
1195    // 失败返回错误码error.code并处理
1196    let err = error as BusinessError;
1197    console.error(`The attachSketchSurface call failed. error code: ${err.code}`);
1198  }
1199}
1200```
1201
1202### on('sketchStatusChanged')<sup>11+</sup>
1203
1204on(type: 'sketchStatusChanged', callback: AsyncCallback\<SketchStatusData\>): void
1205
1206监听画中画状态信息改变,通过注册回调函数获取SketchStatusData。使用callback异步回调。
1207
1208**系统接口:** 此接口为系统接口。
1209
1210**系统能力:** SystemCapability.Multimedia.Camera.Core
1211
1212**参数:**
1213
1214| 参数名      | 类型                    | 必填 | 说明                                       |
1215| -------- | ---------------------- | ---- | ------------------------------------------ |
1216| type     | string                 | 是   | 监听事件,固定为'sketchStatusChanged',画中画流创建成功后可监听。底层画中画的状态启停以及画中画Zoom值变更会回调该接口。 |
1217| callback | AsyncCallback\<[SketchStatusData](#sketchstatusdata11)\> | 是   | 使用callback的方式获取SketchStatusData。            |
1218
1219**错误码:**
1220
1221以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1222
1223| 错误码ID   | 错误信息                          |
1224|---------|-------------------------------|
1225| 202     | Not System Application.       |
1226
1227**示例:**
1228
1229```ts
1230import { BusinessError } from '@kit.BasicServicesKit';
1231
1232function callback(error: BusinessError, data: camera.SketchStatusData): void {
1233  if (error !== undefined && error.code !== 0) {
1234    console.error(`Callback Error, errorCode: ${error.code}`);
1235    return;
1236  }
1237  console.info(`sketch errorCode is ${error.code}, data is ${JSON.stringify(data)}`);
1238}
1239
1240function registerSketchStatusChanged(previewOutput: camera.PreviewOutput): void {
1241  previewOutput.on('sketchStatusChanged', callback);
1242}
1243```
1244
1245### off('sketchStatusChanged')<sup>11+</sup>
1246
1247off(type: 'sketchStatusChanged', callback?: AsyncCallback\<SketchStatusData\>): void
1248
1249注销监听画中画状态信息改变。
1250
1251**系统接口:** 此接口为系统接口。
1252
1253**系统能力:** SystemCapability.Multimedia.Camera.Core
1254
1255**参数:**
1256
1257| 参数名      | 类型                    | 必填 | 说明                                       |
1258| -------- | ---------------------- | ---- | ------------------------------------------ |
1259| type     | string                 | 是   | 监听事件,固定为'sketchStatusChanged',画中画流创建成功后可监听。 |
1260| callback | AsyncCallback\<[SketchStatusData](#sketchstatusdata11)\> | 否   | 回调函数,可选,有就是匹配on('sketchStatusChanged') callback(callback对象不可是匿名函数)。           |
1261
1262**错误码:**
1263
1264以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1265
1266| 错误码ID   | 错误信息                          |
1267|---------|-------------------------------|
1268| 202     | Not System Application.       |
1269
1270**示例:**
1271
1272```ts
1273function unregisterSketchStatusChanged(previewOutput: camera.PreviewOutput): void {
1274  previewOutput.off('sketchStatusChanged');
1275}
1276```
1277
1278## DeferredDeliveryImageType<sup>11+</sup>
1279
1280枚举,分段式能力类型。即将拍照/录像分为两个阶段,一阶段以较快速度输出图片/视频提供给用户,二阶段完成优化处理,重新输出高质量图片/视频。
1281
1282**系统接口:** 此接口为系统接口。
1283
1284**系统能力:** SystemCapability.Multimedia.Camera.Core
1285
1286| 名称    | 值   | 说明         |
1287| ------- | ---- | ------------ |
1288| NONE    | 0    | 无分段式能力。|
1289| PHOTO   | 1    | 分段式拍照。|
1290| VIDEO   | 2    | 分段式录像。|
1291
1292## DeferredPhotoProxy<sup>11+</sup>
1293
1294类对象,缩略图代理类。
1295
1296### getThumbnail<sup>11+</sup>
1297
1298getThumbnail(): Promise<image.PixelMap>
1299
1300通过缩略图代理类提供的方法,获取缩略图 PixelMap。
1301
1302**系统接口:** 此接口为系统接口。
1303
1304**系统能力:** SystemCapability.Multimedia.Camera.Core
1305
1306**返回值:**
1307
1308| 类型            | 说明                     |
1309| -------------- | ----------------------- |
1310| Promise\<image.PixelMap\> | 缩略图 PixelMap。 |
1311
1312**错误码:**
1313
1314以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1315
1316| 错误码ID         | 错误信息        |
1317| --------------- | --------------- |
1318| 202         	  |  Not System Application.       |
1319
1320**示例:**
1321
1322```ts
1323import { image } from '@kit.ImageKit';
1324
1325function getThumbnail(proxyObj: camera.DeferredPhotoProxy): void {
1326  proxyObj.getThumbnail().then((thumbnail: image.PixelMap) => {
1327    AppStorage.setOrCreate('proxyThumbnail', thumbnail);
1328  });
1329}
1330```
1331
1332### release<sup>11+</sup>
1333
1334release(): Promise\<void\>
1335
1336释放输出资源,通过Promise获取结果。
1337
1338**系统接口:** 此接口为系统接口。
1339
1340**系统能力:** SystemCapability.Multimedia.Camera.Core
1341
1342**返回值:**
1343
1344| 类型            | 说明               |
1345| -------------- |------------------|
1346| Promise\<void\> | 无返回结果的Promise对象。 |
1347
1348**错误码:**
1349
1350以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1351
1352| 错误码ID         | 错误信息        |
1353| --------------- | --------------- |
1354| 202         	  |  Not System Application.       |
1355
1356**示例:**
1357
1358```ts
1359async function releaseDeferredPhotoProxy(proxyObj: camera.DeferredPhotoProxy): Promise<void> {
1360  await proxyObj.release();
1361}
1362```
1363
1364## PhotoOutput
1365
1366拍照会话中使用的输出信息,继承[CameraOutput](js-apis-camera.md#cameraoutput)。
1367
1368### burstCapture<sup>12+</sup>
1369
1370burstCapture(setting: PhotoCaptureSetting): Promise\<void\>
1371
1372开始连续拍照,一般用于拍照模式下,开始后底层持续上图,可以通过[confirmCapture](#confirmcapture11)取消连续拍照。
1373
1374**系统接口:** 此接口为系统接口。
1375
1376**系统能力:** SystemCapability.Multimedia.Camera.Core
1377
1378**参数:**
1379
1380| 参数名  | 类型                                        | 必填 | 说明     |
1381| ------- | ------------------------------------------- | ---- | -------- |
1382| setting | [PhotoCaptureSetting](js-apis-camera.md#photocapturesetting) | 是   | 拍照设置,传入undefined类型数据按默认无参处理。 |
1383
1384**返回值:**
1385
1386| 类型            | 说明                      |
1387| -------------- | ------------------------   |
1388| Promise\<void\> | 无返回结果的Promise对象。 |
1389
1390**错误码:**
1391
1392以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1393
1394| 错误码ID         | 错误信息        |
1395| --------------- | --------------- |
1396| 202         	  |  Not System Application.       |
1397| 7400101         |  Parameter missing or parameter type incorrect.          |
1398| 7400104         |  Session not running.          |
1399| 7400201         |  Camera service fatal error.   |
1400
1401**示例:**
1402
1403```ts
1404import { BusinessError } from '@kit.BasicServicesKit';
1405
1406function burstCapture(photoOutput: camera.PhotoOutput): void {
1407  let captureLocation: camera.Location = {
1408    latitude: 0,
1409    longitude: 0,
1410    altitude: 0
1411  }
1412  let settings: camera.PhotoCaptureSetting = {
1413    quality: camera.QualityLevel.QUALITY_LEVEL_LOW,
1414    rotation: camera.ImageRotation.ROTATION_0,
1415    location: captureLocation,
1416    mirror: false
1417  }
1418  photoOutput.burstCapture(settings).then(() => {
1419    console.info('Promise returned to indicate that photo burstCapture request success.');
1420  }).catch((error: BusinessError) => {
1421    console.error(`Failed to photo output burstCapture, error code: ${error.code}.`);
1422  });
1423}
1424```
1425
1426### confirmCapture<sup>11+</sup>
1427
1428confirmCapture()
1429
1430确认拍照,一般用于夜景模式下,在曝光倒计时过程中如需终止倒计时提前拍照的时候调用。
1431
1432已经调用[burstCapture](#burstcapture12)开始连续拍照后,调用该接口用于结束连续拍照。
1433
1434**系统接口:** 此接口为系统接口。
1435
1436**系统能力:** SystemCapability.Multimedia.Camera.Core
1437
1438**错误码:**
1439
1440以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1441
1442| 错误码ID         | 错误信息        |
1443| --------------- | --------------- |
1444| 202         	  |  Not System Application.       |
1445| 7400104         |  Session not running.          |
1446| 7400201         |  Camera service fatal error.   |
1447
1448**示例:**
1449
1450```ts
1451import { BusinessError } from '@kit.BasicServicesKit';
1452
1453function confirmCapture(photoOutput: camera.PhotoOutput): void {
1454  try {
1455    photoOutput.confirmCapture();
1456  } catch (error) {
1457    let err = error as BusinessError;
1458    console.error(`The confirmCapture call failed. error code: ${err.code}`);
1459  }
1460}
1461```
1462
1463### isDeferredImageDeliverySupported<sup>11+</sup>
1464
1465isDeferredImageDeliverySupported(type: DeferredDeliveryImageType): boolean
1466
1467查询当前模式是否支持相关分段式能力。
1468
1469**系统接口:** 此接口为系统接口。
1470
1471**系统能力:** SystemCapability.Multimedia.Camera.Core
1472
1473**参数:**
1474
1475| 参数名      | 类型               | 必填 | 说明                 |
1476| -------- | -------------------- | ---- | ------------------- |
1477|   type   |  [DeferredDeliveryImageType](#deferreddeliveryimagetype11)  |   是   |   分段式能力类型。    |
1478
1479**返回值:**
1480
1481| 类型            | 说明                    |
1482| -------------- | ----------------------- |
1483| boolean | true: 当前模式支持该类型分段式能力, false: 不支持。 |
1484
1485**错误码:**
1486
1487以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1488
1489| 错误码ID         | 错误信息                                                |
1490| --------------- |-----------------------------------------------------|
1491| 7400101                | Parameter missing or parameter type incorrect.      |
1492| 7400104                | Session not running.                                |
1493| 7400201                | Camera service fatal error.                         |
1494| 202                    | Not System Application.                             |
1495
1496**示例:**
1497
1498```ts
1499function isDeferredImageDeliverySupported(photoOutput: camera.PhotoOutput, type: camera.DeferredDeliveryImageType): boolean {
1500  let res: boolean = false;
1501  res = photoOutput.isDeferredImageDeliverySupported(type);
1502  return res;
1503}
1504```
1505
1506### isDeferredImageDeliveryEnabled<sup>11+</sup>
1507
1508isDeferredImageDeliveryEnabled(type: DeferredDeliveryImageType): boolean
1509
1510查询当前模式是否已开启相关分段式能力。
1511
1512**系统接口:** 此接口为系统接口。
1513
1514**系统能力:** SystemCapability.Multimedia.Camera.Core
1515
1516**参数:**
1517
1518| 参数名      | 类型               | 必填 | 说明                 |
1519| -------- | -------------------- | ---- | ------------------- |
1520|   type   |  [DeferredDeliveryImageType](#deferreddeliveryimagetype11)  |   是   |   分段式能力类型。    |
1521
1522**返回值:**
1523
1524| 类型            | 说明                    |
1525| -------------- | ----------------------- |
1526| boolean | true: 当前模式已开启该类型分段式能力, false: 未开启。 |
1527
1528**错误码:**
1529
1530以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1531
1532| 错误码ID         | 错误信息        |
1533| --------------- | --------------- |
1534| 7400101                |  Parameter missing or parameter type incorrect.        |
1535| 7400104                |  Session not running.                                  |
1536| 7400201                |  Camera service fatal error.                           |
1537| 202                    |  Not System Application.                               |
1538
1539**示例:**
1540
1541```ts
1542function isDeferredImageDeliveryEnabled(photoOutput: camera.PhotoOutput, type: camera.DeferredDeliveryImageType): boolean {
1543  let res: boolean = false;
1544  res = photoOutput.isDeferredImageDeliveryEnabled(type);
1545  return res;
1546}
1547```
1548
1549### deferImageDelivery<sup>11+</sup>
1550
1551deferImageDelivery(type: DeferredDeliveryImageType): void
1552
1553开启相关类型分段式能力。
1554
1555**系统接口:** 此接口为系统接口。
1556
1557**系统能力:** SystemCapability.Multimedia.Camera.Core
1558
1559**参数:**
1560
1561| 参数名      | 类型               | 必填 | 说明                 |
1562| -------- | -------------------- | ---- | ------------------- |
1563|   type   |  [DeferredDeliveryImageType](#deferreddeliveryimagetype11)  |   是   |   分段式能力类型。    |
1564
1565**错误码:**
1566
1567以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1568
1569| 错误码ID         | 错误信息        |
1570| --------------- | --------------- |
1571| 7400101                |  Parameter missing or parameter type incorrect.        |
1572| 7400104                |  Session not running.                                  |
1573| 7400201                |  Camera service fatal error.                           |
1574| 202                    |  Not System Application.                               |
1575
1576**示例:**
1577
1578```ts
1579function deferImageDelivery(photoOutput: camera.PhotoOutput, type: camera.DeferredDeliveryImageType): void {
1580  photoOutput.deferImageDelivery(type);
1581}
1582```
1583
1584### isAutoHighQualityPhotoSupported<sup>12+</sup>
1585
1586isAutoHighQualityPhotoSupported(): boolean
1587
1588判断当前是否支持自动高画质。
1589
1590**系统接口:** 此接口为系统接口。
1591
1592**系统能力:** SystemCapability.Multimedia.Camera.Core
1593
1594**返回值:**
1595
1596| 类型            | 说明                     |
1597| -------------- | ----------------------- |
1598| boolean | 是否支持自动高画质。|
1599
1600**错误码:**
1601
1602以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1603
1604| 错误码ID         | 错误信息        |
1605| --------------- | --------------- |
1606| 202 | Not System Application. |
1607| 7400104                |  Session not running.                                  |
1608| 7400201                |  Camera service fatal error.                           |
1609
1610**示例:**
1611
1612```ts
1613import { BusinessError } from '@kit.BasicServicesKit';
1614
1615function isAutoHighQualityPhotoSupported(photoOutput: camera.PhotoOutput): boolean {
1616  return photoOutput.isAutoHighQualityPhotoSupported();
1617}
1618```
1619
1620### enableAutoHighQualityPhoto<sup>12+</sup>
1621
1622enableAutoHighQualityPhoto(enabled: boolean): void
1623
1624使能拍照自动高画质。设置拍照自动高画质之前,需要调用[isAutoHighQualityPhotoSupported](#isautohighqualityphotosupported12)判断当前是否支持。
1625
1626**系统接口:** 此接口为系统接口。
1627
1628**系统能力:** SystemCapability.Multimedia.Camera.Core
1629
1630**参数:**
1631
1632| 参数名      | 类型               | 必填 | 说明                 |
1633| -------- | -------------------- | ---- | ------------------- |
1634|   enabled   |  boolean  |   是   |   是否使能拍照自动高画质。    |
1635
1636**错误码:**
1637
1638以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1639
1640| 错误码ID         | 错误信息        |
1641| --------------- | --------------- |
1642| 202 | Not System Application. |
1643| 7400101                |  Parameter missing or parameter type incorrect.        |
1644| 7400104                |  Session not running.                                  |
1645| 7400201                |  Camera service fatal error.                           |
1646
1647**示例:**
1648
1649```ts
1650import { BusinessError } from '@kit.BasicServicesKit';
1651
1652function enableAutoHighQualityPhoto(photoOutput: camera.PhotoOutput): void {
1653  return photoOutput.enableAutoHighQualityPhoto(true);
1654}
1655```
1656
1657### on('deferredPhotoProxyAvailable')<sup>11+</sup>
1658
1659on(type: 'deferredPhotoProxyAvailable', callback: AsyncCallback\<DeferredPhotoProxy\>): void
1660
1661注册监听缩略图上报。使用callback异步回调。
1662
1663**系统接口:** 此接口为系统接口。
1664
1665**系统能力:** SystemCapability.Multimedia.Camera.Core
1666
1667**参数:**
1668
1669| 参数名     | 类型      | 必填 | 说明                                  |
1670| -------- | ---------- | --- | ------------------------------------ |
1671| type     | string     | 是   | 监听事件,固定为'deferredPhotoProxyAvailable',photoOutput创建成功后可监听。 |
1672| callback | AsyncCallback\<[DeferredPhotoProxy](#deferredphotoproxy11)\> | 是   | 回调函数,用于获取相关信息。用于监听缩略图上报。|
1673
1674**错误码:**
1675
1676以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1677
1678| 错误码ID         | 错误信息        |
1679| --------------- | --------------- |
1680| 202         	  |  Not System Application.       |
1681
1682**示例:**
1683
1684```ts
1685import { BusinessError } from '@kit.BasicServicesKit';
1686import { image } from '@kit.ImageKit';
1687
1688function callback(err: BusinessError, proxyObj: camera.DeferredPhotoProxy): void {
1689  if (err !== undefined && err.code !== 0) {
1690    console.error(`Callback Error, errorCode: ${err.code}`);
1691    return;
1692  }
1693  proxyObj.getThumbnail().then((thumbnail: image.PixelMap) => {
1694    AppStorage.setOrCreate('proxyThumbnail', thumbnail);
1695  });
1696}
1697
1698function registerPhotoOutputDeferredPhotoProxyAvailable(photoOutput: camera.PhotoOutput): void {
1699  photoOutput.on('deferredPhotoProxyAvailable', callback);
1700}
1701```
1702
1703### off('deferredPhotoProxyAvailable')<sup>11+</sup>
1704
1705off(type: 'deferredPhotoProxyAvailable', callback?: AsyncCallback\<DeferredPhotoProxy\>): void
1706
1707注销监听缩略图上报。
1708
1709**系统接口:** 此接口为系统接口。
1710
1711**系统能力:** SystemCapability.Multimedia.Camera.Core
1712
1713**参数:**
1714
1715| 参数名      | 类型                    | 必填 | 说明                                       |
1716| -------- | ---------------------- | ---- | ------------------------------------------ |
1717| type     | string                 | 是   | 监听事件,固定为'deferredPhotoProxyAvailable',photoOutput创建成功后可监听。 |
1718| callback | AsyncCallback\<[DeferredPhotoProxy](#deferredphotoproxy11)\> | 否   | 回调函数,可选,有就是匹配on('deferredPhotoProxyAvailable') callback(callback对象不可是匿名函数)。            |
1719
1720**错误码:**
1721
1722以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1723
1724| 错误码ID         | 错误信息        |
1725| --------------- | --------------- |
1726| 202         	  |  Not System Application.       |
1727
1728**示例:**
1729
1730```ts
1731import { BusinessError } from '@kit.BasicServicesKit';
1732import { image } from '@kit.ImageKit';
1733
1734function callback(err: BusinessError, proxyObj: camera.DeferredPhotoProxy): void {
1735  proxyObj.getThumbnail().then((thumbnail: image.PixelMap) => {
1736    AppStorage.setOrCreate('proxyThumbnail', thumbnail);
1737  });
1738}
1739
1740function unRegisterPhotoOutputDeferredPhotoProxyAvailable(photoOutput: camera.PhotoOutput): void {
1741  photoOutput.off('deferredPhotoProxyAvailable', callback);
1742}
1743```
1744
1745### isQuickThumbnailSupported
1746
1747isQuickThumbnailSupported(): boolean
1748
1749是否支持输出快速缩略图。
1750
1751在[addOutput](js-apis-camera.md#addoutput11)、[addInput](js-apis-camera.md#addinput11)之后,[commitConfig](js-apis-camera.md#commitconfig11-1)之前生效。
1752
1753**系统接口:** 此接口为系统接口。
1754
1755**系统能力:** SystemCapability.Multimedia.Camera.Core
1756
1757**返回值:**
1758
1759| 类型 | 说明 |
1760| --------- | ------ |
1761| boolean | 返回支持情况,如果返回true表示支持,否则不支持。 |
1762
1763**错误码:**
1764
1765以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1766
1767| 错误码ID         | 错误信息        |
1768| --------------- | --------------- |
1769| 202                	 |  Not System Application.        |
1770| 7400104                |  session is not running.        |
1771
1772**示例:**
1773
1774```ts
1775import { common } from '@kit.AbilityKit';
1776
1777async function isQuickThumbnailSupported(context: common.BaseContext, mode: camera.SceneMode, photoProfile: camera.Profile): Promise<boolean> {
1778  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
1779  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
1780  // 创建CaptureSession实例
1781  let session: camera.Session = cameraManager.createSession(mode);
1782  // 开始配置会话
1783  session.beginConfig();
1784  // 把CameraInput加入到会话
1785  let cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameras[0]);
1786  await cameraInput.open();
1787  session.addInput(cameraInput);
1788  // 把photoOutput加入到会话
1789  let photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
1790  session.addOutput(photoOutput);
1791  let isSupported: boolean = photoOutput.isQuickThumbnailSupported();
1792  return isSupported;
1793}
1794```
1795
1796### enableQuickThumbnail
1797
1798enableQuickThumbnail(enabled: boolean): void
1799
1800启用/禁用快速缩略图。
1801
1802在[addOutput](js-apis-camera.md#addoutput11)、[addInput](js-apis-camera.md#addinput11)之后,[commitConfig](js-apis-camera.md#commitconfig11-1)之前生效。
1803
1804**系统接口:** 此接口为系统接口。
1805
1806**系统能力:** SystemCapability.Multimedia.Camera.Core
1807
1808**参数:**
1809
1810| 参数名     | 类型         | 必填 | 说明                                 |
1811| -------- | ------------- | ---- | ----------------------------------- |
1812| enabled    | boolean       | 是   | true:使能快速缩略图;false:去使能快速缩略图。 |
1813
1814**错误码:**
1815
1816以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1817
1818| 错误码ID         | 错误信息        |
1819| --------------- | --------------- |
1820| 202                	 |  Not System Application.        |
1821| 7400101                |  Parameter missing or parameter type incorrect.        |
1822| 7400104                |  session is not running.        |
1823| 7400201                |  Camera service fatal error.        |
1824
1825**示例:**
1826
1827```ts
1828import { common } from '@kit.AbilityKit';
1829import { BusinessError } from '@kit.BasicServicesKit';
1830
1831async function enableQuickThumbnail(context: common.BaseContext, mode: camera.SceneMode, photoProfile: camera.Profile): Promise<void> {
1832  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
1833  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
1834  // 创建CaptureSession实例
1835  let session: camera.Session = cameraManager.createSession(mode);
1836  // 开始配置会话
1837  session.beginConfig();
1838  // 把CameraInput加入到会话
1839  let cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameras[0]);
1840  await cameraInput.open();
1841  session.addInput(cameraInput);
1842  // 把PhotoOutPut加入到会话
1843  let photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
1844  session.addOutput(photoOutput);
1845  let isSupported: boolean = photoOutput.isQuickThumbnailSupported();
1846  if (!isSupported) {
1847    console.info('Quick Thumbnail is not supported to be turned on.');
1848    return;
1849  }
1850  try {
1851    photoOutput.enableQuickThumbnail(true);
1852  } catch (error) {
1853    let err = error as BusinessError;
1854    console.error(`The enableQuickThumbnail call failed. error code: ${err.code}`);
1855  }
1856}
1857```
1858
1859### on('quickThumbnail')
1860
1861on(type: 'quickThumbnail', callback: AsyncCallback\<image.PixelMap>): void
1862
1863监听快速缩略图输出事件。使用callback异步回调。
1864
1865在enableQuickThumbnail(true)使能快速缩略图之后监听生效。
1866
1867**系统接口:** 此接口为系统接口。
1868
1869**系统能力:** SystemCapability.Multimedia.Camera.Core
1870
1871**参数:**
1872
1873| 参数名     | 类型         | 必填 | 说明                                 |
1874| -------- | ------------- | ---- | ----------------------------------- |
1875| type    | string     | 是   | 监听事件,固定为'quickThumbnail'。 |
1876| callback | AsyncCallback\<[image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)> | 是 | 回调返回PixelMap。 |
1877
1878**示例:**
1879
1880```ts
1881import { common } from '@kit.AbilityKit';
1882import { BusinessError } from '@kit.BasicServicesKit';
1883import { image } from '@kit.ImageKit';
1884
1885function callback(err: BusinessError, pixelMap: image.PixelMap): void {
1886  if (err || pixelMap === undefined) {
1887      console.error('photoOutput on thumbnail failed');
1888      return;
1889  }
1890  // 显示或保存pixelMap
1891  // do something
1892}
1893
1894async function registerQuickThumbnail(context: common.BaseContext, mode: camera.SceneMode, photoProfile: camera.Profile): Promise<void> {
1895  let cameraManager: camera.CameraManager = camera.getCameraManager(context);
1896  let cameras: Array<camera.CameraDevice> = cameraManager.getSupportedCameras();
1897  // 创建CaptureSession实例
1898  let session: camera.Session = cameraManager.createSession(mode);
1899  // 开始配置会话
1900  session.beginConfig();
1901  // 把CameraInput加入到会话
1902  let cameraInput: camera.CameraInput = cameraManager.createCameraInput(cameras[0]);
1903  await cameraInput.open();
1904  session.addInput(cameraInput);
1905  // 把PhotoOutPut加入到会话
1906  let photoOutput: camera.PhotoOutput = cameraManager.createPhotoOutput(photoProfile);
1907  session.addOutput(photoOutput);
1908  let isSupported: boolean = photoOutput.isQuickThumbnailSupported();
1909  if (!isSupported) {
1910    console.info('Quick Thumbnail is not supported to be turned on.');
1911    return;
1912  }
1913  try {
1914    photoOutput.enableQuickThumbnail(true);
1915  } catch (error) {
1916    let err = error as BusinessError;
1917    console.error(`The enableQuickThumbnail call failed. error code: ${err.code}`);
1918  }
1919
1920  photoOutput.on('quickThumbnail', callback);
1921}
1922```
1923
1924### off('quickThumbnail')
1925
1926off(type: 'quickThumbnail', callback?: AsyncCallback\<image.PixelMap>): void
1927
1928注销监听快速缩略图输出事件。
1929
1930**系统接口:** 此接口为系统接口。
1931
1932**系统能力:** SystemCapability.Multimedia.Camera.Core
1933
1934**参数:**
1935
1936| 参数名     | 类型         | 必填 | 说明                                 |
1937| -------- | ------------- | ---- | ----------------------------------- |
1938| type    | string     | 是   | 监听事件,固定为'quickThumbnail'。 |
1939| callback | AsyncCallback\<[image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)> | 否 | 回调函数,可选,有就是匹配on('quickThumbnail') callback(callback对象不可是匿名函数)。 |
1940
1941**示例:**
1942
1943```ts
1944function unregisterQuickThumbnail(photoOutput: camera.PhotoOutput): void {
1945  photoOutput.off('quickThumbnail');
1946}
1947```
1948
1949## VideoOutput
1950
1951录像会话中使用的输出信息,继承[CameraOutput](js-apis-camera.md#cameraoutput)。
1952
1953### isMirrorSupported<sup>12+</sup>
1954
1955isMirrorSupported(): boolean
1956
1957查询当前设备是否支持视频镜像。
1958
1959**系统接口:** 此接口为系统接口。
1960
1961**系统能力:** SystemCapability.Multimedia.Camera.Core
1962
1963**返回值:**
1964
1965| 类型            | 说明                     |
1966| -------------- | ----------------------- |
1967| boolean | 是否支持视频镜像。|
1968
1969**错误码:**
1970
1971以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
1972
1973| 错误码ID         | 错误信息        |
1974| --------------- | --------------- |
1975| 202                |  Not System Application.    |
1976
1977**示例:**
1978
1979```ts
1980import { BusinessError } from '@kit.BasicServicesKit';
1981
1982function isMirrorSupported(videoOutput: camera.VideoOutput): boolean {
1983  return videoOutput.isMirrorSupported();
1984}
1985```
1986
1987### enableMirror<sup>12+</sup>
1988
1989enableMirror(enabled: boolean): void
1990
1991使能视频镜像。使能视频镜像之前,需要调用[isMirrorSupported](#ismirrorsupported12)判断当前是否支持。
1992
1993**系统接口:** 此接口为系统接口。
1994
1995**系统能力:** SystemCapability.Multimedia.Camera.Core
1996
1997**参数:**
1998
1999| 参数名      | 类型               | 必填 | 说明                 |
2000| -------- | -------------------- | ---- | ------------------- |
2001|   enabled   |  boolean  |   是   |   是否使能视频镜像。    |
2002
2003**错误码:**
2004
2005以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2006
2007| 错误码ID         | 错误信息        |
2008| --------------- | --------------- |
2009| 202 | Not System Application. |
2010| 7400101                |  Parameter missing or parameter type incorrect.  |
2011| 7400103                |  Session not config.                             |
2012
2013**示例:**
2014
2015```ts
2016import { BusinessError } from '@kit.BasicServicesKit';
2017
2018function enableMirror(videoOutput: camera.VideoOutput): void {
2019  return videoOutput.enableMirror(true);
2020}
2021```
2022
2023## MetadataOutput
2024
2025metadata流。继承[CameraOutput](js-apis-camera.md#cameraoutput)。
2026
2027### addMetadataObjectTypes<sup>13+</sup>
2028
2029addMetadataObjectTypes(types: Array\<MetadataObjectType\>): void
2030
2031新增需要上报的检测对象类型。
2032
2033**系统能力:** SystemCapability.Multimedia.Camera.Core
2034
2035**参数:**
2036
2037| 参数名                  | 类型                                               | 必填 | 说明                          |
2038| -------------------- | -------------------------------------------------- | --- | ---------------------------- |
2039| metadataObjectTypes  | Array\<[MetadataObjectType](#metadataobjecttype)\>  | 是  | metadata流类型信息,通过getSupportedOutputCapability接口获取。 |
2040
2041**错误码:**
2042
2043以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2044
2045| 错误码ID         | 错误信息        |
2046| --------------- | --------------- |
2047| 202                    |  Not system application.        |
2048| 7400101                |  Parameter missing or parameter type incorrect.        |
2049| 7400103                |  Session not config.                                   |
2050| 7400201                |  Camera service fatal error.                           |
2051
2052**示例:**
2053
2054```ts
2055import { BusinessError } from '@kit.BasicServicesKit';
2056
2057function addMetadataObjectTypes(metadataOutput: camera.MetadataOutput, types: Array<camera.MetadataObjectType>): void {
2058  try {
2059    metadataOutput.addMetadataObjectTypes(types);
2060  } catch (error) {
2061    // 失败返回错误码error.code并处理
2062    let err = error as BusinessError;
2063    console.error(`addMetadataObjectTypes error. error code: ${err.code}`);
2064  }
2065}
2066```
2067
2068### removeMetadataObjectTypes<sup>13+</sup>
2069
2070removeMetadataObjectTypes(types: Array\<MetadataObjectType\>): void
2071
2072删除需要上报的检测对象类型。
2073
2074**系统能力:** SystemCapability.Multimedia.Camera.Core
2075
2076**参数:**
2077
2078| 参数名                  | 类型                                               | 必填 | 说明                          |
2079| -------------------- | -------------------------------------------------- | --- | ---------------------------- |
2080| metadataObjectTypes  | Array\<[MetadataObjectType](#metadataobjecttype)\>  | 是  | metadata流类型信息,通过getSupportedOutputCapability接口获取。 |
2081
2082**错误码:**
2083
2084以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2085
2086| 错误码ID         | 错误信息        |
2087| --------------- | --------------- |
2088| 202                    |  Not system application.        |
2089| 7400101                |  Parameter missing or parameter type incorrect.                                   |
2090| 7400103                |  Session not config.                                   |
2091| 7400201                |  Camera service fatal error.                           |
2092
2093**示例:**
2094
2095```ts
2096import { BusinessError } from '@kit.BasicServicesKit';
2097
2098function removeMetadataObjectTypes(metadataOutput: camera.MetadataOutput, types: Array<camera.MetadataObjectType>): void {
2099  try {
2100    metadataOutput.removeMetadataObjectTypes(types);
2101  } catch (error) {
2102    // 失败返回错误码error.code并处理
2103    let err = error as BusinessError;
2104    console.error(`removeMetadataObjectTypes error. error code: ${err.code}`);
2105  }
2106}
2107```
2108
2109## MetadataObjectType
2110
2111枚举,metadata元数据检测类型。
2112
2113**系统能力:** SystemCapability.Multimedia.Camera.Core
2114
2115| 名称                       | 值   | 说明              |
2116| -------------------------- | ---- | ----------------- |
2117| HUMAN_BODY<sup>13+</sup>                 | 1    | 用于检测人体的metadata类型。 |
2118| CAT_FACE<sup>13+</sup>                   | 2    | 用于检测猫脸的metadata类型。 |
2119| CAT_BODY<sup>13+</sup>                   | 3    | 用于检测猫的身体的metadata类型。 |
2120| DOG_FACE<sup>13+</sup>                   | 4    | 用于检测狗脸的metadata类型。 |
2121| DOG_BODY<sup>13+</sup>                   | 5    | 用于检测狗的身体的metadata类型。 |
2122| SALIENT_DETECTION<sup>13+</sup>          | 6    | 用于显著性检测。 |
2123
2124## Emotion<sup>13+</sup>
2125枚举,人脸检测信息中的情绪类型。
2126
2127**系统能力:** SystemCapability.Multimedia.Camera.Core
2128
2129| 名称                       | 值   | 说明              |
2130| -------------------------- | ---- | ----------------- |
2131| NEUTRAL                 | 0    | 平静。 |
2132| SADNESS                   | 1    | 悲伤。 |
2133| SMILE                   | 2    | 微笑。 |
2134| SURPRISE                   | 3    | 惊讶。 |
2135
2136## MetadataObject
2137
2138相机检测元数据信息的基础类型,[CameraInput](#camerainput)相机信息中的数据来源,通过metadataOutput.on('metadataObjectsAvailable')接口获取。
2139
2140**系统能力:** SystemCapability.Multimedia.Camera.Core
2141
2142| 名称         | 类型                                        | 只读 | 可选 |说明                |
2143| -----------  | ------------------------------------------- | ---- | ---- | ----------------- |
2144| objectId<sup>13+</sup>     | number                                      |  是  |  否  | metadataObject Id序号。|
2145| confidence<sup>13+</sup>   | number                                      |  是  |  否  | 检测置信度,取值范围[0,1]。|
2146
2147## MetadataFaceObject<sup>13+</sup>
2148
2149相机检测到的人脸元数据信息,继承自[MetadataObject](#metadataobject),[CameraInput](#camerainput)相机信息中的数据来源,通过metadataOutput.on('metadataObjectsAvailable')接口获取。
2150
2151**系统能力:** SystemCapability.Multimedia.Camera.Core
2152
2153| 名称                    | 类型                              | 只读 | 可选 |说明                |
2154| ---------------------- | --------------------------------- | ---- | ---- | --------------------- |
2155| leftEyeBoundingBox     | [Rect](js-apis-camera.md#rect)                             |  是  |  否  | 左眼区域框|
2156| rightEyeBoundingBox    | [Rect](js-apis-camera.md#rect)                            |  是  |  否  | 右眼区域框。|
2157| emotion                | [Emotion](#emotion13)             |  是  |  否  | 检测到的情绪类型。|
2158| emotionConfidence      | number                            |  是  |  否  | 情绪检测置信度,取值范围[0,1]。|
2159| pitchAngle             | number                            |  是  |  否  | 俯仰角度,取值范围[-90, 90],以向下为正。|
2160| yawAngle               | number                            |  是  |  否  | 左右旋转角度,取值范围[-90, 90],以向右为正。|
2161| rollAngle              | number                            |  是  |  否  | 平面内旋转角度,取值范围[-180, 180],以顺时针方向为正。|
2162
2163## MetadataHumanBodyObject<sup>13+</sup>
2164
2165相机检测到的人体元数据信息,继承自[MetadataObject](#metadataobject),[CameraInput](#camerainput)相机信息中的数据来源,通过metadataOutput.on('metadataObjectsAvailable')接口获取。
2166
2167**系统能力:** SystemCapability.Multimedia.Camera.Core
2168
2169## MetadataCatFaceObject<sup>13+</sup>
2170
2171相机检测到的猫脸元数据信息,继承自[MetadataObject](#metadataobject),[CameraInput](#camerainput)相机信息中的数据来源,通过metadataOutput.on('metadataObjectsAvailable')接口获取。
2172
2173**系统能力:** SystemCapability.Multimedia.Camera.Core
2174
2175| 名称                    | 类型                              | 只读 | 可选 |说明                |
2176| ---------------------- | --------------------------------- | ---- | ---- | --------------------- |
2177| leftEyeBoundingBox     | [Rect](js-apis-camera.md#rect)                              |  是  |  否  | 左眼区域框。|
2178| rightEyeBoundingBox    | [Rect](js-apis-camera.md#rect)                              |  是  |  否  | 右眼区域框。|
2179
2180## MetadataCatBodyObject<sup>13+</sup>
2181
2182相机检测到的猫的身体元数据信息,继承自[MetadataObject](#metadataobject),[CameraInput](#camerainput)相机信息中的数据来源,通过metadataOutput.on('metadataObjectsAvailable')接口获取。
2183
2184**系统能力:** SystemCapability.Multimedia.Camera.Core
2185
2186## MetadataDogFaceObject<sup>13+</sup>
2187
2188相机检测到的狗脸元数据信息,继承自[MetadataObject](#metadataobject),[CameraInput](#camerainput)相机信息中的数据来源,通过metadataOutput.on('metadataObjectsAvailable')接口获取。
2189
2190**系统能力:** SystemCapability.Multimedia.Camera.Core
2191
2192| 名称                    | 类型                              | 只读 | 可选 |说明                |
2193| ---------------------- | --------------------------------- | ---- | ---- | --------------------- |
2194| leftEyeBoundingBox     | [Rect](js-apis-camera.md#rect)                              |  是  |  否  | 左眼区域框。|
2195| rightEyeBoundingBox    | [Rect](js-apis-camera.md#rect)                              |  是  |  否  | 右眼区域框。|
2196
2197## MetadataDogBodyObject<sup>13+</sup>
2198
2199相机检测到的狗的身体元数据信息,继承自[MetadataObject](#metadataobject),[CameraInput](#camerainput)相机信息中的数据来源,通过metadataOutput.on('metadataObjectsAvailable')接口获取。
2200
2201**系统能力:** SystemCapability.Multimedia.Camera.Core
2202
2203## MetadataSalientDetectionObject<sup>13+</sup>
2204
2205相机检测到的显著性元数据信息,继承自[MetadataObject](#metadataobject),[CameraInput](#camerainput)相机信息中的数据来源,通过metadataOutput.on('metadataObjectsAvailable')接口获取。
2206
2207**系统能力:** SystemCapability.Multimedia.Camera.Core
2208
2209## PortraitEffect
2210
2211人像效果类型。
2212
2213**系统接口:** 此接口为系统接口。
2214
2215**系统能力:** SystemCapability.Multimedia.Camera.Core
2216
2217| 名称             | 值    | 说明     |
2218| ----------------| ----  | ---------|
2219| OFF             | 0      | 关闭。    |
2220| CIRCLES         | 1      | 圆形。    |
2221| HEART<sup>11+</sup>           | 2      | 心形。    |
2222| ROTATED<sup>11+</sup>         | 3      | 旋焦。    |
2223| STUDIO<sup>11+</sup>          | 4      | 影棚光。  |
2224| THEATER<sup>11+</sup>         | 5      | 剧场光。  |
2225
2226## BeautyQuery<sup>12+</sup>
2227
2228提供了获取和设置美颜效果的方法。
2229
2230### getSupportedBeautyTypes<sup>12+</sup>
2231
2232getSupportedBeautyTypes(): Array\<BeautyType\>
2233
2234获取当前支持的美颜效果列表。
2235
2236**系统接口:** 此接口为系统接口。
2237
2238**系统能力:** SystemCapability.Multimedia.Camera.Core
2239
2240**返回值:**
2241
2242| 类型                | 说明                                                  |
2243| ----------          | -----------------------------                         |
2244|  Array\<[BeautyType](#beautytype)\>| 返回当前支持的美颜效果列表。                             |
2245
2246**错误码:**
2247
2248以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2249
2250| 错误码ID         | 错误信息        |
2251| --------------- | --------------- |
2252| 202                |  Not System Application.                                   |
2253| 7400103                |  Session not config.                                   |
2254
2255**示例:**
2256
2257```ts
2258function getSupportedBeautyTypes(portraitPhotoSession: camera.PortraitPhotoSession): Array<camera.BeautyType> {
2259  let beautyTypes: Array<camera.BeautyType> = portraitPhotoSession.getSupportedBeautyTypes();
2260  return beautyTypes;
2261}
2262```
2263
2264### getSupportedBeautyRange<sup>12+</sup>
2265
2266getSupportedBeautyRange(type: BeautyType): Array\<number\>
2267
2268获取指定美颜效果的范围值。在不同设备返回的美颜强度有所不同,下表仅做示例。
2269
2270| 传入参数           | 示例返回值    | 返回值说明     |
2271| ----------------| ----  | ---------|
2272| AUTO           | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]     |美颜类型为自动时支持的美颜强度,0表明关闭美颜,其余正值表明自动的美颜强度。    |
2273| SKIN_SMOOTH    | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]     | 美颜类型为光滑时支持的美颜强度,0表明关闭光滑,其余正值表明光滑的美颜强度。    |
2274| FACE_SLENDER   | [0, 1, 2, 3, 4, 5]      | 美颜类型为瘦脸时支持的美颜强度,0表明关闭瘦脸,其余正值表明瘦脸的美颜强度。   |
2275| SKIN_TONE      | [-1, 16242611]      | 美颜类型为美肤时支持的美颜强度,-1表明关闭美肤,其余非负值为使用RGB表示的美肤美颜强度,<br> 16242611转化为16进制为0xF7D7B3,F7为R通道值,D7为G通道值,B3位B通道值。    |
2276
2277**系统接口:** 此接口为系统接口。
2278
2279**系统能力:** SystemCapability.Multimedia.Camera.Core
2280
2281**参数:**
2282
2283| 参数名      | 类型                    | 必填 | 说明       |
2284| -------- | --------------------------| ---- | ----------|
2285| type     | [BeautyType](#beautytype) | 是   | 美颜类型。   |
2286
2287**返回值:**
2288
2289| 类型        | 说明                          |
2290| ---------- | ----------------------------- |
2291|  Array\<number\>     | 当前美颜类型所支持的美颜强度。 |
2292
2293**错误码:**
2294
2295以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2296
2297| 错误码ID         | 错误信息        |
2298| --------------- | --------------- |
2299| 202                |  Not System Application.                                   |
2300| 7400103                |  Session not config.                                   |
2301
2302**示例:**
2303
2304```ts
2305function getSupportedBeautyRange(portraitPhotoSession: camera.PortraitPhotoSession): Array<number> {
2306  let beautyTypes: Array<camera.BeautyType> = portraitPhotoSession.getSupportedBeautyTypes();
2307  if (beautyTypes === undefined || beautyTypes.length <= 0) {
2308    return [];
2309  }
2310  let beautyLevels: Array<number> = portraitPhotoSession.getSupportedBeautyRange(beautyTypes[0]);
2311  return beautyLevels;
2312}
2313```
2314
2315## BeautyType
2316
2317美颜类型。
2318
2319**系统接口:** 此接口为系统接口。
2320
2321**系统能力:** SystemCapability.Multimedia.Camera.Core
2322
2323| 名称             | 值    | 说明     |
2324| ----------------| ----  | ---------|
2325| AUTO           | 0      | 自动。     |
2326| SKIN_SMOOTH    | 1      | 光滑。     |
2327| FACE_SLENDER   | 2      | 瘦脸。     |
2328| SKIN_TONE      | 3      | 肤色。     |
2329
2330## ManualExposureQuery<sup>12+</sup>
2331
2332此接口提供了查询设备对手动曝光范围支持的功能。
2333
2334### getSupportedExposureRange<sup>12+</sup>
2335
2336getSupportedExposureRange(): Array\<number\>
2337
2338获取当前支持的手动曝光时长,单位ms。
2339
2340**系统接口:** 此接口为系统接口。
2341
2342**系统能力:** SystemCapability.Multimedia.Camera.Core
2343
2344**返回值:**
2345
2346| 类型                | 说明                                                  |
2347| ----------          | -----------------------------                         |
2348|  Array\<number\>| 返回当前支持的手动曝光时长,单位ms。                             |
2349
2350**错误码:**
2351
2352以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2353
2354| 错误码ID         | 错误信息        |
2355| --------------- | --------------- |
2356| 202                |  Not System Application.  |
2357| 7400101            |  Parameter missing or parameter type incorrect.  |
2358| 7400103            |  Session not config, only throw in session usage.  |
2359
2360 **示例:**
2361
2362```ts
2363function getSupportedExposureRange(nightPhotoSession: camera.NightPhotoSession): Array<number> {
2364  let exposureRange: Array<number> = nightPhotoSession.getSupportedExposureRange();
2365  return exposureRange;
2366}
2367```
2368
2369## ManualExposure<sup>11+</sup>
2370
2371ManualExposure extends [ManualExposureQuery](#manualexposurequery12)
2372
2373提供了获取和设置曝光值的功能。
2374
2375### getExposure<sup>11+</sup>
2376
2377getExposure(): number
2378
2379查询当前已设置的手动曝光时长,单位为ms。
2380
2381**系统接口:** 此接口为系统接口。
2382
2383**系统能力:** SystemCapability.Multimedia.Camera.Core
2384
2385**返回值:**
2386| 参数名      | 类型                                              | 必填 | 说明                    |
2387| -------- | ------------------------------------------------- | ---- | --------------------- |
2388| value     | number | 是   | 手动曝光时长,单位为ms。  |
2389
2390**错误码:**
2391
2392以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2393
2394| 错误码ID         | 错误信息        |
2395| --------------- | --------------- |
2396| 202                    |  Not System Application.                               |
2397| 7400101                |  Parameter missing or parameter type incorrect.        |
2398| 7400103                |  Session not config.                                   |
2399
2400**示例:**
2401
2402```ts
2403function getExposure(nightPhotoSession: camera.NightPhotoSession): number | undefined {
2404  let exposureRange: Array<number> = nightPhotoSession.getSupportedExposureRange();
2405  if (exposureRange === undefined || exposureRange.length <= 0) {
2406    return undefined;
2407  }
2408  let exposure: number = nightPhotoSession.getExposure();
2409  return exposure;
2410}
2411```
2412
2413### setExposure<sup>11+</sup>
2414
2415setExposure(exposure: number): void
2416
2417设置手动曝光时长。[getSupportedExposureRange](#getsupportedexposurerange12)获取得到支持的手动曝光时长列表选取用户所需的时长下发,单位ms。
2418
2419**系统接口:** 此接口为系统接口。
2420
2421**系统能力:** SystemCapability.Multimedia.Camera.Core
2422
2423**参数:**
2424
2425| 参数名      | 类型                    | 必填 | 说明                                                                      |
2426| -------- | --------------------------| ---- |-------------------------------------------------------------------------|
2427| value    | number                    | 是   | 手动曝光时长,通过[getSupportedExposureRange](#getsupportedexposurerange12)接口获取。 |
2428
2429 **错误码:**
2430
2431| 错误码ID         | 错误信息        |
2432| --------------- | --------------- |
2433| 202                	 |  Not System Application.  |
2434| 7400102                |  Operation not allowed.   |
2435| 7400103                |  Session not config.      |
2436
2437```ts
2438function setExposure(nightPhotoSession: camera.NightPhotoSession): void {
2439  let exposureRange: Array<number> = nightPhotoSession.getSupportedExposureRange();
2440  if (exposureRange === undefined || exposureRange.length <= 0) {
2441    return;
2442  }
2443  nightPhotoSession.setExposure(exposureRange[0]);
2444}
2445```
2446
2447## MacroQuery<sup>12+</sup>
2448
2449提供用于查询设备是否支持相机微距拍摄的方法。
2450
2451### isMacroSupported<sup>12+</sup>
2452
2453isMacroSupported(): boolean
2454
2455检测当前状态下是否支持微距能力,需要在CaptureSession调用[commitConfig](js-apis-camera.md#commitconfig11-1)之后进行调用。
2456
2457**系统接口:** 此接口为系统接口。
2458
2459**系统能力:** SystemCapability.Multimedia.Camera.Core
2460
2461**返回值:**
2462
2463| 类型        | 说明                          |
2464| ---------- | ----------------------------- |
2465|   boolean  | 返回是否支持微距能力。 |
2466
2467**错误码:**
2468
2469以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2470
2471| 错误码ID   | 错误信息                     |
2472|---------|--------------------------|
2473| 202     | Not System Application.  |
2474
2475**示例:**
2476
2477```ts
2478function isMacroSupported(photoSession: camera.PhotoSessionForSys): boolean {
2479  let isSupported: boolean = photoSession.isMacroSupported();
2480  return isSupported;
2481}
2482```
2483
2484## Macro<sup>11+</sup>
2485
2486Macro extends [MacroQuery](#macroquery12)
2487
2488提供了使能微距能力的接口。
2489
2490### enableMacro<sup>11+</sup>
2491
2492enableMacro(enabled: boolean): void
2493
2494使能当前的微距能力,需要在支持微距能力的情况下进行调用。
2495
2496**系统接口:** 此接口为系统接口。
2497
2498**系统能力:** SystemCapability.Multimedia.Camera.Core
2499
2500**参数:**
2501
2502| 参数名     | 类型                   | 必填 | 说明                  |
2503| -------- | -------------------- | ---- | -------------------- |
2504| enabled | boolean | 是   | true:开启微距能力,false:关闭微距能力。 |
2505
2506**错误码:**
2507
2508以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2509
2510| 错误码ID    | 错误信息                     |
2511|----------|--------------------------|
2512| 202      | Not System Application.  |
2513| 7400102  | Operation not allowed.   |
2514| 7400103  | Session not config.      |
2515
2516**示例:**
2517
2518```ts
2519function enableMacro(photoSession: camera.PhotoSessionForSys): void {
2520  let isSupported: boolean = photoSession.isMacroSupported();
2521  if (isSupported) {
2522    photoSession.enableMacro(true);
2523  }
2524}
2525```
2526
2527## TripodStatus<sup>13+</sup>
2528
2529枚举,脚架状态枚举。
2530
2531**系统能力:** SystemCapability.Multimedia.Camera.Core
2532
2533| 名称       | 值   | 说明                                  |
2534|----------|-----|-------------------------------------|
2535| INVALID  | 0   | 错误状态/默认未检测到脚架状态。**系统接口:** 此接口为系统接口。 |
2536| ACTIVE   | 1   | 脚架活动状态。**系统接口:** 此接口为系统接口。          |
2537| ENTERING | 2   | 进入脚架稳定状态。**系统接口:** 此接口为系统接口。        |
2538| EXITING  | 3   | 退出脚架稳定状态。**系统接口:** 此接口为系统接口。          |
2539
2540
2541## SceneFeatureType<sup>12+</sup>
2542
2543枚举,场景特性枚举。
2544
2545**系统能力:** SystemCapability.Multimedia.Camera.Core
2546
2547| 名称                            | 值   | 说明                        |
2548|-------------------------------|-----|---------------------------|
2549| MOON_CAPTURE_BOOST            | 0   | 月亮场景。**系统接口:** 此接口为系统接口。  |
2550| TRIPOD_DETECTION<sup>13+</sup> | 1   | 使用脚架拍摄的场景。**系统接口:** 此接口为系统接口。  |
2551| LOW_LIGHT_BOOST<sup>13+</sup> | 1   | 长曝光场景。**系统接口:** 此接口为系统接口。 |
2552
2553## SceneFeatureDetectionResult<sup>12+</sup>
2554
2555场景检测结果信息。
2556
2557**系统能力:** SystemCapability.Multimedia.Camera.Core
2558
2559| 名称     | 类型        |   只读   |   必填   | 说明       |
2560| -------- | ---------- | -------- | -------- | ---------- |
2561| featureType |   [SceneFeatureType](#scenefeaturetype12)   |   是     |    是    | 特性类型。 |
2562| detected |   boolean   |   是     |    是    | 检测结果。true为检测到指定特性场景。 |
2563
2564## TripodDetectionResult<sup>13+</sup>
2565
2566TripodDetectionResult extends [SceneFeatureDetectionResult](#scenefeaturedetectionresult12)
2567
2568脚架检测信息。
2569
2570**系统能力:** SystemCapability.Multimedia.Camera.Core
2571
2572| 名称     | 类型                              |   只读   |   必填   | 说明      |
2573| -------- |---------------------------------| -------- | -------- |---------|
2574| tripodStatus | [TripodStatus](#tripodstatus13) |   是     |    是    | 脚架状态信息。 |
2575
2576## SceneDetection<sup>12+</sup>
2577
2578场景检测能力。
2579
2580### isSceneFeatureSupported<sup>12+</sup>
2581
2582isSceneFeatureSupported(type: SceneFeatureType): boolean
2583
2584查询是否支持指定特性。
2585
2586**系统接口:** 此接口为系统接口。
2587
2588**系统能力:** SystemCapability.Multimedia.Camera.Core
2589
2590**参数:**
2591
2592| 参数名   | 类型                                        | 必填  | 说明          |
2593|-------|-------------------------------------------|-----|-------------|
2594| type  | [SceneFeatureType](#scenefeaturetype12)   | 是   | 指定对应的场景特性。  |
2595
2596**返回值:**
2597
2598| 类型        | 说明           |
2599|-----------|--------------|
2600| boolean   | 返回是否支持指定特性。  |
2601
2602**错误码:**
2603
2604以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2605
2606| 错误码ID   | 错误信息                                           |
2607|---------|------------------------------------------------|
2608| 202     | Not System Application.                        |
2609| 7400101 | Parameter missing or parameter type incorrect. |
2610
2611**示例:**
2612
2613```ts
2614function isSceneFeatureSupported(photoSession: camera.PhotoSession, featureType: camera.SceneFeatureType): boolean {
2615  let isSupported: boolean = photoSession.isSceneFeatureSupported(featureType);
2616  return isSupported;
2617}
2618```
2619
2620### enableSceneFeature<sup>12+</sup>
2621
2622enableSceneFeature(type: SceneFeatureType, enabled: boolean): void
2623
2624使能指定特性,该接口应当在收到对应场景检测回调结果[SceneFeatureDetectionResult](#scenefeaturedetectionresult12)之后调用。
2625
2626**系统接口:** 此接口为系统接口。
2627
2628**系统能力:** SystemCapability.Multimedia.Camera.Core
2629
2630**参数:**
2631
2632| 参数名     | 类型                                        | 必填  | 说明                          |
2633|---------|-------------------------------------------|-----|-----------------------------|
2634| type    | [SceneFeatureType](#scenefeaturetype12)   | 是   | 指定需要开启或关闭的特性。               |
2635| enabled | boolean                                   | 是   | true表明开启指定特性,false表明关闭指定特性。 |
2636
2637**错误码:**
2638
2639以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2640
2641| 错误码ID   | 错误信息                                           |
2642|---------|------------------------------------------------|
2643| 202     | Not System Application.                        |
2644| 7400101 | Parameter missing or parameter type incorrect. |
2645
2646**示例:**
2647
2648```ts
2649import { BusinessError } from '@kit.BasicServicesKit';
2650
2651function enableSceneFeature(photoSession: camera.PhotoSessionForSys, cameraInput: camera.CameraInput, previewOutput: camera.PreviewOutput): void {
2652  photoSession.beginConfig();
2653  photoSession.addInput(cameraInput);
2654  photoSession.addOutput(previewOutput);
2655  photoSession.commitConfig();
2656
2657  photoSession.on('featureDetection', camera.SceneFeatureType.MOON_CAPTURE_BOOST,
2658    (err: BusinessError, statusObject: camera.SceneFeatureDetectionResult) => {
2659      if (err !== undefined && err.code !== 0) {
2660        console.error(`Callback Error, errorCode: ${err.code}`);
2661        return;
2662      }
2663      console.info(
2664        `on featureDetectionStatus featureType:${statusObject.featureType} detected:${statusObject.detected}`);
2665      if (statusObject.featureType === camera.SceneFeatureType.MOON_CAPTURE_BOOST) {
2666        try {
2667          photoSession.enableSceneFeature(statusObject.featureType, statusObject.detected);
2668        } catch (error) {
2669          let err = error as BusinessError;
2670          console.error(`The enableSceneFeature call failed. error code: ${err.code}`);
2671        }
2672      }
2673    });
2674}
2675```
2676
2677## ZoomPointInfo<sup>12+</sup>
2678
2679等效焦距信息。
2680
2681**系统接口:** 此接口为系统接口。
2682
2683**系统能力:** SystemCapability.Multimedia.Camera.Core
2684
2685| 名称     | 类型        |   只读   | 可选  | 说明       |
2686| -------- | ---------- | -------- |-----| ---------- |
2687| zoomRatio |   number   |   是     | 否   | 可变焦距比。 |
2688| equivalentFocalLength |   number   |   是     | 否   | 当前焦距比对应的等效焦距值。 |
2689
2690## ZoomQuery<sup>12+</sup>
2691
2692提供获取当前模式的等效焦距信息列表的方法。
2693
2694### getZoomPointInfos<sup>12+</sup>
2695
2696getZoomPointInfos(): Array\<ZoomPointInfo\>
2697
2698获取当前模式的等效焦距信息列表。
2699
2700**系统接口:** 此接口为系统接口。
2701
2702**系统能力:** SystemCapability.Multimedia.Camera.Core
2703
2704**返回值:**
2705
2706| 类型                | 说明                                                  |
2707| ----------          | -----------------------------                         |
2708|  Array\<[ZoomPointInfo](#zoompointinfo12)\>| 获取当前模式的等效焦距信息列表。                   |
2709
2710**错误码:**
2711
2712以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2713
2714| 错误码ID         | 错误信息        |
2715| --------------- | --------------- |
2716| 202                    |  Not System Application.                      |
2717| 7400103                |  Session not config.                          |
2718
2719**示例:**
2720
2721```ts
2722import { BusinessError } from '@kit.BasicServicesKit';
2723
2724function getZoomPointInfos(): Array<ZoomPointInfo> {
2725  try {
2726    let zoomPointInfos: Array<ZoomPointInfo> = sessionExtendsZoom.getZoomPointInfos();
2727	return zoomPointInfos;
2728  } catch (error) {
2729    // 失败返回错误码error.code并处理
2730    let err = error as BusinessError;
2731    console.error(`The getZoomPointInfos call failed. error code: ${err.code}`);
2732  }
2733}
2734```
2735
2736## Zoom<sup>11+</sup>
2737
2738Zoom extend [ZoomQuery](#zoomquery12)
2739
2740提供了处理设备变焦效果的相关方法,包括获取当前的变焦比,设置变焦比率,以及通过平滑方法设置目标变焦比,以及一些开启和结束变焦的函数。
2741
2742### prepareZoom<sup>11+</sup>
2743
2744prepareZoom(): void
2745
2746通知底层准备变焦,如sensor上电。
2747
2748**系统接口:** 此接口为系统接口。
2749
2750**系统能力:** SystemCapability.Multimedia.Camera.Core
2751
2752**错误码:**
2753
2754以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2755
2756| 错误码ID         | 错误信息        |
2757| --------------- | --------------- |
2758| 202                    |  Not System Application.                      |
2759| 7400103                |  Session not config.                          |
2760
2761**示例:**
2762
2763```ts
2764import { BusinessError } from '@kit.BasicServicesKit';
2765
2766function prepareZoom(sessionExtendsZoom: camera.Zoom): void {
2767  try {
2768    sessionExtendsZoom.prepareZoom();
2769  } catch (error) {
2770    // 失败返回错误码error.code并处理
2771    let err = error as BusinessError;
2772    console.error(`The prepareZoom call failed. error code: ${err.code}`);
2773  }
2774}
2775```
2776
2777### unprepareZoom<sup>11+</sup>
2778
2779unprepareZoom(): void
2780
2781通知底层离开变焦准备状态。
2782
2783**系统接口:** 此接口为系统接口。
2784
2785**系统能力:** SystemCapability.Multimedia.Camera.Core
2786
2787**错误码:**
2788
2789以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2790
2791| 错误码ID         | 错误信息        |
2792| --------------- | --------------- |
2793| 202                    |  Not System Application.                      |
2794| 7400103                |  Session not config.                          |
2795
2796**示例:**
2797
2798```ts
2799import { BusinessError } from '@kit.BasicServicesKit';
2800
2801function unprepareZoom(sessionExtendsZoom: camera.Zoom): void {
2802  try {
2803    sessionExtendsZoom.unprepareZoom();
2804  } catch (error) {
2805    // 失败返回错误码error.code并处理
2806    let err = error as BusinessError;
2807    console.error(`The unprepareZoom call failed. error code: ${err.code}`);
2808  }
2809}
2810```
2811
2812## ZoomRange<sup>11+</sup>
2813
2814获取支持的变焦范围。变焦范围为[min, max),即包括最小值,不包括最大值。
2815
2816**系统接口:** 此接口为系统接口。
2817
2818**系统能力:** SystemCapability.Multimedia.Camera.Core
2819
2820| 名称     | 类型           | 只读 | 必填 | 说明         |
2821| -------- | ------------- |---- | ---- | -------------|
2822| min      | number        | 是  |  N/A  | 获取的可变焦距范围的最小值  |
2823| max      | number        | 是  |  N/A  | 获取的可变焦距范围的最大值。 |
2824
2825## Beauty<sup>11+</sup>
2826
2827Beauty extends [BeautyQuery](#beautyquery12)
2828
2829提供了获取和设置美颜效果的方法。
2830
2831### setBeauty<sup>11+</sup>
2832
2833setBeauty(type: BeautyType, value: number): void
2834
2835设置美颜类型以及对应的美颜强度。将通过[getSupportedBeautyTypes](#getsupportedbeautytypes12)获取得到的[BeautyType](#beautytype)都关闭,表明当前美颜关闭;若有一种美颜类型未关闭,表明当前美颜打开。
2836
2837**系统接口:** 此接口为系统接口。
2838
2839**系统能力:** SystemCapability.Multimedia.Camera.Core
2840
2841**参数:**
2842
2843| 参数名      | 类型                    | 必填 | 说明                                                                |
2844| -------- | --------------------------| ---- |-------------------------------------------------------------------|
2845| type     | [BeautyType](#beautytype) | 是   | 美颜类型。                                                             |
2846| value    | number                    | 是   | 美颜强度,通过[getSupportedBeautyRange](#getsupportedbeautyrange12)接口获取。 |
2847
2848**错误码:**
2849
2850以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2851
2852| 错误码ID         | 错误信息        |
2853| --------------- | --------------- |
2854| 202                |  Not System Application.                                   |
2855| 7400103                |  Session not config.                                   |
2856
2857**示例:**
2858
2859```ts
2860function setBeauty(portraitPhotoSession: camera.PortraitPhotoSession): void {
2861  let beautyTypes: Array<camera.BeautyType> = portraitPhotoSession.getSupportedBeautyTypes();
2862  if (beautyTypes === undefined || beautyTypes.length <= 0) {
2863    return;
2864  }
2865  let beautyLevels: Array<number> = portraitPhotoSession.getSupportedBeautyRange(beautyTypes[0]);
2866  if (beautyLevels === undefined || beautyLevels.length <= 0) {
2867    return;
2868  }
2869  portraitPhotoSession.setBeauty(beautyTypes[0], beautyLevels[0]);
2870}
2871```
2872
2873### getBeauty<sup>11+</sup>
2874
2875getBeauty(type: BeautyType): number
2876
2877查询当前已设置的美颜效果对应的美颜强度。
2878
2879**系统接口:** 此接口为系统接口。
2880
2881**系统能力:** SystemCapability.Multimedia.Camera.Core
2882
2883**参数:**
2884
2885| 参数名      | 类型                                              | 必填 | 说明                    |
2886| -------- | ------------------------------------------------- | ---- | --------------------- |
2887| type     | [BeautyType](#beautytype) | 是   | 美颜类型。   |
2888
2889**返回值:**
2890| 参数名      | 类型                                              | 必填 | 说明                    |
2891| -------- | ------------------------------------------------- | ---- | --------------------- |
2892| value     | number | 是   | 美颜强度。  |
2893
2894**错误码:**
2895
2896以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2897
2898| 错误码ID         | 错误信息        |
2899| --------------- | --------------- |
2900| 202                |  Not System Application.                                   |
2901| 7400103                |  Session not config.                                   |
2902
2903**示例:**
2904
2905```ts
2906function getBeauty(portraitPhotoSession: camera.PortraitPhotoSession): number {
2907  const invalidValue: number = -1;
2908  let beautyTypes = portraitPhotoSession.getSupportedBeautyTypes();
2909  if (beautyTypes === undefined || beautyTypes.length <= 0) {
2910    return invalidValue;
2911  }
2912  let beautyLevels: Array<number> = portraitPhotoSession.getSupportedBeautyRange(beautyTypes[0]);
2913  if (beautyLevels === undefined || beautyLevels.length <= 0) {
2914    return invalidValue;
2915  }
2916  portraitPhotoSession.setBeauty(beautyTypes[0], beautyLevels[0]);
2917  let beautyLevel: number = portraitPhotoSession.getBeauty(beautyTypes[0]);
2918  return beautyLevel;
2919}
2920```
2921
2922## ColorEffectQuery<sup>12+</sup>
2923
2924提供了一个查询设备支持的颜色效果类型的方法。
2925
2926### getSupportedColorEffects<sup>12+</sup>
2927
2928getSupportedColorEffects(): Array\<ColorEffectType\>
2929
2930获取支持的色彩效果类型列表。
2931
2932**系统接口:** 此接口为系统接口。
2933
2934**系统能力:** SystemCapability.Multimedia.Camera.Core
2935
2936**返回值:**
2937
2938| 类型                                             | 说明                           |
2939| ----------------------------------------------- | ---------------------------- |
2940| Array<[ColorEffectType](#coloreffecttype11)>       | 支持的色彩效果类型列表。           |
2941
2942**错误码:**
2943
2944以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2945
2946| 错误码ID         | 错误信息        |
2947| --------------- | --------------- |
2948| 7400103         |  Session not config.                      |
2949| 202             |  Not System Application.                  |
2950
2951**示例:**
2952
2953```ts
2954function getSupportedColorEffects(session: camera.PhotoSessionForSys): Array<camera.ColorEffectType> {
2955  let colorEffects: Array<camera.ColorEffectType> = session.getSupportedColorEffects();
2956  return colorEffects;
2957}
2958```
2959
2960## ColorEffect<sup>11+</sup>
2961
2962ColorEffect extends [ColorEffectQuery](#coloreffectquery12)
2963
2964提供了获取和设置镜头色彩效果的相关功能。
2965
2966### setColorEffect<sup>11+</sup>
2967
2968setColorEffect(type: ColorEffectType): void
2969
2970设置色彩效果类型。可以先通过[getSupportedColorEffects](#getsupportedcoloreffects12)获取当前设备所支持的ColorEffects。
2971
2972**系统接口:** 此接口为系统接口。
2973
2974**系统能力:** SystemCapability.Multimedia.Camera.Core
2975
2976**参数:**
2977
2978| 参数名         | 类型                                                            | 必填 | 说明                      |
2979| ------------ |--------------------------------------------------------------- | -- | -------------------------- |
2980| type | [ColorEffectType](#coloreffecttype11)                              | 是 | 色彩效果类型,通过[getSupportedColorEffects](#getsupportedcoloreffects12)接口获取。   |
2981
2982**错误码:**
2983
2984以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
2985
2986| 错误码ID         | 错误信息        |
2987| --------------- | --------------- |
2988| 7400103                |  Session not config.                                   |
2989| 202             |  Not System Application.                         |
2990
2991**示例:**
2992
2993```ts
2994function setColorEffect(session: camera.PhotoSessionForSys, colorEffect: camera.ColorEffectType): void {
2995  session.setColorEffect(colorEffect);
2996}
2997```
2998
2999### getColorEffect<sup>11+</sup>
3000
3001getColorEffect(): ColorEffectType
3002
3003获取当前设置的色彩效果类型。
3004
3005**系统接口:** 此接口为系统接口。
3006
3007**系统能力:** SystemCapability.Multimedia.Camera.Core
3008
3009**返回值:**
3010
3011| 类型                                             | 说明                           |
3012| ----------------------------------------------- | ---------------------------- |
3013| [ColorEffectType](#coloreffecttype11)             | 当前设置的色彩效果类型。                |
3014
3015**错误码:**
3016
3017以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3018
3019| 错误码ID         | 错误信息        |
3020| --------------- | --------------- |
3021| 7400103                |  Session not config.                                   |
3022| 202             |  Not System Application.                         |
3023
3024**示例:**
3025
3026```ts
3027function getColorEffect(session: camera.PhotoSessionForSys): camera.ColorEffectType {
3028  let colorEffect: camera.ColorEffectType = session.getColorEffect();
3029  return colorEffect;
3030}
3031```
3032
3033## ColorEffectType<sup>11+</sup>
3034
3035枚举,色彩效果类型。
3036
3037**系统接口:** 此接口为系统接口。
3038
3039**系统能力:** SystemCapability.Multimedia.Camera.Core
3040
3041| 名称                  | 值   | 说明       |
3042| --------------------- | ---- | --------- |
3043| NORMAL                | 0    | 常规的色彩效果。  |
3044| BRIGHT                | 1    | 明艳的色彩效果。  |
3045| SOFT                  | 2    | 柔和的色彩效果。  |
3046| BLACK_WHITE<sup>12+</sup>    | 3    | 黑白色彩效果。  |
3047
3048## Portrait<sup>11+</sup>
3049
3050人像类,用于设置人像参数。
3051
3052### getSupportedPortraitEffects<sup>10+</sup>
3053
3054getSupportedPortraitEffects(): Array\<PortraitEffect\>
3055
3056获取支持的人像虚化效果列表。
3057
3058**系统接口:** 此接口为系统接口。
3059
3060**系统能力:** SystemCapability.Multimedia.Camera.Core
3061
3062**返回值:**
3063
3064| 类型                                             | 说明                           |
3065| ----------------------------------------------- | ---------------------------- |
3066| Array<[PortraitEffect](#portraiteffect)> | 支持的人像虚化效果列表。               |
3067
3068**错误码:**
3069
3070以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3071
3072| 错误码ID         | 错误信息        |
3073| --------------- | --------------- |
3074| 7400103         |  Session not config.                |
3075| 202             |  Not System Application.            |
3076
3077**示例:**
3078
3079```ts
3080function getSupportedPortraitEffects(portraitPhotoSession: camera.PortraitPhotoSession): Array<camera.PortraitEffect> {
3081  let portraitEffects: Array<camera.PortraitEffect> = portraitPhotoSession.getSupportedPortraitEffects();
3082  return portraitEffects;
3083}
3084```
3085
3086### setPortraitEffect<sup>10+</sup>
3087
3088setPortraitEffect(effect: PortraitEffect): void
3089
3090设置人像虚化效果。需要先检查设备是否支持人像虚化模式,可以通过[getSupportedPortraitEffects](#getsupportedportraiteffects10)获取当前设备所支持的PortraitEffects。
3091
3092**系统接口:** 此接口为系统接口。
3093
3094**系统能力:** SystemCapability.Multimedia.Camera.Core
3095
3096**参数:**
3097
3098| 参数名         | 类型                        | 必填 | 说明                      |
3099| ------------ |----------------------------- | -- | -------------------------- |
3100| effect | [PortraitEffect](#portraiteffect)  | 是 | 人像虚化效果,通过[getSupportedPortraitEffects](#getsupportedportraiteffects10)接口获取。   |
3101
3102**错误码:**
3103
3104以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3105
3106| 错误码ID         | 错误信息        |
3107| --------------- | --------------- |
3108| 7400103         |  Session not config.                                   |
3109| 202             |  Not System Application.                         |
3110
3111**示例:**
3112
3113```ts
3114import { BusinessError } from '@kit.BasicServicesKit';
3115
3116function setPortraitEffect(portraitPhotoSession: camera.PortraitPhotoSession, portraitEffects: Array<camera.PortraitEffect>): void {
3117  if (portraitEffects === undefined || portraitEffects.length <= 0) {
3118    return;
3119  }
3120  try {
3121    portraitPhotoSession.setPortraitEffect(portraitEffects[0]);
3122  } catch (error) {
3123    let err = error as BusinessError;
3124    console.error(`The setPortraitEffect call failed. error code: ${err.code}`);
3125  }
3126}
3127```
3128
3129### getPortraitEffect<sup>10+</sup>
3130
3131getPortraitEffect(): PortraitEffect
3132
3133获取当前设置的人像虚化效果。
3134
3135**系统接口:** 此接口为系统接口。
3136
3137**系统能力:** SystemCapability.Multimedia.Camera.Core
3138
3139**返回值:**
3140
3141| 类型                                             | 说明                           |
3142| ----------------------------------------------- | ---------------------------- |
3143| [PortraitEffect](#portraiteffect)               | 当前设置的人像虚化效果。                |
3144
3145**错误码:**
3146
3147以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3148
3149| 错误码ID         | 错误信息        |
3150| --------------- | --------------- |
3151| 7400103         |  Session not config.                |
3152| 202             |  Not System Application.            |
3153
3154**示例:**
3155
3156```ts
3157function getPortraitEffect(portraitPhotoSession: camera.PortraitPhotoSession): camera.PortraitEffect {
3158  let portraitEffect: camera.PortraitEffect = portraitPhotoSession.getPortraitEffect();
3159  return portraitEffect;
3160}
3161```
3162
3163## PhysicalAperture<sup>11+</sup>
3164
3165物理光圈信息。
3166
3167**系统接口:** 此接口为系统接口。
3168
3169**系统能力:** SystemCapability.Multimedia.Camera.Core
3170
3171| 名称       | 类型                       |  只读 | 可选  | 说明               |
3172| ---------- | ------------------------- | ----- |-----| ----------------- |
3173| zoomRange  | [ZoomRange](#zoomrange11) | 否    | 否   | 特定物理光圈的变焦范围。  |
3174| apertures  | Array\<number\>           | 否    | 否   | 支持的物理光圈列表。      |
3175
3176## Aperture<sup>11+</sup>
3177
3178光圈类,用于设置光圈参数。
3179
3180### getSupportedVirtualApertures<sup>11+</sup>
3181
3182getSupportedVirtualApertures(): Array\<number\>
3183
3184获取支持的虚拟光圈列表。
3185
3186**系统接口:** 此接口为系统接口。
3187
3188**系统能力:** SystemCapability.Multimedia.Camera.Core
3189
3190**返回值:**
3191
3192| 类型                                             | 说明                           |
3193| ----------------------------------------------- | ---------------------------- |
3194| Array\<number\> | 支持的虚拟光圈列表。               |
3195
3196**错误码:**
3197
3198以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3199
3200| 错误码ID         | 错误信息        |
3201| --------------- | --------------- |
3202| 7400103         |  Session not config.                             |
3203| 202             |  Not System Application.                         |
3204
3205**示例:**
3206
3207```ts
3208function getSupportedVirtualApertures(session: camera.PortraitPhotoSession): Array<number> {
3209  let virtualApertures: Array<number> = session.getSupportedVirtualApertures();
3210  return virtualApertures;
3211}
3212```
3213
3214### getVirtualAperture<sup>11+</sup>
3215
3216getVirtualAperture(): number
3217
3218获取当前设置的虚拟光圈值。
3219
3220**系统接口:** 此接口为系统接口。
3221
3222**系统能力:** SystemCapability.Multimedia.Camera.Core
3223
3224**返回值:**
3225
3226| 类型                                             | 说明                           |
3227| ----------------------------------------------- | ---------------------------- |
3228| number               | 当前设置的虚拟光圈值。                |
3229
3230**错误码:**
3231
3232以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3233
3234| 错误码ID         | 错误信息        |
3235| --------------- | --------------- |
3236| 7400103         |  Session not config.                             |
3237| 202             |  Not System Application.                         |
3238
3239**示例:**
3240
3241```ts
3242function getVirtualAperture(session: camera.PortraitPhotoSession): number {
3243  let virtualAperture: number = session.getVirtualAperture();
3244  return virtualAperture;
3245}
3246```
3247
3248### setVirtualAperture<sup>11+</sup>
3249
3250setVirtualAperture(aperture: number): void
3251
3252设置虚拟光圈。可以线通过[getSupportedVirtualApertures](#getsupportedvirtualapertures11)获取当前设备所支持的虚拟光圈列表。
3253
3254**系统接口:** 此接口为系统接口。
3255
3256**系统能力:** SystemCapability.Multimedia.Camera.Core
3257
3258**参数:**
3259
3260| 参数名         | 类型                    | 必填 | 说明                      |
3261| ------------ |------------------------- | -- | -------------------------- |
3262| aperture       | number                 | 是 | 虚拟光圈值,通过[getSupportedVirtualApertures](#getsupportedvirtualapertures11)接口获取。   |
3263
3264**错误码:**
3265
3266以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3267
3268| 错误码ID         | 错误信息        |
3269| --------------- | --------------- |
3270| 7400103         |  Session not config.                          |
3271| 202             |  Not System Application.                      |
3272
3273**示例:**
3274
3275```ts
3276function setVirtualAperture(session: camera.PortraitPhotoSession, virtualAperture: number): void {
3277  session.setVirtualAperture(virtualAperture);
3278}
3279```
3280
3281### getSupportedPhysicalApertures<sup>11+</sup>
3282
3283getSupportedPhysicalApertures(): Array\<PhysicalAperture\>
3284
3285获取支持的物理光圈列表。
3286
3287**系统接口:** 此接口为系统接口。
3288
3289**系统能力:** SystemCapability.Multimedia.Camera.Core
3290
3291**返回值:**
3292
3293| 类型                                             | 说明                           |
3294| ----------------------------------------------- | ---------------------------- |
3295| Array<[PhysicalAperture](#physicalaperture11)>    | 支持的物理光圈列表。               |
3296
3297**错误码:**
3298
3299以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3300
3301| 错误码ID         | 错误信息        |
3302| --------------- | --------------- |
3303| 7400103         |  Session not config.                          |
3304| 202             |  Not System Application.                      |
3305
3306**示例:**
3307
3308```ts
3309function getSupportedPhysicalApertures(session: camera.PortraitPhotoSession): Array<camera.PhysicalAperture> {
3310  let physicalApertures: Array<camera.PhysicalAperture> = session.getSupportedPhysicalApertures();
3311  return physicalApertures;
3312}
3313```
3314
3315### getPhysicalAperture<sup>11+</sup>
3316
3317getPhysicalAperture(): number
3318
3319获取当前设置的物理光圈值。
3320
3321**系统接口:** 此接口为系统接口。
3322
3323**系统能力:** SystemCapability.Multimedia.Camera.Core
3324
3325**返回值:**
3326
3327| 类型                 | 说明                           |
3328| -------------------- | ---------------------------- |
3329| number               | 当前设置的物理光圈值。           |
3330
3331**错误码:**
3332
3333以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3334
3335| 错误码ID         | 错误信息        |
3336| --------------- | --------------- |
3337| 7400103         |  Session not config.                             |
3338| 202             |  Not System Application.                         |
3339
3340**示例:**
3341
3342```ts
3343function getPhysicalAperture(session: camera.PortraitPhotoSession): number {
3344  let physicalAperture: number = session.getPhysicalAperture();
3345  return physicalAperture;
3346}
3347```
3348
3349### setPhysicalAperture<sup>11+</sup>
3350
3351setPhysicalAperture(aperture: number): void
3352
3353设置物理光圈。可以线通过[getSupportedPhysicalApertures](#getsupportedphysicalapertures11)获取当前设备所支持的物理光圈列表。
3354
3355**系统接口:** 此接口为系统接口。
3356
3357**系统能力:** SystemCapability.Multimedia.Camera.Core
3358
3359**参数:**
3360
3361| 参数名         | 类型                    | 必填 | 说明                      |
3362| ------------ |------------------------- | -- | -------------------------- |
3363| aperture       | number                 | 是 | 物理光圈值,通过[getSupportedPhysicalApertures](#getsupportedphysicalapertures11)接口获取。   |
3364
3365**错误码:**
3366
3367以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3368
3369| 错误码ID         | 错误信息        |
3370| --------------- | --------------- |
3371| 7400103         |  Session not config.                          |
3372| 202             |  Not System Application.                      |
3373
3374**示例:**
3375
3376```ts
3377function setPhysicalAperture(session: camera.PortraitPhotoSession, physicalAperture: number): void {
3378  session.setPhysicalAperture(physicalAperture);
3379}
3380```
3381
3382## CaptureSession<sup>(deprecated)</sup>
3383
3384拍照会话类,保存一次相机运行所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput),并向相机设备申请完成相机功能(录像,拍照)。
3385
3386> **说明:**
3387>从 API version 10开始支持,从API version 11开始废弃。建议使用[PhotoSession](#photosession11)、[VideoSession](#videosession11)替代。
3388
3389### getSupportedBeautyTypes<sup>(deprecated)</sup>
3390
3391getSupportedBeautyTypes(): Array\<BeautyType>
3392
3393获取当前支持的美颜效果列表。
3394
3395> **说明:**
3396>从 API version 10开始支持,从API version 11开始废弃。建议使用[Beauty.getSupportedBeautyTypes](#getsupportedbeautytypes12)替代。
3397
3398**系统接口:** 此接口为系统接口。
3399
3400**系统能力:** SystemCapability.Multimedia.Camera.Core
3401
3402**返回值:**
3403
3404| 类型                | 说明                                                  |
3405| ----------          | -----------------------------                         |
3406|  Array\<[BeautyType](#beautytype)\>| 返回当前支持的美颜效果列表。                             |
3407
3408**错误码:**
3409
3410以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3411
3412| 错误码ID         | 错误信息        |
3413| --------------- | --------------- |
3414| 7400103                |  Session not config.                                   |
3415
3416**示例:**
3417
3418```ts
3419function getSupportedBeautyTypes(captureSession: camera.CaptureSession): Array<camera.BeautyType> {
3420  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3421  return beautyTypes;
3422}
3423```
3424
3425### getSupportedBeautyRange<sup>(deprecated)</sup>
3426
3427getSupportedBeautyRange(type: BeautyType): Array\<number\>
3428
3429获取指定美颜效果的范围值。在不同设备返回的美颜强度有所不同,下表仅做示例。
3430
3431| 传入参数           | 示例返回值    | 返回值说明     |
3432| ----------------| ----  | ---------|
3433| AUTO           | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]     |美颜类型为自动时支持的美颜强度,0表明关闭美颜,其余正值表明自动的美颜强度。    |
3434| SKIN_SMOOTH    | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]     | 美颜类型为光滑时支持的美颜强度,0表明关闭光滑,其余正值表明光滑的美颜强度。    |
3435| FACE_SLENDER   | [0, 1, 2, 3, 4, 5]      | 美颜类型为瘦脸时支持的美颜强度,0表明关闭瘦脸,其余正值表明瘦脸的美颜强度。   |
3436| SKIN_TONE      | [-1, 16242611]      | 美颜类型为美肤时支持的美颜强度,-1表明关闭美肤,其余非负值为使用RGB表示的美肤美颜强度,<br> 16242611转化为16进制为0xF7D7B3,F7为R通道值,D7为G通道值,B3位B通道值。    |
3437
3438> **说明:**
3439>从 API version 10开始支持,从API version 11开始废弃。建议使用[Beauty.getSupportedBeautyRange](#getsupportedbeautyrange12)替代。
3440
3441**系统接口:** 此接口为系统接口。
3442
3443**系统能力:** SystemCapability.Multimedia.Camera.Core
3444
3445**参数:**
3446
3447| 参数名      | 类型                    | 必填 | 说明       |
3448| -------- | --------------------------| ---- | ----------|
3449| type     | [BeautyType](#beautytype) | 是   | 美颜类型。   |
3450
3451**返回值:**
3452
3453| 类型        | 说明                          |
3454| ---------- | ----------------------------- |
3455|  Array\<number\>     | 当前美颜类型所支持的美颜强度。 |
3456
3457**错误码:**
3458
3459以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3460
3461| 错误码ID         | 错误信息        |
3462| --------------- | --------------- |
3463| 7400103                |  Session not config.                                   |
3464
3465**示例:**
3466
3467```ts
3468function getSupportedBeautyRange(captureSession: camera.CaptureSession): Array<number> {
3469  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3470  if (beautyTypes === undefined || beautyTypes.length <= 0) {
3471    return [];
3472  }
3473  let beautyLevels: Array<number> = captureSession.getSupportedBeautyRange(beautyTypes[0]);
3474  return beautyLevels;
3475}
3476```
3477
3478### setBeauty<sup>(deprecated)</sup>
3479
3480setBeauty(type: BeautyType, value: number): void
3481
3482设置美颜类型以及对应的美颜强度。将通过[getSupportedBeautyTypes](#getsupportedbeautytypesdeprecated)获取得到的[BeautyType](#beautytype)都关闭,表明当前美颜关闭;若有一种美颜类型未关闭,表明当前美颜打开。
3483
3484> **说明:**
3485>从 API version 10开始支持,从API version 11开始废弃。建议使用[Beauty.setBeauty](#setbeauty11)替代。
3486
3487**系统接口:** 此接口为系统接口。
3488
3489**系统能力:** SystemCapability.Multimedia.Camera.Core
3490
3491**参数:**
3492
3493| 参数名      | 类型                    | 必填 | 说明                   |
3494| -------- | --------------------------| ---- | --------------------- |
3495| type     | [BeautyType](#beautytype) | 是   | 美颜类型 。              |
3496| value    | number                    | 是   | 美颜强度,通过[getSupportedBeautyRange](#getsupportedbeautyrangedeprecated)接口获取。|
3497
3498**错误码:**
3499
3500以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3501
3502| 错误码ID         | 错误信息        |
3503| --------------- | --------------- |
3504| 7400103                |  Session not config.                                   |
3505
3506**示例:**
3507
3508```ts
3509function setBeauty(captureSession: camera.CaptureSession): void {
3510  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3511  if (beautyTypes === undefined || beautyTypes.length <= 0) {
3512    return;
3513  }
3514  let beautyLevels: Array<number> = captureSession.getSupportedBeautyRange(beautyTypes[0]);
3515  if (beautyLevels === undefined || beautyLevels.length <= 0) {
3516    return;
3517  }
3518  captureSession.setBeauty(beautyTypes[0], beautyLevels[0]);
3519}
3520```
3521
3522### getBeauty<sup>(deprecated)</sup>
3523
3524getBeauty(type: BeautyType): number
3525
3526查询当前已设置的美颜效果对应的美颜强度。
3527
3528> **说明:**
3529>从 API version 10开始支持,从API version 11开始废弃。建议使用[Beauty.getBeauty](#getbeauty11)替代。
3530
3531**系统接口:** 此接口为系统接口。
3532
3533**系统能力:** SystemCapability.Multimedia.Camera.Core
3534
3535**参数:**
3536
3537| 参数名      | 类型                                              | 必填 | 说明                    |
3538| -------- | ------------------------------------------------- | ---- | --------------------- |
3539| type     | [BeautyType](#beautytype) | 是   | 美颜类型。   |
3540
3541**返回值:**
3542| 参数名      | 类型                                              | 必填 | 说明                    |
3543| -------- | ------------------------------------------------- | ---- | --------------------- |
3544| value     | number | 是   | 美颜强度。  |
3545
3546**错误码:**
3547
3548以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3549
3550| 错误码ID         | 错误信息        |
3551| --------------- | --------------- |
3552| 7400103                |  Session not config.                                   |
3553
3554**示例:**
3555
3556```ts
3557function getBeauty(captureSession: camera.CaptureSession): number {
3558  const invalidValue: number = -1;
3559  let beautyTypes: Array<camera.BeautyType> = captureSession.getSupportedBeautyTypes();
3560  if (beautyTypes === undefined || beautyTypes.length <= 0) {
3561    return invalidValue;
3562  }
3563  let beautyLevels: Array<number> = captureSession.getSupportedBeautyRange(beautyTypes[0]);
3564  if (beautyLevels === undefined || beautyLevels.length <= 0) {
3565    return invalidValue;
3566  }
3567  captureSession.setBeauty(beautyTypes[0], beautyLevels[0]);
3568  let beautyLevel: number = captureSession.getBeauty(beautyTypes[0]);
3569  return beautyLevel;
3570}
3571```
3572
3573## PhotoSessionForSys<sup>11+</sup>
3574
3575PhotoSessionForSys extends PhotoSession, Beauty, ColorEffect, ColorManagement, Macro, SceneDetection
3576
3577提供给系统应用的PhotoSession,普通拍照模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置普通拍照模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
3578
3579**系统接口:** 此接口为系统接口。
3580
3581**系统能力:** SystemCapability.Multimedia.Camera.Core
3582
3583## PhotoSession<sup>11+</sup>
3584
3585PhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorManagement
3586
3587普通拍照模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置普通拍照模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
3588
3589### on('macroStatusChanged')<sup>11+</sup>
3590
3591on(type: 'macroStatusChanged', callback: AsyncCallback\<boolean\>): void
3592
3593监听相机微距状态变化,通过注册回调函数获取结果。使用callback异步回调。
3594
3595**系统接口:** 此接口为系统接口。
3596
3597**系统能力:** SystemCapability.Multimedia.Camera.Core
3598
3599**参数:**
3600
3601| 参数名     | 类型                                      | 必填 | 说明                       |
3602| -------- | ----------------------------------------- | ---- | ------------------------ |
3603| type     | string      | 是   | 监听事件,固定为'macroStatusChanged',session创建成功可监听。 |
3604| callback | AsyncCallback\<boolean\>     | 是   | 回调函数,用于获取当前微距状态。  |
3605
3606**错误码:**
3607
3608以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3609
3610| 错误码ID | 错误信息                      |
3611|-------|---------------------------|
3612| 202   | Not System Application.   |
3613
3614**示例:**
3615
3616```ts
3617import { BusinessError } from '@kit.BasicServicesKit';
3618
3619function callback(err: BusinessError, macroStatus: boolean): void {
3620  if (err !== undefined && err.code !== 0) {
3621    console.error(`Callback Error, errorCode: ${err.code}`);
3622    return;
3623  }
3624  console.info(`Macro state: ${macroStatus}`);
3625}
3626
3627function registerMacroStatusChanged(photoSession: camera.PhotoSession): void {
3628  photoSession.on('macroStatusChanged', callback);
3629}
3630```
3631
3632### off('macroStatusChanged')<sup>11+</sup>
3633
3634off(type: 'macroStatusChanged', callback?: AsyncCallback\<boolean\>): void
3635
3636注销监听相机微距状态变化。
3637
3638**系统接口:** 此接口为系统接口。
3639
3640**系统能力:** SystemCapability.Multimedia.Camera.Core
3641
3642**参数:**
3643
3644| 参数名     | 类型                    | 必填 | 说明                       |
3645| -------- | ------------------------ | ---- | ------------------------ |
3646| type     | string                   | 是   | 监听事件,固定为'macroStatusChanged',session创建成功可监听。|
3647| callback | AsyncCallback\<boolean\> | 否   | 回调函数,可选,有就是匹配on('macroStatusChanged') callback(callback对象不可是匿名函数)。 |
3648
3649**错误码:**
3650
3651以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3652
3653| 错误码ID | 错误信息                      |
3654|-------|---------------------------|
3655| 202   | Not System Application.   |
3656
3657**示例:**
3658
3659```ts
3660function unregisterMacroStatusChanged(photoSession: camera.PhotoSession): void {
3661  photoSession.off('macroStatusChanged');
3662}
3663```
3664
3665### on('featureDetection')<sup>12+</sup>
3666
3667on(type: 'featureDetection', featureType: SceneFeatureType, callback: AsyncCallback\<SceneFeatureDetectionResult\>): void
3668
3669监听相机特性检测状态变化。使用callback异步回调。
3670
3671**系统接口:** 此接口为系统接口。
3672
3673**系统能力:** SystemCapability.Multimedia.Camera.Core
3674
3675**参数:**
3676
3677| 参数名     | 类型                                      | 必填 | 说明                       |
3678| -------- | ----------------------------------------- | ---- | ------------------------ |
3679| type     | string      | 是   | 监听事件,固定为'featureDetection',photoSession创建成功可监听。 |
3680| featureType     | [SceneFeatureType](#scenefeaturetype12)      | 是   | 监听指定特性。 |
3681| callback | AsyncCallback\<[SceneFeatureDetectionResult](#scenefeaturedetectionresult12)\>     | 是   | 回调函数,用于获取当前监听的特性的状态。  |
3682
3683**错误码:**
3684
3685以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3686
3687| 错误码ID | 错误信息                      |
3688|-------|---------------------------|
3689| 202   | Not System Application.   |
3690
3691**示例:**
3692
3693```ts
3694import { BusinessError } from '@kit.BasicServicesKit';
3695
3696function callback(err: BusinessError, result: camera.SceneFeatureDetectionResult): void {
3697  if (err !== undefined && err.code !== 0) {
3698    console.error(`Callback Error, errorCode: ${err.code}`);
3699    return;
3700  }
3701  console.info(`feature type: ${result.featureType}`);
3702  console.info(`feature status: ${result.detected}`);
3703}
3704
3705function registerFeatureDetectionStatus(photoSession: camera.PhotoSession, featureType: camera.SceneFeatureType): void {
3706  photoSession.on('featureDetection', featureType, callback);
3707}
3708```
3709
3710### off('featureDetection')<sup>12+</sup>
3711
3712off(type: 'featureDetection', featureType: SceneFeatureType, callback?: AsyncCallback\<SceneFeatureDetectionResult\>): void
3713
3714注销监听相机特性检测状态变化。
3715
3716**系统接口:** 此接口为系统接口。
3717
3718**系统能力:** SystemCapability.Multimedia.Camera.Core
3719
3720**参数:**
3721
3722| 参数名    | 类型                     | 必填 | 说明                       |
3723| -------- | ------------------------ | ---- | ------------------------ |
3724| type     | string                   | 是   | 监听事件,固定为'featureDetection',session创建成功可取消监听。|
3725| featureType     | [SceneFeatureType](#scenefeaturetype12)      | 是   | 指定特性。 |
3726| callback | AsyncCallback\<[SceneFeatureDetectionResult](#scenefeaturedetectionresult12)\> | 否   | 回调函数,可选,有就是匹配on('featureDetection') callback(callback对象不可是匿名函数)。 |
3727
3728**错误码:**
3729
3730以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3731
3732| 错误码ID | 错误信息                      |
3733|-------|---------------------------|
3734| 202   | Not System Application.   |
3735
3736**示例:**
3737
3738```ts
3739function unregisterFeatureDetectionStatus(photoSession: camera.PhotoSession, featureType: camera.SceneFeatureType): void {
3740  photoSession.off('featureDetection', featureType);
3741}
3742```
3743
3744### on('lcdFlashStatus')<sup>13+</sup>
3745
3746on(type: 'lcdFlashStatus', callback: AsyncCallback\<LcdFlashStatus\>): void
3747
3748监听LCD闪光灯状态变化。使用callback异步回调。
3749
3750**系统接口:** 此接口为系统接口。
3751
3752**系统能力:** SystemCapability.Multimedia.Camera.Core
3753
3754**参数:**
3755
3756| 参数名     | 类型                                      | 必填 | 说明                                       |
3757| -------- | ----------------------------------------- | ---- |------------------------------------------|
3758| type     | string      | 是   | 监听事件,固定为'lcdFlashStatus',session创建成功可监听。 |
3759| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>     | 是   | 回调函数,用于获取当前lcd flash状态。                  |
3760
3761**错误码:**
3762
3763以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3764
3765| 错误码ID | 错误信息                      |
3766|-------|---------------------------|
3767| 202   | Not System Application.   |
3768
3769**示例:**
3770
3771```ts
3772import { BusinessError } from '@kit.BasicServicesKit';
3773
3774function callback(err: BusinessError, lcdFlashStatus: camera.LcdFlashStatus): void {
3775  if (err !== undefined && err.code !== 0) {
3776    console.error(`Callback Error, errorCode: ${err.code}`);
3777    return;
3778  }
3779  console.info(`isLcdFlashNeeded: ${lcdFlashStatus.isLcdFlashNeeded}`);
3780  console.info(`lcdCompensation: ${lcdFlashStatus.lcdCompensation}`);
3781}
3782
3783function registerLcdFlashStatus(photoSession: camera.PhotoSession): void {
3784  photoSession.on('lcdFlashStatus', callback);
3785}
3786```
3787
3788### off('lcdFlashStatus')<sup>12+</sup>
3789
3790off(type: 'lcdFlashStatus', callback?: AsyncCallback\<LcdFlashStatus\>): void
3791
3792注销监听LCD闪光灯状态变化。
3793
3794**系统接口:** 此接口为系统接口。
3795
3796**系统能力:** SystemCapability.Multimedia.Camera.Core
3797
3798**参数:**
3799
3800| 参数名    | 类型                     | 必填 | 说明                                                               |
3801| -------- | ------------------------ | ---- |------------------------------------------------------------------|
3802| type     | string                   | 是   | 监听事件,固定为'lcdFlashStatus',session创建成功可取消监听。                       |
3803| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\> | 否   | 回调函数,可选,有就是匹配on('lcdFlashStatus') callback(callback对象不可是匿名函数)。 |
3804
3805**错误码:**
3806
3807以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3808
3809| 错误码ID | 错误信息                      |
3810|-------|---------------------------|
3811| 202   | Not System Application.   |
3812
3813**示例:**
3814
3815```ts
3816function unregisterLcdFlashStatus(photoSession: camera.PhotoSession): void {
3817  photoSession.off('lcdFlashStatus');
3818}
3819```
3820
3821## VideoSessionForSys<sup>11+</sup>
3822
3823VideoSessionForSys extends VideoSession, Beauty, ColorEffect, ColorManagement, Macro
3824
3825提供给系统应用的VideoSession,普通录像模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置普通录像模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
3826
3827**系统接口:** 此接口为系统接口。
3828
3829**系统能力:** SystemCapability.Multimedia.Camera.Core
3830
3831## VideoSession<sup>11+</sup>
3832
3833VideoSession extends Session, Flash, AutoExposure, Focus, Zoom, Stabilization, ColorManagement
3834
3835普通录像模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置普通录像模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
3836
3837### on('macroStatusChanged')<sup>11+</sup>
3838
3839on(type: 'macroStatusChanged', callback: AsyncCallback\<boolean\>): void
3840
3841监听相机微距状态变化,通过注册回调函数获取结果。使用callback异步回调。
3842
3843**系统接口:** 此接口为系统接口。
3844
3845**系统能力:** SystemCapability.Multimedia.Camera.Core
3846
3847**参数:**
3848
3849| 参数名     | 类型                                      | 必填 | 说明                       |
3850| -------- | ----------------------------------------- | ---- | ------------------------ |
3851| type     | string      | 是   | 监听事件,固定为'macroStatusChanged',session创建成功可监听。 |
3852| callback | AsyncCallback\<boolean\>     | 是   | 回调函数,用于获取当前微距状态。  |
3853
3854**错误码:**
3855
3856以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3857
3858| 错误码ID | 错误信息                      |
3859|-------|---------------------------|
3860| 202   | Not System Application.   |
3861
3862**示例:**
3863
3864```ts
3865import { BusinessError } from '@kit.BasicServicesKit';
3866
3867function callback(err: BusinessError, macroStatus: boolean): void {
3868  if (err !== undefined && err.code !== 0) {
3869    console.error(`Callback Error, errorCode: ${err.code}`);
3870    return;
3871  }
3872  console.info(`Macro state: ${macroStatus}`);
3873}
3874
3875function registerMacroStatusChanged(videoSession: camera.VideoSession): void {
3876  videoSession.on('macroStatusChanged', callback);
3877}
3878```
3879
3880### off('macroStatusChanged')<sup>11+</sup>
3881
3882off(type: 'macroStatusChanged', callback?: AsyncCallback\<boolean\>): void
3883
3884注销监听相机微距状态变化。
3885
3886**系统接口:** 此接口为系统接口。
3887
3888**系统能力:** SystemCapability.Multimedia.Camera.Core
3889
3890**参数:**
3891
3892| 参数名    | 类型                     | 必填 | 说明                       |
3893| -------- | ------------------------ | ---- | ------------------------ |
3894| type     | string                   | 是   | 监听事件,固定为'macroStatusChanged',session创建成功可监听。|
3895| callback | AsyncCallback\<boolean\> | 否   | 回调函数,可选,有就是匹配on('macroStatusChanged') callback(callback对象不可是匿名函数)。 |
3896
3897**错误码:**
3898
3899以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3900
3901| 错误码ID | 错误信息                      |
3902|-------|---------------------------|
3903| 202   | Not System Application.   |
3904
3905**示例:**
3906
3907```ts
3908function unregisterMacroStatusChanged(videoSession: camera.VideoSession): void {
3909  videoSession.off('macroStatusChanged');
3910}
3911```
3912
3913### on('lcdFlashStatus')<sup>13+</sup>
3914
3915on(type: 'lcdFlashStatus', callback: AsyncCallback\<LcdFlashStatus\>): void
3916
3917监听LCD闪光灯状态变化。使用callback异步回调。
3918
3919**系统接口:** 此接口为系统接口。
3920
3921**系统能力:** SystemCapability.Multimedia.Camera.Core
3922
3923**参数:**
3924
3925| 参数名     | 类型                                      | 必填 | 说明                                       |
3926| -------- | ----------------------------------------- | ---- |------------------------------------------|
3927| type     | string      | 是   | 监听事件,固定为'lcdFlashStatus',session创建成功可监听。 |
3928| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>     | 是   | 回调函数,用于获取当前lcd flash状态。                  |
3929
3930**错误码:**
3931
3932以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3933
3934| 错误码ID | 错误信息                      |
3935|-------|---------------------------|
3936| 202   | Not System Application.   |
3937
3938**示例:**
3939
3940```ts
3941import { BusinessError } from '@kit.BasicServicesKit';
3942
3943function callback(err: BusinessError, lcdFlashStatus: camera.LcdFlashStatus): void {
3944  if (err !== undefined && err.code !== 0) {
3945    console.error(`Callback Error, errorCode: ${err.code}`);
3946    return;
3947  }
3948  console.info(`isLcdFlashNeeded: ${lcdFlashStatus.isLcdFlashNeeded}`);
3949  console.info(`lcdCompensation: ${lcdFlashStatus.lcdCompensation}`);
3950}
3951
3952function registerLcdFlashStatus(videoSession: camera.VideoSession): void {
3953  videoSession.on('lcdFlashStatus', callback);
3954}
3955```
3956
3957### off('lcdFlashStatus')<sup>12+</sup>
3958
3959off(type: 'lcdFlashStatus', callback?: AsyncCallback\<LcdFlashStatus\>): void
3960
3961注销监听LCD闪光灯状态变化。
3962
3963**系统接口:** 此接口为系统接口。
3964
3965**系统能力:** SystemCapability.Multimedia.Camera.Core
3966
3967**参数:**
3968
3969| 参数名    | 类型                     | 必填 | 说明                                                               |
3970| -------- | ------------------------ | ---- |------------------------------------------------------------------|
3971| type     | string                   | 是   | 监听事件,固定为'lcdFlashStatus',session创建成功可取消监听。                       |
3972| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\> | 否   | 回调函数,可选,有就是匹配on('lcdFlashStatus') callback(callback对象不可是匿名函数)。 |
3973
3974**错误码:**
3975
3976以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
3977
3978| 错误码ID | 错误信息                      |
3979|-------|---------------------------|
3980| 202   | Not System Application.   |
3981
3982**示例:**
3983
3984```ts
3985function unregisterLcdFlashStatus(videoSession: camera.VideoSession): void {
3986  videoSession.off('lcdFlashStatus');
3987}
3988```
3989
3990## PortraitPhotoSession<sup>11+</sup>
3991
3992PortraitPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty, ColorEffect, ColorManagement, Portrait, Aperture
3993
3994人像拍照模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置人像拍照模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
3995
3996### on('error')<sup>11+</sup>
3997
3998on(type: 'error', callback: ErrorCallback): void
3999
4000监听人像拍照会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
4001
4002**系统接口:** 此接口为系统接口。
4003
4004**系统能力:** SystemCapability.Multimedia.Camera.Core
4005
4006**参数:**
4007
4008| 参数名     | 类型        | 必填 | 说明                           |
4009| -------- | --------------------------------- | ---- | ------------------------------ |
4010| type     | string                               | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
4011| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。        |
4012
4013**示例:**
4014
4015```ts
4016import { BusinessError } from '@kit.BasicServicesKit';
4017
4018function callback(err: BusinessError): void {
4019  console.error(`Portrait photo session error code: ${err.code}`);
4020}
4021
4022function registerSessionError(portraitPhotoSession: camera.PortraitPhotoSession): void {
4023  portraitPhotoSession.on('error', callback);
4024}
4025```
4026
4027### off('error')<sup>11+</sup>
4028
4029off(type: 'error', callback?: ErrorCallback): void
4030
4031注销监听人像拍照会话的错误事件,通过注册回调函数获取结果。
4032
4033**系统接口:** 此接口为系统接口。
4034
4035**系统能力:** SystemCapability.Multimedia.Camera.Core
4036
4037**参数:**
4038
4039| 参数名     | 类型        | 必填 | 说明                           |
4040| -------- | -------------------------- | ---- | ------------------------------ |
4041| type     | string                     | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。 |
4042| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 否   | 回调函数,可选,有就是匹配on('error') callback(callback对象不可是匿名函数)。    |
4043
4044**示例:**
4045
4046```ts
4047function unregisterSessionError(portraitPhotoSession: camera.PortraitPhotoSession): void {
4048  portraitPhotoSession.off('error');
4049}
4050```
4051
4052### on('focusStateChange')<sup>11+</sup>
4053
4054on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4055
4056监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
4057
4058**系统接口:** 此接口为系统接口。
4059
4060**系统能力:** SystemCapability.Multimedia.Camera.Core
4061
4062**参数:**
4063
4064| 参数名     | 类型                    | 必填 | 说明                       |
4065| -------- | ---------------- | ---- | ------------------------ |
4066| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
4067| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 是   | 回调函数,用于获取当前对焦状态。  |
4068
4069**示例:**
4070
4071```ts
4072import { BusinessError } from '@kit.BasicServicesKit';
4073
4074function callback(err: BusinessError, focusState: camera.FocusState): void {
4075  if (err !== undefined && err.code !== 0) {
4076    console.error(`Callback Error, errorCode: ${err.code}`);
4077    return;
4078  }
4079  console.info(`Focus state: ${focusState}`);
4080}
4081
4082function registerFocusStateChange(portraitPhotoSession: camera.PortraitPhotoSession): void {
4083  portraitPhotoSession.on('focusStateChange', callback);
4084}
4085```
4086
4087### off('focusStateChange')<sup>11+</sup>
4088
4089off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4090
4091注销监听相机对焦的状态变化。
4092
4093**系统接口:** 此接口为系统接口。
4094
4095**系统能力:** SystemCapability.Multimedia.Camera.Core
4096
4097**参数:**
4098
4099| 参数名     | 类型                                      | 必填 | 说明                       |
4100| -------- | ----------------------------------------- | ---- | ------------------------ |
4101| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。 |
4102| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 否   | 回调函数,可选,有就是匹配on('focusStateChange') callback(callback对象不可是匿名函数)。  |
4103
4104**示例:**
4105
4106```ts
4107function unregisterFocusStateChange(portraitPhotoSession: camera.PortraitPhotoSession): void {
4108  portraitPhotoSession.off('focusStateChange');
4109}
4110```
4111
4112### on('smoothZoomInfoAvailable')<sup>11+</sup>
4113
4114on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
4115
4116监听相机平滑变焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
4117
4118**系统接口:** 此接口为系统接口。
4119
4120**系统能力:** SystemCapability.Multimedia.Camera.Core
4121
4122**参数:**
4123
4124| 参数名     | 类型                   | 必填 | 说明                       |
4125| -------- | ----------------------- | ---- | ------------------------ |
4126| type     | string                  | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
4127| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 是   | 回调函数,用于获取当前平滑变焦状态。  |
4128
4129**示例:**
4130
4131```ts
4132import { BusinessError } from '@kit.BasicServicesKit';
4133
4134function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
4135  if (err !== undefined && err.code !== 0) {
4136    console.error(`Callback Error, errorCode: ${err.code}`);
4137    return;
4138  }
4139  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
4140}
4141
4142function registerSmoothZoomInfo(portraitPhotoSession: camera.PortraitPhotoSession): void {
4143  portraitPhotoSession.on('smoothZoomInfoAvailable', callback);
4144}
4145```
4146
4147### off('smoothZoomInfoAvailable')<sup>11+</sup>
4148
4149off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
4150
4151注销监听相机平滑变焦的状态变化。
4152
4153**系统接口:** 此接口为系统接口。
4154
4155**系统能力:** SystemCapability.Multimedia.Camera.Core
4156
4157**参数:**
4158
4159| 参数名     | 类型                                      | 必填 | 说明                       |
4160| -------- | ----------------------------------------- | ---- | ------------------------ |
4161| type     | string              | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
4162| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 否   | 回调函数,可选,有就是匹配on('smoothZoomInfoAvailable') callback(callback对象不可是匿名函数)。  |
4163
4164**示例:**
4165
4166```ts
4167function unregisterSmoothZoomInfo(portraitPhotoSession: camera.PortraitPhotoSession): void {
4168  portraitPhotoSession.off('smoothZoomInfoAvailable');
4169}
4170```
4171
4172### on('lcdFlashStatus')<sup>13+</sup>
4173
4174on(type: 'lcdFlashStatus', callback: AsyncCallback\<LcdFlashStatus\>): void
4175
4176监听LCD闪光灯状态变化。使用callback异步回调。
4177
4178**系统接口:** 此接口为系统接口。
4179
4180**系统能力:** SystemCapability.Multimedia.Camera.Core
4181
4182**参数:**
4183
4184| 参数名     | 类型                                      | 必填 | 说明                                       |
4185| -------- | ----------------------------------------- | ---- |------------------------------------------|
4186| type     | string      | 是   | 监听事件,固定为'lcdFlashStatus',session创建成功可监听。 |
4187| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>     | 是   | 回调函数,用于获取当前lcd flash状态。                  |
4188
4189**错误码:**
4190
4191以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4192
4193| 错误码ID | 错误信息                      |
4194|-------|---------------------------|
4195| 202   | Not System Application.   |
4196
4197**示例:**
4198
4199```ts
4200import { BusinessError } from '@kit.BasicServicesKit';
4201
4202function callback(err: BusinessError, lcdFlashStatus: camera.LcdFlashStatus): void {
4203  if (err !== undefined && err.code !== 0) {
4204    console.error(`Callback Error, errorCode: ${err.code}`);
4205    return;
4206  }
4207  console.info(`isLcdFlashNeeded: ${lcdFlashStatus.isLcdFlashNeeded}`);
4208  console.info(`lcdCompensation: ${lcdFlashStatus.lcdCompensation}`);
4209}
4210
4211function registerLcdFlashStatus(portraitPhotoSession: camera.PortraitPhotoSession): void {
4212  portraitPhotoSession.on('lcdFlashStatus', callback);
4213}
4214```
4215
4216### off('lcdFlashStatus')<sup>12+</sup>
4217
4218off(type: 'lcdFlashStatus', callback?: AsyncCallback\<LcdFlashStatus\>): void
4219
4220注销监听LCD闪光灯状态变化。
4221
4222**系统接口:** 此接口为系统接口。
4223
4224**系统能力:** SystemCapability.Multimedia.Camera.Core
4225
4226**参数:**
4227
4228| 参数名    | 类型                     | 必填 | 说明                                                               |
4229| -------- | ------------------------ | ---- |------------------------------------------------------------------|
4230| type     | string                   | 是   | 监听事件,固定为'lcdFlashStatus',session创建成功可取消监听。                       |
4231| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\> | 否   | 回调函数,可选,有就是匹配on('lcdFlashStatus') callback(callback对象不可是匿名函数)。 |
4232
4233**错误码:**
4234
4235以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4236
4237| 错误码ID | 错误信息                      |
4238|-------|---------------------------|
4239| 202   | Not System Application.   |
4240
4241**示例:**
4242
4243```ts
4244function unregisterLcdFlashStatus(portraitPhotoSession: camera.PortraitPhotoSession): void {
4245  portraitPhotoSession.off('lcdFlashStatus');
4246}
4247```
4248
4249## NightPhotoSession<sup>11+</sup>
4250
4251NightPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ColorManagement, ManualExposure
4252
4253夜景拍照模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置夜景拍照模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
4254
4255### on('error')<sup>11+</sup>
4256
4257on(type: 'error', callback: ErrorCallback): void
4258
4259监听夜景拍照会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
4260
4261**系统接口:** 此接口为系统接口。
4262
4263**系统能力:** SystemCapability.Multimedia.Camera.Core
4264
4265**参数:**
4266
4267| 参数名     | 类型                                                          | 必填 | 说明                           |
4268| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
4269| type     | string                                                      | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
4270| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
4271
4272**示例:**
4273
4274```ts
4275import { BusinessError } from '@kit.BasicServicesKit';
4276
4277function callback(err: BusinessError): void {
4278  console.error(`Night photo session error code: ${err.code}`);
4279}
4280
4281function registerSessionError(nightPhotoSession: camera.NightPhotoSession): void {
4282  nightPhotoSession.on('error', callback);
4283}
4284```
4285
4286### off('error')<sup>11+</sup>
4287
4288off(type: 'error', callback?: ErrorCallback): void
4289
4290注销监听夜景拍照会话的错误事件,通过注册回调函数获取结果。
4291
4292**系统接口:** 此接口为系统接口。
4293
4294**系统能力:** SystemCapability.Multimedia.Camera.Core
4295
4296**参数:**
4297
4298| 参数名     | 类型                        | 必填 | 说明                           |
4299| -------- | ------------------------ | ---- | ------------------------------ |
4300| type     | string    | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。 |
4301| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 否   | 回调函数,可选,有就是匹配on('error') callback(callback对象不可是匿名函数)。       |
4302
4303**示例:**
4304
4305```ts
4306function unregisterSessionError(nightPhotoSession: camera.NightPhotoSession): void {
4307  nightPhotoSession.off('error');
4308}
4309```
4310
4311### on('focusStateChange')<sup>11+</sup>
4312
4313on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4314
4315监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
4316
4317**系统接口:** 此接口为系统接口。
4318
4319**系统能力:** SystemCapability.Multimedia.Camera.Core
4320
4321**参数:**
4322
4323| 参数名     | 类型                    | 必填 | 说明                       |
4324| -------- | ---------------- | ---- | ------------------------ |
4325| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
4326| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 是   | 回调函数,用于获取当前对焦状态。  |
4327
4328**示例:**
4329
4330```ts
4331import { BusinessError } from '@kit.BasicServicesKit';
4332
4333function callback(err: BusinessError, focusState: camera.FocusState): void {
4334  if (err !== undefined && err.code !== 0) {
4335    console.error(`Callback Error, errorCode: ${err.code}`);
4336    return;
4337  }
4338  console.info(`Focus state: ${focusState}`);
4339}
4340
4341function registerFocusStateChange(nightPhotoSession: camera.NightPhotoSession): void {
4342  nightPhotoSession.on('focusStateChange', callback);
4343}
4344```
4345
4346### off('focusStateChange')<sup>11+</sup>
4347
4348off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4349
4350注销监听相机对焦的状态变化。
4351
4352**系统接口:** 此接口为系统接口。
4353
4354**系统能力:** SystemCapability.Multimedia.Camera.Core
4355
4356**参数:**
4357
4358| 参数名     | 类型                                      | 必填 | 说明                       |
4359| -------- | ----------------------------------------- | ---- | ------------------------ |
4360| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。 |
4361| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 否   | 回调函数,可选,有就是匹配on('focusStateChange') callback(callback对象不可是匿名函数)。  |
4362
4363**示例:**
4364
4365```ts
4366function unregisterFocusStateChange(nightPhotoSession: camera.NightPhotoSession): void {
4367  nightPhotoSession.off('focusStateChange');
4368}
4369```
4370
4371### on('smoothZoomInfoAvailable')<sup>11+</sup>
4372
4373on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
4374
4375监听相机平滑变焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
4376
4377**系统接口:** 此接口为系统接口。
4378
4379**系统能力:** SystemCapability.Multimedia.Camera.Core
4380
4381**参数:**
4382
4383| 参数名     | 类型                   | 必填 | 说明                       |
4384| -------- | ----------------------- | ---- | ------------------------ |
4385| type     | string                  | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
4386| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 是   | 回调函数,用于获取当前平滑变焦状态。  |
4387
4388**示例:**
4389
4390```ts
4391import { BusinessError } from '@kit.BasicServicesKit';
4392
4393function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
4394  if (err !== undefined && err.code !== 0) {
4395    console.error(`Callback Error, errorCode: ${err.code}`);
4396    return;
4397  }
4398  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
4399}
4400
4401function registerSmoothZoomInfo(nightPhotoSession: camera.NightPhotoSession): void {
4402  nightPhotoSession.on('smoothZoomInfoAvailable', callback);
4403}
4404```
4405
4406### off('smoothZoomInfoAvailable')<sup>11+</sup>
4407
4408off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
4409
4410注销监听相机平滑变焦的状态变化。
4411
4412**系统接口:** 此接口为系统接口。
4413
4414**系统能力:** SystemCapability.Multimedia.Camera.Core
4415
4416**参数:**
4417
4418| 参数名     | 类型                                      | 必填 | 说明                       |
4419| -------- | ----------------------------------------- | ---- | ------------------------ |
4420| type     | string              | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
4421| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 否   | 回调函数,可选,有就是匹配on('smoothZoomInfoAvailable') callback(callback对象不可是匿名函数)。  |
4422
4423**示例:**
4424
4425```ts
4426function unregisterSmoothZoomInfo(nightPhotoSession: camera.NightPhotoSession): void {
4427  nightPhotoSession.off('smoothZoomInfoAvailable');
4428}
4429```
4430
4431### on('lcdFlashStatus')<sup>12+</sup>
4432
4433on(type: 'lcdFlashStatus', callback: AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>): void
4434
4435监听lcd flash状态,通过注册回调函数获取结果。使用callback异步回调。
4436
4437**系统接口:** 此接口为系统接口。
4438
4439**系统能力:** SystemCapability.Multimedia.Camera.Core
4440
4441**参数:**
4442
4443| 参数名     | 类型                   | 必填 | 说明                       |
4444| -------- | ----------------------- | ---- | ------------------------ |
4445| type     | string                  | 是   | 监听事件,固定为'lcdFlashStatus',session创建成功可监听。|
4446| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\> | 是   | 回调函数,用于获取当前lcd flash状态。  |
4447
4448**错误码:**
4449
4450以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4451
4452| 错误码ID | 错误信息                      |
4453|-------|---------------------------|
4454| 202   | Not System Application.   |
4455
4456**示例:**
4457
4458```ts
4459import { BusinessError } from '@kit.BasicServicesKit';
4460
4461function callback(err: BusinessError, lcdFlashStatus: camera.LcdFlashStatus): void {
4462  if (err !== undefined && err.code !== 0) {
4463    console.error(`Callback Error, errorCode: ${err.code}`);
4464    return;
4465  }
4466  console.info(`lcdFlashStatus: ${lcdFlashStatus}`);
4467}
4468
4469function registerLcdFlashStatus(nightPhotoSession: camera.NightPhotoSession): void {
4470  nightPhotoSession.on('lcdFlashStatus', callback);
4471}
4472```
4473
4474### off('lcdFlashStatus')<sup>12+</sup>
4475
4476off(type: 'lcdFlashStatus', callback?: AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\>): void
4477
4478注销lcd flash状态,通过注册回调函数获取结果。
4479
4480**系统接口:** 此接口为系统接口。
4481
4482**系统能力:** SystemCapability.Multimedia.Camera.Core
4483
4484**参数:**
4485
4486| 参数名     | 类型                                      | 必填 | 说明                       |
4487| -------- | ----------------------------------------- | ---- | ------------------------ |
4488| type     | string              | 是   | 监听事件,固定为'lcdFlashStatus',session创建成功可监听。|
4489| callback | AsyncCallback\<[LcdFlashStatus](#lcdflashstatus12)\> | 否   | 回调函数,可选,有就是匹配on('lcdFlashStatus') callback(callback对象不可是匿名函数)。  |
4490
4491**错误码:**
4492
4493以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4494
4495| 错误码ID | 错误信息                      |
4496|-------|---------------------------|
4497| 202   | Not System Application.   |
4498
4499**示例:**
4500
4501```ts
4502function unregisterLcdFlashStatus(nightPhotoSession: camera.NightPhotoSession): void {
4503  nightPhotoSession.off('lcdFlashStatus');
4504}
4505```
4506
4507## HighResolutionPhotoSession<sup>12+</sup>
4508
4509HighResolutionPhotoSession extends Session, AutoExposure, Focus
4510
4511高像素拍照模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置高像素拍照模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
4512
4513### on('error')<sup>12+</sup>
4514
4515on(type: 'error', callback: ErrorCallback): void
4516
4517监听高像素拍照会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
4518
4519**系统接口:** 此接口为系统接口。
4520
4521**系统能力:** SystemCapability.Multimedia.Camera.Core
4522
4523**参数:**
4524
4525| 参数名     | 类型        | 必填 | 说明                           |
4526| -------- | --------------------------------- | ---- | ------------------------------ |
4527| type     | string                               | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
4528| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。        |
4529
4530**错误码:**
4531
4532以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4533
4534| 错误码ID         | 错误信息        |
4535| --------------- | --------------- |
4536| 202                |   Not System Application.               |
4537
4538**示例:**
4539
4540```ts
4541import { BusinessError } from '@kit.BasicServicesKit';
4542
4543function callback(err: BusinessError): void {
4544  console.error(`High resolution photo session error code: ${err.code}`);
4545}
4546
4547function registerSessionError(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4548  highResolutionPhotoSession.on('error', callback);
4549}
4550```
4551### off('error')<sup>12+</sup>
4552
4553off(type: 'error', callback?: ErrorCallback): void
4554
4555注销监听高像素拍照会话的错误事件,通过注册回调函数获取结果。
4556
4557**系统接口:** 此接口为系统接口。
4558
4559**系统能力:** SystemCapability.Multimedia.Camera.Core
4560
4561**参数:**
4562
4563| 参数名     | 类型                        | 必填 | 说明                           |
4564| -------- | ------------------------ | ---- | ------------------------------ |
4565| type     | string    | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。 |
4566| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 否   | 回调函数,可选,有就是匹配on('error') callback(callback对象不可是匿名函数)。       |
4567
4568**错误码:**
4569
4570以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4571
4572| 错误码ID         | 错误信息        |
4573| --------------- | --------------- |
4574| 202                |   Not System Application.               |
4575
4576**示例:**
4577
4578```ts
4579function unregisterSessionError(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4580  highResolutionPhotoSession.off('error');
4581}
4582```
4583
4584### on('focusStateChange')<sup>12+</sup>
4585
4586on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4587
4588监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
4589
4590**系统接口:** 此接口为系统接口。
4591
4592**系统能力:** SystemCapability.Multimedia.Camera.Core
4593
4594**参数:**
4595
4596| 参数名     | 类型                    | 必填 | 说明                       |
4597| -------- | ---------------- | ---- | ------------------------ |
4598| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
4599| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 是   | 回调函数,用于获取当前对焦状态。  |
4600
4601**错误码:**
4602
4603以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4604
4605| 错误码ID         | 错误信息        |
4606| --------------- | --------------- |
4607| 202                |   Not System Application.               |
4608
4609**示例:**
4610
4611```ts
4612import { BusinessError } from '@kit.BasicServicesKit';
4613
4614function callback(err: BusinessError, focusState: camera.FocusState): void {
4615  if (err !== undefined && err.code !== 0) {
4616    console.error(`Callback Error, errorCode: ${err.code}`);
4617    return;
4618  }
4619  console.info(`Focus state: ${focusState}`);
4620}
4621
4622function registerFocusStateChange(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4623  highResolutionPhotoSession.on('focusStateChange', callback);
4624}
4625```
4626
4627### off('focusStateChange')<sup>12+</sup>
4628
4629off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4630
4631注销监听相机对焦的状态变化。
4632
4633**系统接口:** 此接口为系统接口。
4634
4635**系统能力:** SystemCapability.Multimedia.Camera.Core
4636
4637**错误码:**
4638
4639以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4640
4641| 错误码ID         | 错误信息        |
4642| --------------- | --------------- |
4643| 202                |   Not System Application.               |
4644
4645**参数:**
4646
4647| 参数名     | 类型                                      | 必填 | 说明                       |
4648| -------- | ----------------------------------------- | ---- | ------------------------ |
4649| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。 |
4650| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 否   | 回调函数,可选,有就是匹配on('focusStateChange') callback(callback对象不可是匿名函数)。  |
4651
4652**示例:**
4653
4654```ts
4655function unregisterFocusStateChange(highResolutionPhotoSession: camera.HighResolutionPhotoSession): void {
4656  highResolutionPhotoSession.off('focusStateChange');
4657}
4658```
4659
4660## SketchStatusData<sup>11+</sup>
4661
4662画中画状态返回数据。
4663
4664**系统接口:** 此接口为系统接口。
4665
4666**系统能力:** SystemCapability.Multimedia.Camera.Core
4667
4668| 名称          | 类型      | 只读 | 必填 | 说明        |
4669| ------------- | -------- | ---- | ---- | ---------- |
4670| status        | number   | 否   | 是   | 画中画当前的状态。0:已停止,1:已启动,2:停止中,3:启动中。|
4671| sketchRatio   | number   | 否   | 是   | 画中画画面的Zoom倍率。|
4672
4673## SlowMotionVideoSession<sup>12+</sup>
4674
4675SlowMotionVideoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect
4676
4677慢动作录像模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置慢动作录像模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
4678
4679> **说明:**
4680> 慢动作模式下只能添加预览流和录像流。
4681### on('error')<sup>12+</sup>
4682
4683on(type: 'error', callback: ErrorCallback): void
4684
4685监听慢动作录像模式会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
4686
4687**系统接口:** 此接口为系统接口。
4688
4689**系统能力:** SystemCapability.Multimedia.Camera.Core
4690
4691**参数:**
4692
4693| 参数名     | 类型        | 必填 | 说明                           |
4694| -------- | --------------------------------- | ---- | ------------------------------ |
4695| type     | string                               | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
4696| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。        |
4697
4698**错误码:**
4699
4700以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4701
4702| 错误码ID   | 错误信息        |
4703|---------| --------------- |
4704| 202     |  Not System Application. |
4705
4706**示例:**
4707
4708```ts
4709import { BusinessError } from '@kit.BasicServicesKit';
4710
4711function callback(err: BusinessError): void {
4712  console.error(`Portrait photo session error code: ${err.code}`);
4713}
4714
4715function registerSessionError(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4716  slowMotionVideoSession.on('error', callback);
4717}
4718```
4719
4720### off('error')<sup>12+</sup>
4721
4722off(type: 'error', callback?: ErrorCallback): void
4723
4724注销慢动作录像模式会话的错误事件,通过注册回调函数获取结果。
4725
4726**系统接口:** 此接口为系统接口。
4727
4728**系统能力:** SystemCapability.Multimedia.Camera.Core
4729
4730**参数:**
4731
4732| 参数名     | 类型        | 必填 | 说明                           |
4733| -------- | -------------------------- | ---- | ------------------------------ |
4734| type     | string                     | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。 |
4735| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 否   | 回调函数,可选,有就是匹配on('error') callback(callback对象不可是匿名函数)。    |
4736
4737**错误码:**
4738
4739以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4740
4741| 错误码ID   | 错误信息        |
4742|---------| --------------- |
4743| 202     |  Not System Application. |
4744
4745**示例:**
4746
4747```ts
4748function unregisterSessionError(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4749  slowMotionVideoSession.off('error');
4750}
4751```
4752
4753### on('focusStateChange')<sup>12+</sup>
4754
4755on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
4756
4757监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
4758
4759**系统接口:** 此接口为系统接口。
4760
4761**系统能力:** SystemCapability.Multimedia.Camera.Core
4762
4763**参数:**
4764
4765| 参数名     | 类型                    | 必填 | 说明                       |
4766| -------- | ---------------- | ---- | ------------------------ |
4767| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
4768| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 是   | 回调函数,用于获取当前对焦状态。  |
4769
4770**错误码:**
4771
4772以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4773
4774| 错误码ID   | 错误信息        |
4775|---------| --------------- |
4776| 202     |  Not System Application. |
4777
4778**示例:**
4779
4780```ts
4781import { BusinessError } from '@kit.BasicServicesKit';
4782
4783function callback(err: BusinessError, focusState: camera.FocusState): void {
4784  if (err !== undefined && err.code !== 0) {
4785    console.error(`Callback Error, errorCode: ${err.code}`);
4786    return;
4787  }
4788  console.info(`Focus state: ${focusState}`);
4789}
4790
4791function registerFocusStateChange(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4792  slowMotionVideoSession.on('focusStateChange', callback);
4793}
4794```
4795
4796### off('focusStateChange')<sup>12+</sup>
4797
4798off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
4799
4800注销监听相机对焦的状态变化。
4801
4802**系统接口:** 此接口为系统接口。
4803
4804**系统能力:** SystemCapability.Multimedia.Camera.Core
4805
4806**参数:**
4807
4808| 参数名     | 类型                                      | 必填 | 说明                       |
4809| -------- | ----------------------------------------- | ---- | ------------------------ |
4810| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。 |
4811| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 否   | 回调函数,可选,有就是匹配on('focusStateChange') callback(callback对象不可是匿名函数)。  |
4812
4813**错误码:**
4814
4815以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4816
4817| 错误码ID   | 错误信息        |
4818|---------| --------------- |
4819| 202     |  Not System Application. |
4820
4821**示例:**
4822
4823```ts
4824function unregisterFocusStateChange(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4825  slowMotionVideoSession.off('focusStateChange');
4826}
4827```
4828
4829### on('smoothZoomInfoAvailable')<sup>12+</sup>
4830
4831on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
4832
4833监听相机平滑变焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
4834
4835**系统接口:** 此接口为系统接口。
4836
4837**系统能力:** SystemCapability.Multimedia.Camera.Core
4838
4839**参数:**
4840
4841| 参数名     | 类型                   | 必填 | 说明                       |
4842| -------- | ----------------------- | ---- | ------------------------ |
4843| type     | string                  | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
4844| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 是   | 回调函数,用于获取当前平滑变焦状态。  |
4845
4846**错误码:**
4847
4848以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4849
4850| 错误码ID   | 错误信息        |
4851|---------| --------------- |
4852| 202     |  Not System Application. |
4853
4854**示例:**
4855
4856```ts
4857import { BusinessError } from '@kit.BasicServicesKit';
4858
4859function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
4860  if (err !== undefined && err.code !== 0) {
4861    console.error(`Callback Error, errorCode: ${err.code}`);
4862    return;
4863  }
4864  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
4865}
4866
4867function registerSmoothZoomInfo(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4868  slowMotionVideoSession.on('smoothZoomInfoAvailable', callback);
4869}
4870```
4871
4872### off('smoothZoomInfoAvailable')<sup>12+</sup>
4873
4874off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
4875
4876注销监听相机平滑变焦的状态变化。
4877
4878**系统接口:** 此接口为系统接口。
4879
4880**系统能力:** SystemCapability.Multimedia.Camera.Core
4881
4882**参数:**
4883
4884| 参数名     | 类型                                      | 必填 | 说明                       |
4885| -------- | ----------------------------------------- | ---- | ------------------------ |
4886| type     | string              | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
4887| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 否   | 回调函数,可选,有就是匹配on('smoothZoomInfoAvailable') callback(callback对象不可是匿名函数)。  |
4888
4889**错误码:**
4890
4891以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4892
4893| 错误码ID   | 错误信息        |
4894|---------| --------------- |
4895| 202     |  Not System Application. |
4896
4897**示例:**
4898
4899```ts
4900function unregisterSmoothZoomInfo(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4901  slowMotionVideoSession.off('smoothZoomInfoAvailable');
4902}
4903```
4904
4905### on('slowMotionStatus')<sup>12+</sup>
4906
4907on(type: 'slowMotionStatus', callback: AsyncCallback\<SlowMotionStatus\>): void
4908
4909监听慢动作状态变化,通过注册回调函数获取结果。使用callback异步回调。
4910
4911**系统接口:** 此接口为系统接口。
4912
4913**系统能力:** SystemCapability.Multimedia.Camera.Core
4914
4915**参数:**
4916
4917| 参数名     | 类型                                                                        | 必填 | 说明                                         |
4918| -------- |---------------------------------------------------------------------------| ---- |--------------------------------------------|
4919| type     | string                                                                    | 是   | 监听事件,固定为'slowMotionStatus',session创建成功可监听。 |
4920| callback | AsyncCallback\<[SlowMotionStatus](#slowmotionstatus12)\> | 是   | 回调函数,用于获取当前慢动作状态。当慢动作状态发生变动时,此回调函数也会被执行。   |
4921
4922**错误码:**
4923
4924以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4925
4926| 错误码ID   | 错误信息        |
4927|---------| --------------- |
4928| 202     |  Not System Application. |
4929
4930**示例:**
4931
4932```ts
4933import { BusinessError } from '@kit.BasicServicesKit';
4934
4935function callback(err: BusinessError, slowMotionStatus: camera.SlowMotionStatus): void {
4936  if (err !== undefined && err.code !== 0) {
4937    console.error(`Callback Error, errorCode: ${err.code}`);
4938    return;
4939  }
4940  console.info(`The slow motion status: ${slowMotionStatus}`);
4941}
4942
4943function registerSlowMotionStatus(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4944  slowMotionVideoSession.on('slowMotionStatus', callback);
4945}
4946```
4947
4948### off('slowMotionStatus')<sup>12+</sup>
4949
4950off(type: 'slowMotionStatus', callback?: AsyncCallback\<SlowMotionStatus\>): void
4951
4952注销慢动作状态变化。
4953
4954**系统接口:** 此接口为系统接口。
4955
4956**系统能力:** SystemCapability.Multimedia.Camera.Core
4957
4958**参数:**
4959
4960| 参数名     | 类型                                      | 必填 | 说明                       |
4961| -------- | ----------------------------------------- | ---- | ------------------------ |
4962| type     | string              | 是   | 监听事件,固定为'slowMotionStatus',session创建成功可监听。|
4963| callback | AsyncCallback\<[SlowMotionStatus](#slowmotionstatus12)\> | 否   | 回调函数,可选,有就是匹配on('slowMotionStatus') callback(callback对象不可是匿名函数)。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。  |
4964
4965**错误码:**
4966
4967以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
4968
4969| 错误码ID   | 错误信息        |
4970|---------| --------------- |
4971| 202     |  Not System Application.                               |
4972
4973**示例:**
4974
4975```ts
4976function unregisterSlowMotionStatus(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
4977  slowMotionVideoSession.off('slowMotionStatus');
4978}
4979```
4980### isSlowMotionDetectionSupported<sup>12+</sup>
4981
4982isSlowMotionDetectionSupported(): boolean
4983
4984查询当前设备是否支持慢动作检测功能。
4985
4986> **说明:**
4987> 该接口需要在[commitConfig](js-apis-camera.md#commitconfig11-1)之后调用。
4988
4989**系统接口:** 此接口为系统接口。
4990
4991**系统能力:** SystemCapability.Multimedia.Camera.Core
4992
4993**返回值:**
4994
4995| 类型        | 说明                                                                                     |
4996| ---------- |----------------------------------------------------------------------------------------|
4997| boolean    | 返回true表示支持慢动作检测功能,false表示不支持。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
4998
4999**错误码:**
5000
5001以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5002
5003| 错误码ID   | 错误信息        |
5004|---------| --------------- |
5005| 202     |  Not System Application.                               |
5006| 7400103 |  Session not config.                                   |
5007
5008**示例:**
5009
5010```ts
5011import { BusinessError } from '@kit.BasicServicesKit';
5012
5013function isSlowMotionDetectionSupported(slowMotionVideoSession: camera.SlowMotionVideoSession): boolean {
5014  let isSupported: boolean = false;
5015  try {
5016    isSupported = slowMotionVideoSession.isSlowMotionDetectionSupported();
5017  } catch (error) {
5018    // 失败返回错误码error.code并处理
5019    let err = error as BusinessError;
5020    console.error(`The isFocusModeSupported call failed. error code: ${err.code}`);
5021  }
5022  return isSupported;
5023}
5024```
5025
5026### setSlowMotionDetectionArea<sup>12+</sup>
5027
5028setSlowMotionDetectionArea(area: Rect): void
5029
5030设置一个进行慢动作检测的区域。
5031
5032> **说明:**
5033> 在调用该方法之前,先调用[isSlowMotionDetectionSupported](#isslowmotiondetectionsupported12)确认设备是否支持慢动作检测功能, 才能保证其他相关方法的正常运行。
5034该接口需要在[commitConfig](js-apis-camera.md#commitconfig11-1)之后调用。
5035
5036**系统接口:** 此接口为系统接口。
5037
5038**系统能力:** SystemCapability.Multimedia.Camera.Core
5039
5040**参数:**
5041
5042| 参数名     | 类型                                            | 必填 | 说明                          |
5043| -------- | ---------------------------------------------- | ---- | --------------------------- |
5044| area  | [Rect](js-apis-camera.md#rect)      | 是   | 矩形定义。                   |
5045
5046**错误码:**
5047
5048以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5049
5050| 错误码ID   | 错误信息        |
5051|---------| --------------- |
5052| 202     |  Not System Application.                            |
5053| 7400101 |  Parameter missing or parameter type incorrect.     |
5054| 7400103 |  Session not config.                                |
5055
5056**示例:**
5057
5058```ts
5059import { BusinessError } from '@kit.BasicServicesKit';
5060
5061function setSlowMotionDetectionArea(slowMotionVideoSession: camera.SlowMotionVideoSession): void {
5062  try {
5063    slowMotionVideoSession.setSlowMotionDetectionArea({topLeftX: 0.1, topLeftY: 0.1, width: 0.8, height: 0.8});
5064  } catch (error) {
5065    // 失败返回错误码error.code并处理
5066    let err = error as BusinessError;
5067    console.error(`The setSlowMotionDetectionArea call failed. error code: ${err.code}`);
5068  }
5069}
5070```
5071
5072## PanoramaPhotoSession<sup>12+</sup>
5073
5074PanoramaPhotoSession extends Session, Focus, AutoExposure, WhiteBalance, ColorEffect
5075
5076全景拍照模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置全景拍照模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
5077
5078### on('error')<sup>12+</sup>
5079
5080on(type: 'error', callback: ErrorCallback): void
5081
5082监听全景拍照会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
5083
5084**系统接口:** 此接口为系统接口。
5085
5086**系统能力:** SystemCapability.Multimedia.Camera.Core
5087
5088**参数:**
5089
5090| 参数名     | 类型                                                          | 必填 | 说明                           |
5091| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
5092| type     | string                                                      | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
5093| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
5094
5095**示例:**
5096
5097```ts
5098import { BusinessError } from '@kit.BasicServicesKit';
5099
5100function callback(err: BusinessError): void {
5101  console.error(`Panorama photo session error code: ${err.code}`);
5102}
5103
5104function registerSessionError(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
5105  panoramaPhotoSession.on('error', callback);
5106}
5107```
5108
5109### off('error')<sup>11+</sup>
5110
5111off(type: 'error', callback?: ErrorCallback): void
5112
5113注销监听全景拍照会话的错误事件,通过注册回调函数获取结果。
5114
5115**系统接口:** 此接口为系统接口。
5116
5117**系统能力:** SystemCapability.Multimedia.Camera.Core
5118
5119**参数:**
5120
5121| 参数名     | 类型                        | 必填 | 说明                           |
5122| -------- | ------------------------ | ---- | ------------------------------ |
5123| type     | string    | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。 |
5124| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 否   | 回调函数,可选,有就是匹配on('error') callback(callback对象不可是匿名函数)。       |
5125
5126**示例:**
5127
5128```ts
5129function unregisterSessionError(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
5130  panoramaPhotoSession.off('error');
5131}
5132```
5133
5134### on('focusStateChange')<sup>11+</sup>
5135
5136on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
5137
5138监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
5139
5140**系统接口:** 此接口为系统接口。
5141
5142**系统能力:** SystemCapability.Multimedia.Camera.Core
5143
5144**参数:**
5145
5146| 参数名     | 类型                    | 必填 | 说明                       |
5147| -------- | ---------------- | ---- | ------------------------ |
5148| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
5149| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 是   | 回调函数,用于获取当前对焦状态。  |
5150
5151**示例:**
5152
5153```ts
5154import { BusinessError } from '@kit.BasicServicesKit';
5155
5156function callback(err: BusinessError, focusState: camera.FocusState): void {
5157  if (err !== undefined && err.code !== 0) {
5158    console.error(`Callback Error, errorCode: ${err.code}`);
5159    return;
5160  }
5161  console.info(`Focus state: ${focusState}`);
5162}
5163
5164function registerFocusStateChange(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
5165  panoramaPhotoSession.on('focusStateChange', callback);
5166}
5167```
5168
5169### off('focusStateChange')<sup>11+</sup>
5170
5171off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
5172
5173注销监听相机对焦的状态变化。
5174
5175**系统接口:** 此接口为系统接口。
5176
5177**系统能力:** SystemCapability.Multimedia.Camera.Core
5178
5179**参数:**
5180
5181| 参数名     | 类型                                      | 必填 | 说明                       |
5182| -------- | ----------------------------------------- | ---- | ------------------------ |
5183| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。 |
5184| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 否   | 回调函数,可选,有就是匹配on('focusStateChange') callback(callback对象不可是匿名函数)。  |
5185
5186**示例:**
5187
5188```ts
5189function unregisterFocusStateChange(panoramaPhotoSession: camera.PanoramaPhotoSession): void {
5190  panoramaPhotoSession.off('focusStateChange');
5191}
5192```
5193
5194## IsoInfo<sup>12+</sup>
5195
5196ISO参数信息。
5197
5198**系统接口:** 此接口为系统接口。
5199
5200**系统能力:** SystemCapability.Multimedia.Camera.Core
5201
5202| 名称 | 类型    | 只读 | 可选 | 说明           |
5203| ---- | ------- | ---- |--| -------------- |
5204| iso  | number  | 是   | 是 | ISO值。        |
5205
5206---
5207
5208## ExposureInfo<sup>12+</sup>
5209
5210曝光参数信息。
5211
5212**系统接口:** 此接口为系统接口。
5213
5214**系统能力:** SystemCapability.Multimedia.Camera.Core
5215
5216| 名称              | 类型    | 只读 | 可选  | 说明               |
5217| ----------------- | ------- | ---- |-----| ------------------ |
5218| exposureTime | number  | 是   | 是   | 曝光时间值,单位为毫秒。 |
5219
5220---
5221
5222## ApertureInfo<sup>12+</sup>
5223
5224光圈参数信息。
5225
5226**系统接口:** 此接口为系统接口。
5227
5228**系统能力:** SystemCapability.Multimedia.Camera.Core
5229
5230| 名称      | 类型    | 只读 | 可选  | 说明       |
5231| --------- | ------- | ---- |-----| ---------- |
5232| aperture  | number  | 是   | 是   | 光圈值。   |
5233
5234---
5235
5236## LuminationInfo<sup>12+</sup>
5237
5238光照参数信息。
5239
5240**系统接口:** 此接口为系统接口。
5241
5242**系统能力:** SystemCapability.Multimedia.Camera.Core
5243
5244| 名称        | 类型    | 只读 | 可选  | 说明       |
5245| ----------- | ------- | ---- |-----| ---------- |
5246| lumination  | number  | 是   | 是   | 范围[0,1],光照值归一化数值|
5247
5248## CameraFormat
5249
5250枚举,输出格式。
5251
5252**系统能力:** SystemCapability.Multimedia.Camera.Core
5253
5254| 名称                     | 值        | 说明         |
5255| ----------------------- | --------- | ------------ |
5256| CAMERA_FORMAT_DNG<sup>12+</sup>  | 4         | DNG格式的RAW图片。**系统接口:** 此接口为系统接口。         |
5257
5258## ExposureMeteringMode<sup>12+</sup>
5259
5260枚举,测光模式。
5261
5262**系统接口:** 此接口为系统接口。
5263
5264**系统能力:** SystemCapability.Multimedia.Camera.Core
5265
5266| 名称                           | 值   | 说明         |
5267| ----------------------------- | ---- | ----------- |
5268| MATRIX          | 0    | 对画面广泛区域进行测光。 |
5269| CENTER          | 1    | 对整个画面进行测光,但最大比重分配给中央区域。 |
5270| SPOT            | 2    | 对画面测光点周围约2.5%进行测光 |
5271
5272## AutoExposureQuery<sup>12+</sup>
5273
5274提供了查询设备是否支持特定曝光模式,曝光补偿的范围,以及是否支持特定的曝光测光模式的方法。
5275
5276### isExposureMeteringModeSupported<sup>12+</sup>
5277
5278isExposureMeteringModeSupported(aeMeteringMode: ExposureMeteringMode): boolean
5279
5280检测传入的测光模式是否支持。
5281
5282**系统接口:** 此接口为系统接口。
5283
5284**系统能力:** SystemCapability.Multimedia.Camera.Core
5285
5286**参数:**
5287
5288| 参数名      | 类型                           | 必填  | 说明                           |
5289| -------- | -------------------------------| ---- | ----------------------------- |
5290| aeMeteringMode   | [ExposureMeteringMode](#exposuremeteringmode12)  | 是   | 测光模式。                      |
5291
5292**返回值:**
5293
5294| 类型        | 说明                          |
5295| ---------- | ----------------------------- |
5296| boolean    | 获取是否支持传入的测光模式。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
5297
5298**错误码:**
5299
5300以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5301
5302| 错误码ID         | 错误信息        |
5303| --------------- | --------------- |
5304| 202     | Not System Application. |
5305| 7400101                |  Parameter missing or parameter type incorrect.                                   |
5306| 7400103                |  Session not config.                                   |
5307
5308
5309**示例:**
5310
5311```ts
5312import { BusinessError } from '@kit.BasicServicesKit';
5313
5314function isExposureMeteringModeSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5315  let isSupported: boolean = false;
5316  try {
5317    isSupported = professionalPhotoSession.isExposureModeSupported(camera.ExposureMeteringMode.CENTER);
5318  } catch (error) {
5319    // 失败返回错误码error.code并处理
5320    let err = error as BusinessError;
5321    console.error(`The isExposureMeteringModeSupported call failed. error code: ${err.code}`);
5322  }
5323  return isSupported;
5324}
5325```
5326
5327## AutoExposure
5328
5329AutoExposure extends [AutoExposureQuery](#autoexposurequery12)
5330
5331提供了处理设备自动曝光的相关功能,包括获取和设置曝光模式、测量点,查询补偿范围,设定曝光补偿,和获取设置曝光的测光模式。
5332
5333### getExposureMeteringMode<sup>12+</sup>
5334
5335getExposureMeteringMode(): ExposureMeteringMode
5336
5337获取当前测光模式。
5338
5339**系统接口:** 此接口为系统接口。
5340
5341**系统能力:** SystemCapability.Multimedia.Camera.Core
5342
5343**返回值:**
5344
5345| 类型        | 说明                          |
5346| ---------- | ----------------------------- |
5347| [ExposureMeteringMode](#exposuremeteringmode12)    | 获取当前测光模式。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
5348
5349**错误码:**
5350
5351以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5352
5353| 错误码ID         | 错误信息        |
5354| --------------- | --------------- |
5355| 7400103                |  Session not config.                                   |
5356| 202     | Not System Application. |
5357
5358**示例:**
5359
5360```ts
5361import { BusinessError } from '@kit.BasicServicesKit';
5362
5363function getExposureMeteringMode(professionalPhotoSession: camera.ProfessionalPhotoSession): camera.ExposureMeteringMode | undefined {
5364  let exposureMeteringMode: camera.ExposureMeteringMode | undefined = undefined;
5365  try {
5366    exposureMeteringMode = professionalPhotoSession.getExposureMeteringMode();
5367  } catch (error) {
5368    // 失败返回错误码error.code并处理
5369    let err = error as BusinessError;
5370    console.error(`The getExposureMeteringMode call failed. error code: ${err.code}`);
5371  }
5372  return exposureMeteringMode;
5373}
5374```
5375
5376### setExposureMeteringMode<sup>12+</sup>
5377
5378setExposureMeteringMode(aeMeteringMode: ExposureMeteringMode): void
5379
5380设置测光模式。进行设置之前,需要先检查设备是否支持指定的测光模式,可使用方法[isExposureMeteringModeSupported](#isexposuremeteringmodesupported12)。
5381
5382**系统接口:** 此接口为系统接口。
5383
5384**系统能力:** SystemCapability.Multimedia.Camera.Core
5385
5386**参数:**
5387
5388| 参数名      | 类型                            | 必填 | 说明                    |
5389| -------- | -------------------------------| ---- | ----------------------- |
5390| aeMeteringMode   | [ExposureMeteringMode](#exposuremeteringmode12)  | 是   | 测光模式。                |
5391
5392**错误码:**
5393
5394以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5395
5396| 错误码ID         | 错误信息        |
5397| --------------- | --------------- |
5398| 202     | Not System Application. |
5399| 7400101                |  Parameter missing or parameter type incorrect.        |
5400| 7400103                |  Session not config.                                   |
5401
5402**示例:**
5403
5404```ts
5405import { BusinessError } from '@kit.BasicServicesKit';
5406
5407function setExposureMeteringMode(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5408  try {
5409    professionalPhotoSession.setExposureMeteringMode(camera.ExposureMeteringMode.CENTER);
5410  } catch (error) {
5411    // 失败返回错误码error.code并处理
5412    let err = error as BusinessError;
5413    console.error(`The setExposureMeteringMode call failed. error code: ${err.code}`);
5414  }
5415}
5416```
5417
5418## FocusQuery<sup>12+</sup>
5419
5420提供了查询是否支持对焦辅助的方法。
5421
5422### isFocusAssistSupported<sup>12+</sup>
5423
5424isFocusAssistSupported(): boolean
5425
5426检测是否支持对焦辅助灯。
5427
5428**系统接口:** 此接口为系统接口。
5429
5430**系统能力:** SystemCapability.Multimedia.Camera.Core
5431
5432**返回值:**
5433
5434| 类型        | 说明                          |
5435| ---------- | ----------------------------- |
5436| boolean    | 返回true表示支持对焦辅助灯,false表示不支持。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
5437
5438**错误码:**
5439
5440以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5441
5442| 错误码ID         | 错误信息        |
5443| --------------- | --------------- |
5444| 7400103                |  Session not config.                                   |
5445| 202     | Not System Application. |
5446
5447**示例:**
5448
5449```ts
5450import { BusinessError } from '@kit.BasicServicesKit';
5451
5452function isFocusAssistSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5453  let status: boolean = false;
5454  try {
5455    status = professionalPhotoSession.isFocusAssistSupported();
5456  } catch (error) {
5457    // 失败返回错误码error.code并处理
5458    let err = error as BusinessError;
5459    console.error(`The isFocusAssistSupported call failed. error code: ${err.code}`);
5460  }
5461  return status;
5462}
5463```
5464
5465## Focus
5466
5467Focus extends [FocusQuery](#focusquery12)
5468
5469提供了获取和设置相机对焦模式和对焦点位置的方法。
5470
5471### setFocusAssist<sup>12+</sup>
5472
5473setFocusAssist(enabled: boolean): void
5474
5475设置对焦辅助灯。进行设置之前,需要先检查设备是否支持对焦辅助灯,可使用方法[isFocusAssistSupported](#isfocusassistsupported12)。
5476
5477**系统接口:** 此接口为系统接口。
5478
5479**系统能力:** SystemCapability.Multimedia.Camera.Core
5480
5481**参数:**
5482
5483| 参数名      | 类型                     | 必填 | 说明                 |
5484| -------- | ----------------------- | ---- | ------------------- |
5485| enabled | boolean | 是   | true:开启对焦辅助灯,false:关闭对焦辅助灯。 |
5486
5487**错误码:**
5488
5489以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5490
5491| 错误码ID         | 错误信息        |
5492| --------------- | --------------- |
5493| 202     | Not System Application. |
5494| 7400101                |  Parameter missing or parameter type incorrect.        |
5495| 7400103                |  Session not config.                                   |
5496
5497
5498**示例:**
5499
5500```ts
5501import { BusinessError } from '@kit.BasicServicesKit';
5502
5503function setFocusAssist(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5504  try {
5505    professionalPhotoSession.setFocusAssist(false);
5506  } catch (error) {
5507    // 失败返回错误码error.code并处理
5508    let err = error as BusinessError;
5509    console.error(`The setFocusAssist call failed. error code: ${err.code}`);
5510  }
5511}
5512```
5513
5514### getFocusAssist<sup>12+</sup>
5515
5516getFocusAssist(): boolean
5517
5518获取对焦辅助灯是否开启。
5519
5520**系统接口:** 此接口为系统接口。
5521
5522**系统能力:** SystemCapability.Multimedia.Camera.Core
5523
5524**返回值:**
5525
5526| 类型        | 说明                          |
5527| ---------- | ----------------------------- |
5528| boolean    | 返回true表示相机已打开对焦辅助灯,返回false表示相机已关闭对焦辅助灯。 |
5529
5530**错误码:**
5531
5532以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5533
5534| 错误码ID         | 错误信息        |
5535| --------------- | --------------- |
5536| 7400103                |  Session not config.                                   |
5537| 202     | Not System Application. |
5538
5539**示例:**
5540
5541```ts
5542import { BusinessError } from '@kit.BasicServicesKit';
5543
5544function getFocusAssist(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5545  let isFocusAssistOpened: boolean;
5546  try {
5547    isFocusAssistOpened = professionalPhotoSession.getFocusAssist();
5548  } catch (error) {
5549    // 失败返回错误码error.code并处理
5550    let err = error as BusinessError;
5551    console.error(`The getFocusAssist call failed. error code: ${err.code}`);
5552  }
5553  return isFocusAssistOpened;
5554}
5555```
5556
5557## ManualFocus<sup>12+</sup>
5558
5559手动对焦类,对设备手动设置对焦操作。
5560
5561### setFocusDistance<sup>12+</sup>
5562
5563setFocusDistance(distance: number): void
5564
5565手动设置对焦距离,可设置范围为[0,1]之间的浮点数,0表现为近景,1表现为远景。
5566
5567**系统接口:** 此接口为系统接口。
5568
5569**系统能力:** SystemCapability.Multimedia.Camera.Core
5570
5571**参数:**
5572
5573| 参数名      | 类型                     | 必填 | 说明                 |
5574| -------- | ----------------------- | ---- | ------------------- |
5575| distance | number | 是   | 范围0-1:该值为归一化值,0为近景,1为远景,<br>可在该范围内调节 |
5576
5577**错误码:**
5578
5579以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5580
5581| 错误码ID         | 错误信息        |
5582| --------------- | --------------- |
5583| 202     | Not System Application. |
5584| 7400101                |  Parameter missing or parameter type incorrect.        |
5585| 7400103                |  Session not config.                                   |
5586
5587**示例:**
5588
5589```ts
5590import { BusinessError } from '@kit.BasicServicesKit';
5591
5592function setFocusDistance(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5593  try {
5594    let distance: number = 0.5;
5595    professionalPhotoSession.setFocusDistance(distance);
5596  } catch (error) {
5597    // 失败返回错误码error.code并处理
5598    let err = error as BusinessError;
5599    console.error(`The setFocusDistance call failed. error code: ${err.code}`);
5600  }
5601}
5602```
5603
5604### getFocusDistance<sup>12+</sup>
5605
5606getFocusDistance(): number
5607
5608获取当前的对焦距离。
5609
5610**系统接口:** 此接口为系统接口。
5611
5612**系统能力:** SystemCapability.Multimedia.Camera.Core
5613
5614**返回值:**
5615
5616| 类型        | 说明                          |
5617| ---------- | ----------------------------- |
5618| number    | 返回当前对焦距离的归一化值。 |
5619
5620**错误码:**
5621
5622以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5623
5624| 错误码ID         | 错误信息        |
5625| --------------- | --------------- |
5626| 7400103                |  Session not config.                                   |
5627| 202     | Not System Application. |
5628
5629**示例:**
5630
5631```ts
5632import { BusinessError } from '@kit.BasicServicesKit';
5633
5634function getFocusDistance(professionalPhotoSession: camera.ProfessionalPhotoSession): number {
5635  let distance: number = 0;
5636  try {
5637    distance = professionalPhotoSession.getFocusDistance();
5638  } catch (error) {
5639    // 失败返回错误码error.code并处理
5640    let err = error as BusinessError;
5641    console.error(`The getFocusDistance call failed. error code: ${err.code}`);
5642  }
5643  return distance;
5644}
5645```
5646
5647## ManualIsoQuery<sup>12+</sup>
5648
5649提供了查询设备是否支持手动设置ISO和获取设备支持的ISO范围的方法。
5650
5651### isManualIsoSupported<sup>12+</sup>
5652
5653isManualIsoSupported(): boolean
5654
5655检测是否支持手动ISO。
5656
5657**系统接口:** 此接口为系统接口。
5658
5659**系统能力:** SystemCapability.Multimedia.Camera.Core
5660
5661**返回值:**
5662
5663| 类型        | 说明                          |
5664| ---------- | ----------------------------- |
5665| boolean    | 返回true表示支持手动调节ISO,false表示不支持。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
5666
5667**错误码:**
5668
5669以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5670
5671| 错误码ID         | 错误信息        |
5672| --------------- | --------------- |
5673| 7400103                |  Session not config.                                   |
5674| 202     | Not System Application. |
5675
5676**示例:**
5677
5678```ts
5679import { BusinessError } from '@kit.BasicServicesKit';
5680
5681function isManualIsoSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5682  let status: boolean = false;
5683  try {
5684    status = professionalPhotoSession.isManualIsoSupported();
5685  } catch (error) {
5686    // 失败返回错误码error.code并处理
5687    let err = error as BusinessError;
5688    console.error(`The isManualIsoSupported call failed. error code: ${err.code}`);
5689  }
5690  return status;
5691}
5692```
5693
5694### getIsoRange<sup>12+</sup>
5695
5696getIsoRange(): Array\<number\>
5697
5698获取支持的ISO范围。
5699
5700**系统接口:** 此接口为系统接口。
5701
5702**系统能力:** SystemCapability.Multimedia.Camera.Core
5703
5704**返回值:**
5705
5706| 类型        | 说明                          |
5707| ---------- | ----------------------------- |
5708| Array\<number\>   | 用于获取ISO范围,范围为[50,100,...,6400],实际根据底层能力返回为准,接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
5709
5710**错误码:**
5711
5712以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5713
5714| 错误码ID         | 错误信息        |
5715| --------------- | --------------- |
5716| 202     | Not System Application. |
5717| 7400103                |  Session not config.                                   |
5718
5719**示例:**
5720
5721```ts
5722import { BusinessError } from '@kit.BasicServicesKit';
5723
5724function getIsoRange(professionalPhotoSession: camera.ProfessionalPhotoSession): Array<number> {
5725  let isoRange: Array<number> = [];
5726  try {
5727    isoRange = professionalPhotoSession.getIsoRange();
5728  } catch (error) {
5729    // 失败返回错误码error.code并处理
5730    let err = error as BusinessError;
5731    console.error(`The getIsoRange call failed. error code: ${err.code}`);
5732  }
5733  return isoRange;
5734}
5735```
5736
5737## ManualIso<sup>12+</sup>
5738
5739ManualIso extends [ManualIsoQuery](#manualisoquery12)
5740
5741提供了获取和设置设备手动ISO(感光度)的功能。
5742
5743### setIso<sup>12+</sup>
5744setIso(iso: number): void
5745
5746设置ISO值。**注意:当ISO值设置为0时,表示设置自动ISO**
5747
5748**系统接口:** 此接口为系统接口。
5749
5750**系统能力:** SystemCapability.Multimedia.Camera.Core
5751
5752**参数:**
5753
5754| 参数名      | 类型                     | 必填 | 说明                 |
5755| -------- | ----------------------- | ---- | ------------------- |
5756| iso | number | 是   | 设置ISO值, |
5757
5758**错误码:**
5759
5760以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5761
5762| 错误码ID         | 错误信息        |
5763| --------------- | --------------- |
5764| 202     | Not System Application. |
5765| 7400101                |  Parameter missing or parameter type incorrect.        |
5766| 7400103                |  Session not config.                                   |
5767
5768**示例:**
5769
5770```ts
5771import { BusinessError } from '@kit.BasicServicesKit';
5772
5773function setIso(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5774  try {
5775    let iso: number = 200;
5776    professionalPhotoSession.setIso(iso);
5777  } catch (error) {
5778    // 失败返回错误码error.code并处理
5779    let err = error as BusinessError;
5780    console.error(`The setIso call failed. error code: ${err.code}`);
5781  }
5782}
5783```
5784
5785### getIso<sup>12+</sup>
5786
5787getIso(): number
5788
5789获取当前的ISO值。
5790
5791**系统接口:** 此接口为系统接口。
5792
5793**系统能力:** SystemCapability.Multimedia.Camera.Core
5794
5795**返回值:**
5796
5797| 类型        | 说明                          |
5798| ---------- | ----------------------------- |
5799| number    | 返回当前ISO值。 |
5800
5801**错误码:**
5802
5803以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5804
5805| 错误码ID         | 错误信息        |
5806| --------------- | --------------- |
5807| 202     | Not System Application. |
5808| 7400103                |  Session not config.                                   |
5809
5810**示例:**
5811
5812```ts
5813import { BusinessError } from '@kit.BasicServicesKit';
5814
5815function getIso(professionalPhotoSession: camera.ProfessionalPhotoSession): number {
5816  let iso: number = 0;
5817  try {
5818    iso = professionalPhotoSession.getIso();
5819  } catch (error) {
5820    // 失败返回错误码error.code并处理
5821    let err = error as BusinessError;
5822    console.error(`The getIso call failed. error code: ${err.code}`);
5823  }
5824  return iso;
5825}
5826```
5827
5828## WhiteBalanceMode<sup>12+</sup>
5829
5830枚举,白平衡模式。
5831
5832**系统接口:** 此接口为系统接口。
5833
5834**系统能力:** SystemCapability.Multimedia.Camera.Core
5835
5836| 名称                           | 值   | 说明         |
5837| ----------------------------- | ---- | ----------- |
5838| AUTO          | 0    | 自动 |
5839| CLOUDY        | 1    | 阴天 |
5840| INCANDESCENT  | 2    | 白炽光 |
5841| FLUORESCENT   | 3    | 荧光 |
5842| DAYLIGHT     	| 4    | 日光 |
5843| MANUAL        | 5    | 手动 |
5844
5845## WhiteBalanceQuery<sup>12+</sup>
5846
5847提供了查询设备对指定的白平衡模式是否支持,以及获取设备支持的白平衡模式范围的方法。
5848
5849### isWhiteBalanceModeSupported<sup>12+</sup>
5850
5851isWhiteBalanceModeSupported(mode: WhiteBalanceMode): boolean
5852
5853检测是否支持当前传入的白平衡模式。
5854
5855**系统接口:** 此接口为系统接口。
5856
5857**系统能力:** SystemCapability.Multimedia.Camera.Core
5858**参数:**
5859
5860| 参数名      | 类型                           | 必填  | 说明                           |
5861| -------- | -------------------------------| ---- | ----------------------------- |
5862| mode   | [WhiteBalanceMode](#whitebalancemode12)  | 是   | 白平衡模式。                      |
5863
5864**返回值:**
5865
5866| 类型        | 说明                          |
5867| ---------- | ----------------------------- |
5868| boolean    | 返回true表示支持该白平衡模式,false表示不支持。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
5869
5870**错误码:**
5871
5872以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5873
5874| 错误码ID         | 错误信息        |
5875| --------------- | --------------- |
5876| 202     | Not System Application. |
5877| 7400101                |  Parameter missing or parameter type incorrect.        |
5878| 7400103                |  Session not config.                                   |
5879
5880**示例:**
5881
5882```ts
5883import { BusinessError } from '@kit.BasicServicesKit';
5884
5885function isWhiteBalanceModeSupported(professionalPhotoSession: camera.ProfessionalPhotoSession): boolean {
5886  let status: boolean = false;
5887  try {
5888	let mode: WhiteBalanceMode = camera.WhiteBalanceMode.DAYLIGHT;
5889    status = professionalPhotoSession.isWhiteBalanceModeSupported(mode);
5890  } catch (error) {
5891    // 失败返回错误码error.code并处理
5892    let err = error as BusinessError;
5893    console.error(`The isWhiteBalanceModeSupported call failed. error code: ${err.code}`);
5894  }
5895  return status;
5896}
5897```
5898
5899### getWhiteBalanceRange<sup>12+</sup>
5900
5901getWhiteBalanceRange(): Array\<number\>
5902
5903获取手动白平衡的调节范围。
5904
5905**系统接口:** 此接口为系统接口。
5906
5907**系统能力:** SystemCapability.Multimedia.Camera.Core
5908
5909**返回值:**
5910
5911| 类型        | 说明                          |
5912| ---------- | ----------------------------- |
5913| Array\<number\>   | 用于获取手动白平衡值可调范围,如[2800,...,10000],单位为K(Kelvin,温度单位),实际情况根据底层能力返回为准。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
5914
5915**错误码:**
5916
5917以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5918
5919| 错误码ID         | 错误信息        |
5920| --------------- | --------------- |
5921| 202     | Not System Application. |
5922| 7400103                |  Session not config.                                   |
5923
5924**示例:**
5925
5926```ts
5927import { BusinessError } from '@kit.BasicServicesKit';
5928
5929function getWhiteBalanceRange(professionalPhotoSession: camera.ProfessionalPhotoSession): Array<number> {
5930  let range: Array<number> = [];
5931  try {
5932    range = professionalPhotoSession.getWhiteBalanceRange();
5933  } catch (error) {
5934    // 失败返回错误码error.code并处理
5935    let err = error as BusinessError;
5936    console.error(`The getWhiteBalanceRange call failed. error code: ${err.code}`);
5937  }
5938  return range;
5939}
5940```
5941
5942## WhiteBalance<sup>12+</sup>
5943
5944WhiteBalance extends [WhiteBalanceQuery](#whitebalancequery12)
5945
5946提供了处理设备白平衡的相关功能,包括获取和设置白平衡模式和白平衡值。
5947
5948### setWhiteBalanceMode<sup>12+</sup>
5949
5950setWhiteBalanceMode(mode: WhiteBalanceMode): void
5951
5952设置白平衡模式。进行设置之前,需要先检查设备是否支持指定的白平衡模式,可使用方法[isWhiteBalanceModeSupported](#iswhitebalancemodesupported12)。
5953
5954**系统接口:** 此接口为系统接口。
5955
5956**系统能力:** SystemCapability.Multimedia.Camera.Core
5957
5958**参数:**
5959
5960| 参数名      | 类型                            | 必填 | 说明                    |
5961| -------- | -------------------------------| ---- | ----------------------- |
5962| mode   | [WhiteBalanceMode](#whitebalancemode12)  | 是   | 白平衡模式。                |
5963
5964**错误码:**
5965
5966以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
5967
5968| 错误码ID         | 错误信息        |
5969| --------------- | --------------- |
5970| 202     | Not System Application. |
5971| 7400101                |  Parameter missing or parameter type incorrect.        |
5972| 7400103                |  Session not config.                                   |
5973
5974**示例:**
5975
5976```ts
5977import { BusinessError } from '@kit.BasicServicesKit';
5978
5979function setWhiteBalanceMode(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
5980  try {
5981    professionalPhotoSession.setWhiteBalanceMode(camera.WhiteBalanceMode.DAYLIGHT);
5982  } catch (error) {
5983    // 失败返回错误码error.code并处理
5984    let err = error as BusinessError;
5985    console.error(`The setWhiteBalanceMode call failed. error code: ${err.code}`);
5986  }
5987}
5988```
5989
5990### getWhiteBalanceMode<sup>12+</sup>
5991
5992getWhiteBalanceMode(): WhiteBalanceMode
5993
5994获取当前白平衡模式。
5995
5996**系统接口:** 此接口为系统接口。
5997
5998**系统能力:** SystemCapability.Multimedia.Camera.Core
5999
6000**返回值:**
6001
6002| 类型        | 说明                          |
6003| ---------- | ----------------------------- |
6004| [WhiteBalanceMode](#whitebalancemode12)    | 获取当前白平衡模式。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
6005
6006**错误码:**
6007
6008以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6009
6010| 错误码ID         | 错误信息        |
6011| --------------- | --------------- |
6012| 202     | Not System Application. |
6013| 7400103                |  Session not config.                                   |
6014
6015**示例:**
6016
6017```ts
6018import { BusinessError } from '@kit.BasicServicesKit';
6019
6020function getWhiteBalanceMode(professionalPhotoSession: camera.ProfessionalPhotoSession): camera.WhiteBalanceMode | undefined {
6021  let whiteBalanceMode: camera.WhiteBalanceMode | undefined = undefined;
6022  try {
6023    whiteBalanceMode = professionalPhotoSession.getWhiteBalanceMode();
6024  } catch (error) {
6025    // 失败返回错误码error.code并处理
6026    let err = error as BusinessError;
6027    console.error(`The getWhiteBalanceMode call failed. error code: ${err.code}`);
6028  }
6029  return whiteBalanceMode;
6030}
6031```
6032
6033### setWhiteBalance<sup>12+</sup>
6034setWhiteBalance(whiteBalance: number): void
6035
6036设置手动白平衡值。
6037
6038**系统接口:** 此接口为系统接口。
6039
6040**系统能力:** SystemCapability.Multimedia.Camera.Core
6041
6042**参数:**
6043
6044| 参数名      | 类型                     | 必填 | 说明                 |
6045| -------- | ----------------------- | ---- | ------------------- |
6046| whiteBalance | number | 是   | 设置手动白平衡值 |
6047
6048**错误码:**
6049
6050以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6051
6052| 错误码ID         | 错误信息        |
6053| --------------- | --------------- |
6054| 202     | Not System Application. |
6055| 7400101                |  Parameter missing or parameter type incorrect.        |
6056| 7400103                |  Session not config.                                   |
6057
6058**示例:**
6059
6060```ts
6061import { BusinessError } from '@kit.BasicServicesKit';
6062
6063function setWhiteBalance(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6064  try {
6065    let whiteBalance: number = 1000;
6066    professionalPhotoSession.setWhiteBalance(whiteBalance);
6067  } catch (error) {
6068    // 失败返回错误码error.code并处理
6069    let err = error as BusinessError;
6070    console.error(`The setWhiteBalance call failed. error code: ${err.code}`);
6071  }
6072}
6073```
6074
6075### getWhiteBalance<sup>12+</sup>
6076
6077getWhiteBalance(): number
6078
6079获取当前手动白平衡的值。
6080
6081**系统接口:** 此接口为系统接口。
6082
6083**系统能力:** SystemCapability.Multimedia.Camera.Core
6084
6085**返回值:**
6086
6087| 类型        | 说明                          |
6088| ---------- | ----------------------------- |
6089| number    | 返回当前白平衡值。 |
6090
6091**错误码:**
6092
6093以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6094
6095| 错误码ID         | 错误信息        |
6096| --------------- | --------------- |
6097| 202     | Not System Application. |
6098| 7400103                |  Session not config.                                   |
6099
6100**示例:**
6101
6102```ts
6103import { BusinessError } from '@kit.BasicServicesKit';
6104
6105function getWhiteBalance(professionalPhotoSession: camera.ProfessionalPhotoSession): number {
6106  let whiteBalance: number = 0;
6107  try {
6108    whiteBalance = professionalPhotoSession.getWhiteBalance();
6109  } catch (error) {
6110    // 失败返回错误码error.code并处理
6111    let err = error as BusinessError;
6112    console.error(`The getWhiteBalance call failed. error code: ${err.code}`);
6113  }
6114  return whiteBalance;
6115}
6116```
6117
6118## ProfessionalPhotoSession<sup>12+</sup>
6119
6120ProfessionalPhotoSession extends Session, AutoExposure, ManualExposure, Focus, ManualFocus, WhiteBalance, ManualIso, Flash, Zoom, ColorEffect, Aperture
6121
6122专业拍照会话类,继承自[Session](js-apis-camera.md#session12),用于设置专业拍照会话的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
6123
6124### on('error')<sup>12+</sup>
6125
6126on(type: 'error', callback: ErrorCallback): void
6127
6128监听专业拍照会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
6129
6130**系统接口:** 此接口为系统接口。
6131
6132**系统能力:** SystemCapability.Multimedia.Camera.Core
6133
6134**参数:**
6135
6136| 参数名     | 类型                                                          | 必填 | 说明                           |
6137| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
6138| type     | string                                                      | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
6139| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
6140
6141**错误码:**
6142
6143以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6144
6145| 错误码ID   | 错误信息        |
6146|---------| --------------- |
6147| 202     |  Not System Application. |
6148
6149**示例:**
6150
6151```ts
6152import { BusinessError } from '@kit.BasicServicesKit';
6153
6154function callback(err: BusinessError): void {
6155  console.error(`Professional photo session error code: ${err.code}`);
6156}
6157
6158function registerSessionError(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6159  professionalPhotoSession.on('error', callback);
6160}
6161```
6162
6163### off('error')<sup>12+</sup>
6164
6165off(type: 'error', callback?: ErrorCallback): void
6166
6167注销监听专业拍照会话的错误事件,通过注册回调函数获取结果。
6168
6169**系统接口:** 此接口为系统接口。
6170
6171**系统能力:** SystemCapability.Multimedia.Camera.Core
6172
6173**参数:**
6174
6175| 参数名     | 类型                        | 必填 | 说明                           |
6176| -------- | ------------------------ | ---- | ------------------------------ |
6177| type     | string    | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。 |
6178| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 否   | 回调函数,可选,有就是匿名函数。       |
6179
6180**错误码:**
6181
6182以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6183
6184| 错误码ID   | 错误信息        |
6185|---------| --------------- |
6186| 202     |  Not System Application. |
6187
6188**示例:**
6189
6190```ts
6191function unregisterSessionError(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6192  professionalPhotoSession.off('error');
6193}
6194```
6195
6196### on('focusStateChange')<sup>12+</sup>
6197
6198on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
6199
6200监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
6201
6202**系统接口:** 此接口为系统接口。
6203
6204**系统能力:** SystemCapability.Multimedia.Camera.Core
6205
6206**参数:**
6207
6208| 参数名     | 类型                    | 必填 | 说明                       |
6209| -------- | ---------------- | ---- | ------------------------ |
6210| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
6211| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 是   | 回调函数,用于获取当前对焦状态。  |
6212
6213**错误码:**
6214
6215以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6216
6217| 错误码ID   | 错误信息        |
6218|---------| --------------- |
6219| 202     |  Not System Application. |
6220
6221**示例:**
6222
6223```ts
6224import { BusinessError } from '@kit.BasicServicesKit';
6225
6226function callback(err: BusinessError, focusState: camera.FocusState): void {
6227  if (err !== undefined && err.code !== 0) {
6228    console.error(`Callback Error, errorCode: ${err.code}`);
6229    return;
6230  }
6231  console.info(`Focus state: ${focusState}`);
6232}
6233
6234function registerFocusStateChange(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6235  professionalPhotoSession.on('focusStateChange', callback);
6236}
6237```
6238
6239### off('focusStateChange')<sup>12+</sup>
6240
6241off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
6242
6243注销监听相机对焦的状态变化。
6244
6245**系统接口:** 此接口为系统接口。
6246
6247**系统能力:** SystemCapability.Multimedia.Camera.Core
6248
6249**参数:**
6250
6251| 参数名     | 类型                                      | 必填 | 说明                       |
6252| -------- | ----------------------------------------- | ---- | ------------------------ |
6253| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。 |
6254| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 否   | 回调函数,可选,有就是匹配on('focusStateChange') callback(callback对象不可是匿名函数)。  |
6255
6256**错误码:**
6257
6258以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6259
6260| 错误码ID   | 错误信息        |
6261|---------| --------------- |
6262| 202     |  Not System Application. |
6263
6264**示例:**
6265
6266```ts
6267function unregisterFocusStateChange(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6268  professionalPhotoSession.off('focusStateChange');
6269}
6270```
6271
6272### on('smoothZoomInfoAvailable')<sup>12+</sup>
6273
6274on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
6275
6276监听相机平滑变焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
6277
6278**系统接口:** 此接口为系统接口。
6279
6280**系统能力:** SystemCapability.Multimedia.Camera.Core
6281
6282**参数:**
6283
6284| 参数名     | 类型                   | 必填 | 说明                       |
6285| -------- | ----------------------- | ---- | ------------------------ |
6286| type     | string                  | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
6287| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 是   | 回调函数,用于获取当前平滑变焦状态。  |
6288
6289**错误码:**
6290
6291以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6292
6293| 错误码ID   | 错误信息        |
6294|---------| --------------- |
6295| 202     |  Not System Application. |
6296
6297**示例:**
6298
6299```ts
6300import { BusinessError } from '@kit.BasicServicesKit';
6301
6302function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
6303  if (err !== undefined && err.code !== 0) {
6304    console.error(`Callback Error, errorCode: ${err.code}`);
6305    return;
6306  }
6307  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
6308}
6309
6310function registerSmoothZoomInfo(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6311  professionalPhotoSession.on('smoothZoomInfoAvailable', callback);
6312}
6313```
6314
6315### off('smoothZoomInfoAvailable')<sup>12+</sup>
6316
6317off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
6318
6319注销监听相机平滑变焦的状态变化。
6320
6321**系统接口:** 此接口为系统接口。
6322
6323**系统能力:** SystemCapability.Multimedia.Camera.Core
6324
6325**参数:**
6326
6327| 参数名     | 类型                                      | 必填 | 说明                       |
6328| -------- | ----------------------------------------- | ---- | ------------------------ |
6329| type     | string              | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
6330| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 否   | 回调函数,可选,有就是匹配on('smoothZoomInfoAvailable') callback(callback对象不可是匿名函数)。  |
6331
6332**错误码:**
6333
6334以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6335
6336| 错误码ID   | 错误信息        |
6337|---------| --------------- |
6338| 202     |  Not System Application. |
6339
6340**示例:**
6341
6342```ts
6343function unregisterSmoothZoomInfo(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6344  professionalPhotoSession.off('smoothZoomInfoAvailable');
6345}
6346```
6347
6348### on('isoInfoChange')<sup>12+</sup>
6349
6350on(type: 'isoInfoChange', callback: AsyncCallback\<IsoInfo\>): void
6351
6352监听自动ISO变化事件,通过注册回调函数获取实时ISO信息。使用callback异步回调。
6353
6354**系统接口:** 此接口为系统接口。
6355
6356**系统能力:** SystemCapability.Multimedia.Camera.Core
6357
6358**参数:**
6359
6360| 参数名     | 类型                                                      | 必填 | 说明                               |
6361| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6362| type     | string                                                  | 是   | 监听事件,固定为'isoInfoChange'。         |
6363| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| 是   | 回调函数,用于获取ISO信息。         |
6364
6365**错误码:**
6366
6367| 错误码ID | 错误信息                     |
6368| ------- | ---------------------- |
6369| 202     | Not System Application. |
6370
6371**示例:**
6372
6373```ts
6374import { BusinessError } from '@kit.BasicServicesKit';
6375
6376function isoInfoCallback(err: BusinessError, info: camera.IsoInfo): void {
6377  if (err !== undefined && err.code !== 0) {
6378    console.error(`Callback Error, errorCode: ${err.code}`);
6379    return;
6380  }
6381  console.log(`ISO value: ${info.iso}`);
6382}
6383
6384function registerIsoInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6385  professionalPhotoSession.on('isoInfoChange', isoInfoCallback);
6386}
6387```
6388
6389### off('isoInfoChange')<sup>12+</sup>
6390
6391off(type: 'isoInfoChange', callback?: AsyncCallback\<IsoInfo\>): void
6392
6393注销监听ISO信息事件,通过注册回调函数来注销。
6394
6395**系统接口:** 此接口为系统接口。
6396
6397**系统能力:** SystemCapability.Multimedia.Camera.Core
6398
6399**参数:**
6400
6401| 参数名     | 类型                                                      | 必填 | 说明                               |
6402| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6403| type     | string                                                  | 是   | 监听事件,固定为'isoInfoChange'。         |
6404| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| 否   | 回调函数,可选,用于匹配on('isoInfoChange')的callback。 |
6405
6406**错误码:**
6407
6408| 错误码ID | 错误信息                    |
6409| ------- | ---------------------- |
6410| 202     | Not System Application. |
6411
6412**示例:**
6413
6414```ts
6415function unregisterIsoInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6416  professionalPhotoSession.off('isoInfoChange');
6417}
6418```
6419
6420### on('exposureInfoChange')<sup>12+</sup>
6421
6422on(type: 'exposureInfoChange', callback: AsyncCallback\<ExposureInfo\>): void
6423
6424监听曝光信息事件,通过注册回调函数获取曝光信息。使用callback异步回调。
6425
6426**系统接口:** 此接口为系统接口。
6427
6428**系统能力:** SystemCapability.Multimedia.Camera.Core
6429
6430**参数:**
6431
6432| 参数名     | 类型                                                      | 必填 | 说明                               |
6433| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6434| type     | string                                                  | 是   | 监听事件,固定为'exposureInfoChange'。         |
6435| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| 是   | 回调函数,用于获取曝光信息。         |
6436
6437**错误码:**
6438
6439| 错误码ID | 错误信息                     |
6440| ------- | ---------------------- |
6441| 202     | Not System Application. |
6442
6443**示例:**
6444
6445```ts
6446import { BusinessError } from '@kit.BasicServicesKit';
6447
6448function exposureInfoCallback(err: BusinessError, info: camera.ExposureInfo): void {
6449  if (err !== undefined && err.code !== 0) {
6450    console.error(`Callback Error, errorCode: ${err.code}`);
6451    return;
6452  }
6453  console.log(`exposureTimeValue: ${info.exposureTime}`);
6454}
6455
6456function registerExposureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6457  professionalPhotoSession.on('exposureInfoChange', exposureInfoCallback);
6458}
6459```
6460
6461### off('exposureInfoChange')<sup>12+</sup>
6462
6463off(type: 'exposureInfoChange', callback?: AsyncCallback\<ExposureInfo\>): void
6464
6465注销监听曝光信息事件,通过注册回调函数来注销。
6466
6467**系统接口:** 此接口为系统接口。
6468
6469**系统能力:** SystemCapability.Multimedia.Camera.Core
6470
6471**参数:**
6472
6473| 参数名     | 类型                                                      | 必填 | 说明                               |
6474| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6475| type     | string                                                  | 是   | 监听事件,固定为'exposureInfoChange'。         |
6476| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| 否   | 回调函数,可选,用于匹配on('exposureInfoChange')的callback。 |
6477
6478**错误码:**
6479
6480| 错误码ID | 错误信息                     |
6481| ------- | ---------------------- |
6482| 202     | Not System Application. |
6483
6484**示例:**
6485
6486```ts
6487function unregisterExposureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6488  professionalPhotoSession.off('exposureInfoChange');
6489}
6490```
6491
6492### on('apertureInfoChange')<sup>12+</sup>
6493
6494on(type: 'apertureInfoChange', callback: AsyncCallback\<ApertureInfo\>): void
6495
6496监听物理光圈变化事件,通过注册回调函数获取实时物理光圈信息。使用callback异步回调。
6497
6498**系统接口:** 此接口为系统接口。
6499
6500**系统能力:** SystemCapability.Multimedia.Camera.Core
6501
6502**参数:**
6503
6504| 参数名     | 类型                                                      | 必填 | 说明                               |
6505| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6506| type     | string                                                  | 是   | 监听事件,固定为'apertureInfoChange'。         |
6507| callback | AsyncCallback\<[ApertureInfo](#apertureinfo12)\>| 是   | 回调函数,用于获取物理光圈信息。         |
6508
6509**错误码:**
6510
6511| 错误码ID | 错误信息                     |
6512| ------- | ---------------------- |
6513| 202     | Not System Application. |
6514
6515**示例:**
6516
6517```ts
6518import { BusinessError } from '@kit.BasicServicesKit';
6519
6520function apertureInfoCallback(err: BusinessError, info: camera.ApertureInfo): void {
6521  if (err !== undefined && err.code !== 0) {
6522    console.error(`Callback Error, errorCode: ${err.code}`);
6523    return;
6524  }
6525  console.log(`Aperture value: ${info.aperture}`);
6526}
6527
6528function registerApertureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6529  professionalPhotoSession.on('apertureInfoChange', apertureInfoCallback);
6530}
6531```
6532
6533### off('apertureInfoChange')<sup>12+</sup>
6534
6535off(type: 'apertureInfoChange', callback?: AsyncCallback\<ApertureInfo\>): void
6536
6537注销监听物理光圈变化事件,通过注册回调函数来注销。
6538
6539**系统接口:** 此接口为系统接口。
6540
6541**系统能力:** SystemCapability.Multimedia.Camera.Core
6542
6543**参数:**
6544
6545| 参数名     | 类型                                                      | 必填 | 说明                               |
6546| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6547| type     | string                                                  | 是   | 监听事件,固定为'apertureInfoChange'。         |
6548| callback | AsyncCallback\<[ApertureInfo](#apertureinfo12)\>| 否   | 回调函数,可选,用于匹配on('apertureInfoChange')的callback。 |
6549
6550**错误码:**
6551
6552| 错误码ID | 错误信息                     |
6553| ------- | ---------------------- |
6554| 202     | Not System Application. |
6555
6556**示例:**
6557
6558```ts
6559function unregisterApertureInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6560  professionalPhotoSession.off('apertureInfoChange');
6561}
6562```
6563
6564### on('luminationInfoChange')<sup>12+</sup>
6565
6566on(type: 'luminationInfoChange', callback: AsyncCallback\<LuminationInfo\>): void
6567
6568监听光照变化事件,通过注册回调函数获取实时光照参数。使用callback异步回调。
6569
6570**系统接口:** 此接口为系统接口。
6571
6572**系统能力:** SystemCapability.Multimedia.Camera.Core
6573
6574**参数:**
6575
6576| 参数名     | 类型                                                      | 必填 | 说明                               |
6577| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6578| type     | string                                                  | 是   | 监听事件,固定为'luminationInfoChange'。         |
6579| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| 是   | 回调函数,用于获取光照参数。         |
6580
6581**错误码:**
6582
6583| 错误码ID | 错误信息                     |
6584| ------- | ---------------------- |
6585| 202     | Not System Application. |
6586
6587**示例:**
6588
6589```ts
6590import { BusinessError } from '@kit.BasicServicesKit';
6591
6592function luminationInfoCallback(err: BusinessError, info: camera.LuminationInfo): void {
6593  if (err !== undefined && err.code !== 0) {
6594    console.error(`Callback Error, errorCode: ${err.code}`);
6595    return;
6596  }
6597  console.log(`Lumination: ${info.lumination}`);
6598}
6599
6600function registerLuminationInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6601  professionalPhotoSession.on('luminationInfoChange', luminationInfoCallback);
6602}
6603```
6604
6605### off('luminationInfoChange')<sup>12+</sup>
6606
6607off(type: 'luminationInfoChange', callback?: AsyncCallback\<LuminationInfo\>): void
6608
6609注销监听光照变化事件,通过注册回调函数来注销。
6610
6611**系统接口:** 此接口为系统接口。
6612
6613**系统能力:** SystemCapability.Multimedia.Camera.Core
6614
6615**参数:**
6616
6617| 参数名     | 类型                                                      | 必填 | 说明                               |
6618| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6619| type     | string                                                  | 是   | 监听事件,固定为'luminationInfoChange'。         |
6620| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| 否   | 回调函数,可选,用于匹配on('luminationInfoChange')的callback。 |
6621
6622**错误码:**
6623
6624| 错误码ID | 错误信息                     |
6625| ------- | ---------------------- |
6626| 202     | Not System Application. |
6627
6628**示例:**
6629
6630```ts
6631function unregisterLuminationInfoEvent(professionalPhotoSession: camera.ProfessionalPhotoSession): void {
6632  professionalPhotoSession.off('luminationInfoChange');
6633}
6634```
6635
6636## ProfessionalVideoSession<sup>12+</sup>
6637
6638ProfessionalVideoSession extends Session, AutoExposure, ManualExposure, Focus, ManualFocus, WhiteBalance, ManualIso, Flash, Zoom, ColorEffect, Aperture
6639
6640专业录像模式会话类,继承自[Session](js-apis-camera.md#session12),用于设置专业录像模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
6641
6642### on('error')<sup>12+</sup>
6643
6644on(type: 'error', callback: ErrorCallback): void
6645
6646监听专业录像会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
6647
6648**系统接口:** 此接口为系统接口。
6649
6650**系统能力:** SystemCapability.Multimedia.Camera.Core
6651
6652**参数:**
6653
6654| 参数名     | 类型                                                          | 必填 | 说明                           |
6655| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
6656| type     | string                                                      | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
6657| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
6658
6659**错误码:**
6660
6661以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6662
6663| 错误码ID   | 错误信息        |
6664|---------| --------------- |
6665| 202     |  Not System Application. |
6666
6667**示例:**
6668
6669```ts
6670import { BusinessError } from '@kit.BasicServicesKit';
6671
6672function callback(err: BusinessError): void {
6673  console.error(`Professional video session error code: ${err.code}`);
6674}
6675
6676function registerSessionError(professionalVideoSession: camera.ProfessionalVideoSession): void {
6677  professionalVideoSession.on('error', callback);
6678}
6679```
6680
6681### off('error')<sup>12+</sup>
6682
6683off(type: 'error', callback?: ErrorCallback): void
6684
6685注销监听专业录像会话的错误事件,通过注册回调函数获取结果。
6686
6687**系统接口:** 此接口为系统接口。
6688
6689**系统能力:** SystemCapability.Multimedia.Camera.Core
6690
6691**参数:**
6692
6693| 参数名     | 类型                        | 必填 | 说明                           |
6694| -------- | ------------------------ | ---- | ------------------------------ |
6695| type     | string    | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。 |
6696| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 否   | 回调函数,可选,有就是匿名函数。       |
6697
6698**错误码:**
6699
6700以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6701
6702| 错误码ID   | 错误信息        |
6703|---------| --------------- |
6704| 202     |  Not System Application. |
6705
6706**示例:**
6707
6708```ts
6709function unregisterSessionError(professionalVideoSession: camera.ProfessionalVideoSession): void {
6710  professionalVideoSession.off('error');
6711}
6712```
6713
6714### on('focusStateChange')<sup>12+</sup>
6715
6716on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
6717
6718监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
6719
6720**系统接口:** 此接口为系统接口。
6721
6722**系统能力:** SystemCapability.Multimedia.Camera.Core
6723
6724**参数:**
6725
6726| 参数名     | 类型                    | 必填 | 说明                       |
6727| -------- | ---------------- | ---- | ------------------------ |
6728| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
6729| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 是   | 回调函数,用于获取当前对焦状态。  |
6730
6731**错误码:**
6732
6733以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6734
6735| 错误码ID   | 错误信息        |
6736|---------| --------------- |
6737| 202     |  Not System Application. |
6738
6739**示例:**
6740
6741```ts
6742import { BusinessError } from '@kit.BasicServicesKit';
6743
6744function callback(err: BusinessError, focusState: camera.FocusState): void {
6745  if (err !== undefined && err.code !== 0) {
6746    console.error(`Callback Error, errorCode: ${err.code}`);
6747    return;
6748  }
6749  console.info(`Focus state: ${focusState}`);
6750}
6751
6752function registerFocusStateChange(professionalVideoSession: camera.ProfessionalVideoSession): void {
6753  professionalVideoSession.on('focusStateChange', callback);
6754}
6755```
6756
6757### off('focusStateChange')<sup>12+</sup>
6758
6759off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
6760
6761注销监听相机对焦的状态变化。
6762
6763**系统接口:** 此接口为系统接口。
6764
6765**系统能力:** SystemCapability.Multimedia.Camera.Core
6766
6767**参数:**
6768
6769| 参数名     | 类型                                      | 必填 | 说明                       |
6770| -------- | ----------------------------------------- | ---- | ------------------------ |
6771| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。 |
6772| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 否   | 回调函数,可选,有就是匹配on('focusStateChange') callback(callback对象不可是匿名函数)。  |
6773
6774**错误码:**
6775
6776以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6777
6778| 错误码ID   | 错误信息        |
6779|---------| --------------- |
6780| 202     |  Not System Application. |
6781
6782**示例:**
6783
6784```ts
6785function unregisterFocusStateChange(professionalVideoSession: camera.ProfessionalVideoSession): void {
6786  professionalVideoSession.off('focusStateChange');
6787}
6788```
6789
6790### on('smoothZoomInfoAvailable')<sup>12+</sup>
6791
6792on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
6793
6794监听相机平滑变焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
6795
6796**系统接口:** 此接口为系统接口。
6797
6798**系统能力:** SystemCapability.Multimedia.Camera.Core
6799
6800**参数:**
6801
6802| 参数名     | 类型                   | 必填 | 说明                       |
6803| -------- | ----------------------- | ---- | ------------------------ |
6804| type     | string                  | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
6805| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 是   | 回调函数,用于获取当前平滑变焦状态。  |
6806
6807**错误码:**
6808
6809以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6810
6811| 错误码ID   | 错误信息        |
6812|---------| --------------- |
6813| 202     |  Not System Application. |
6814
6815**示例:**
6816
6817```ts
6818import { BusinessError } from '@kit.BasicServicesKit';
6819
6820function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
6821  if (err !== undefined && err.code !== 0) {
6822    console.error(`Callback Error, errorCode: ${err.code}`);
6823    return;
6824  }
6825  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
6826}
6827
6828function registerSmoothZoomInfo(professionalVideoSession: camera.ProfessionalVideoSession): void {
6829  professionalVideoSession.on('smoothZoomInfoAvailable', callback);
6830}
6831```
6832
6833### off('smoothZoomInfoAvailable')<sup>12+</sup>
6834
6835off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
6836
6837注销监听相机平滑变焦的状态变化。
6838
6839**系统接口:** 此接口为系统接口。
6840
6841**系统能力:** SystemCapability.Multimedia.Camera.Core
6842
6843**参数:**
6844
6845| 参数名     | 类型                                      | 必填 | 说明                       |
6846| -------- | ----------------------------------------- | ---- | ------------------------ |
6847| type     | string              | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
6848| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 否   | 回调函数,可选,有就是匹配on('smoothZoomInfoAvailable') callback(callback对象不可是匿名函数)。  |
6849
6850**错误码:**
6851
6852以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
6853
6854| 错误码ID   | 错误信息        |
6855|---------| --------------- |
6856| 202     |  Not System Application. |
6857
6858**示例:**
6859
6860```ts
6861function unregisterSmoothZoomInfo(professionalVideoSession: camera.ProfessionalVideoSession): void {
6862  professionalVideoSession.off('smoothZoomInfoAvailable');
6863}
6864```
6865
6866### on('isoInfoChange')<sup>12+</sup>
6867
6868on(type: 'isoInfoChange', callback: AsyncCallback\<IsoInfo\>): void
6869
6870监听自动ISO变化事件,通过注册回调函数获取实时ISO信息。使用callback异步回调。
6871
6872**系统接口:** 此接口为系统接口。
6873
6874**系统能力:** SystemCapability.Multimedia.Camera.Core
6875
6876**参数:**
6877
6878| 参数名     | 类型                                                      | 必填 | 说明                               |
6879| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6880| type     | string                                                  | 是   | 监听事件,固定为'isoInfoChange'。         |
6881| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| 是   | 回调函数,用于获取ISO信息。         |
6882
6883**错误码:**
6884
6885| 错误码ID | 错误信息                     |
6886| ------- | ---------------------- |
6887| 202     | Not System Application. |
6888
6889**示例:**
6890
6891```ts
6892import { BusinessError } from '@kit.BasicServicesKit';
6893
6894function isoInfoCallback(err: BusinessError, info: camera.IsoInfo): void {
6895  if (err !== undefined && err.code !== 0) {
6896    console.error(`Callback Error, errorCode: ${err.code}`);
6897    return;
6898  }
6899  console.log(`ISO value: ${info.iso}`);
6900}
6901
6902function registerIsoInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6903  professionalVideoSession.on('isoInfoChange', isoInfoCallback);
6904}
6905```
6906
6907### off('isoInfoChange')<sup>12+</sup>
6908
6909off(type: 'isoInfoChange', callback?: AsyncCallback\<IsoInfo\>): void
6910
6911注销监听ISO信息事件,通过注册回调函数来注销。
6912
6913**系统接口:** 此接口为系统接口。
6914
6915**系统能力:** SystemCapability.Multimedia.Camera.Core
6916
6917**参数:**
6918
6919| 参数名     | 类型                                                      | 必填 | 说明                               |
6920| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6921| type     | string                                                  | 是   | 监听事件,固定为'isoInfoChange'。         |
6922| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| 否   | 回调函数,可选,用于匹配on('isoInfoChange')的callback。 |
6923
6924**错误码:**
6925
6926| 错误码ID | 错误信息                     |
6927| ------- | ---------------------- |
6928| 202     | Not System Application. |
6929
6930**示例:**
6931
6932```ts
6933function unregisterIsoInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6934  professionalVideoSession.off('isoInfoChange');
6935}
6936```
6937
6938### on('exposureInfoChange')<sup>12+</sup>
6939
6940on(type: 'exposureInfoChange', callback: AsyncCallback\<ExposureInfo\>): void
6941
6942监听曝光信息事件,通过注册回调函数获取曝光信息。使用callback异步回调。
6943
6944**系统接口:** 此接口为系统接口。
6945
6946**系统能力:** SystemCapability.Multimedia.Camera.Core
6947
6948**参数:**
6949
6950| 参数名     | 类型                                                      | 必填 | 说明                               |
6951| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6952| type     | string                                                  | 是   | 监听事件,固定为'exposureInfoChange'。         |
6953| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| 是   | 回调函数,用于获取曝光信息。         |
6954
6955**错误码:**
6956
6957| 错误码ID | 错误信息                     |
6958| ------- | ---------------------- |
6959| 202     | Not System Application. |
6960
6961**示例:**
6962
6963```ts
6964import { BusinessError } from '@kit.BasicServicesKit';
6965
6966function exposureInfoCallback(err: BusinessError, info: camera.ExposureInfo): void {
6967  if (err !== undefined && err.code !== 0) {
6968    console.error(`Callback Error, errorCode: ${err.code}`);
6969    return;
6970  }
6971  console.log(`exposureTimeValue: ${info.exposureTime}`);
6972}
6973
6974function registerExposureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
6975  professionalVideoSession.on('exposureInfoChange', exposureInfoCallback);
6976}
6977```
6978
6979### off('exposureInfoChange')<sup>12+</sup>
6980
6981off(type: 'exposureInfoChange', callback?: AsyncCallback\<ExposureInfo\>): void
6982
6983注销监听曝光信息事件,通过注册回调函数来注销。
6984
6985**系统接口:** 此接口为系统接口。
6986
6987**系统能力:** SystemCapability.Multimedia.Camera.Core
6988
6989**参数:**
6990
6991| 参数名     | 类型                                                      | 必填 | 说明                               |
6992| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
6993| type     | string                                                  | 是   | 监听事件,固定为'exposureInfoChange'。         |
6994| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| 否   | 回调函数,可选,用于匹配on('exposureInfoChange')的callback。 |
6995
6996**错误码:**
6997
6998| 错误码ID | 错误信息                     |
6999| ------- | ---------------------- |
7000| 202     | Not System Application. |
7001
7002**示例:**
7003
7004```ts
7005function unregisterExposureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7006  professionalVideoSession.off('exposureInfoChange');
7007}
7008```
7009
7010### on('apertureInfoChange')<sup>12+</sup>
7011
7012on(type: 'apertureInfoChange', callback: AsyncCallback\<ApertureInfo\>): void
7013
7014监听物理光圈变化事件,通过注册回调函数获取物理光圈信息。使用callback异步回调。
7015
7016**系统接口:** 此接口为系统接口。
7017
7018**系统能力:** SystemCapability.Multimedia.Camera.Core
7019
7020**参数:**
7021
7022| 参数名     | 类型                                                      | 必填 | 说明                               |
7023| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7024| type     | string                                                  | 是   | 监听事件,固定为'apertureInfoChange'。         |
7025| callback | AsyncCallback\<[ApertureInfo](#apertureinfo12)\>| 是   | 回调函数,用于获取物理光圈信息。         |
7026
7027**错误码:**
7028
7029| 错误码ID | 错误信息                     |
7030| ------- | ---------------------- |
7031| 202     | Not System Application. |
7032
7033**示例:**
7034
7035```ts
7036import { BusinessError } from '@kit.BasicServicesKit';
7037
7038function apertureInfoCallback(err: BusinessError, info: camera.ApertureInfo): void {
7039  if (err !== undefined && err.code !== 0) {
7040    console.error(`Callback Error, errorCode: ${err.code}`);
7041    return;
7042  }
7043  console.log(`Aperture value: ${info.aperture}`);
7044}
7045
7046function registerApertureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7047  professionalVideoSession.on('apertureInfoChange', apertureInfoCallback);
7048}
7049```
7050
7051### off('apertureInfoChange')<sup>12+</sup>
7052
7053off(type: 'apertureInfoChange', callback?: AsyncCallback\<ApertureInfo\>): void
7054
7055注销监听物理光圈变化事件,通过注册回调函数来注销。
7056
7057**系统接口:** 此接口为系统接口。
7058
7059**系统能力:** SystemCapability.Multimedia.Camera.Core
7060
7061**参数:**
7062
7063| 参数名     | 类型                                                      | 必填 | 说明                               |
7064| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7065| type     | string                                                  | 是   | 监听事件,固定为'apertureInfoChange'。         |
7066| callback | AsyncCallback\<[ApertureInfo](#apertureinfo12)\>| 否   | 回调函数,可选,用于匹配on('apertureInfoChange')的callback。 |
7067
7068**错误码:**
7069
7070| 错误码ID | 错误信息                     |
7071| ------- | ---------------------- |
7072| 202     | Not System Application. |
7073
7074**示例:**
7075
7076```ts
7077function unregisterApertureInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7078  professionalVideoSession.off('apertureInfoChange');
7079}
7080```
7081
7082### on('luminationInfoChange')<sup>12+</sup>
7083
7084on(type: 'luminationInfoChange', callback: AsyncCallback\<LuminationInfo\>): void
7085
7086监听光照变化事件,通过注册回调函数获取光照参数。使用callback异步回调。
7087
7088**系统接口:** 此接口为系统接口。
7089
7090**系统能力:** SystemCapability.Multimedia.Camera.Core
7091
7092**参数:**
7093
7094| 参数名     | 类型                                                      | 必填 | 说明                               |
7095| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7096| type     | string                                                  | 是   | 监听事件,固定为'luminationInfoChange'。         |
7097| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| 是   | 回调函数,用于获取光照参数。         |
7098
7099**错误码:**
7100
7101| 错误码ID | 错误信息                     |
7102| ------- | ---------------------- |
7103| 202     | Not System Application. |
7104
7105**示例:**
7106
7107```ts
7108import { BusinessError } from '@kit.BasicServicesKit';
7109
7110function luminationInfoCallback(err: BusinessError, info: camera.LuminationInfo): void {
7111  if (err !== undefined && err.code !== 0) {
7112    console.error(`Callback Error, errorCode: ${err.code}`);
7113    return;
7114  }
7115  console.log(`Lumination: ${info.lumination}`);
7116}
7117
7118function registerLuminationInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7119  professionalVideoSession.on('luminationInfoChange', luminationInfoCallback);
7120}
7121```
7122
7123### off('luminationInfoChange')<sup>12+</sup>
7124
7125off(type: 'luminationInfoChange', callback?: AsyncCallback\<LuminationInfo\>): void
7126
7127注销监听光照变化事件,通过注册回调函数来注销。
7128
7129**系统接口:** 此接口为系统接口。
7130
7131**系统能力:** SystemCapability.Multimedia.Camera.Core
7132
7133**参数:**
7134
7135| 参数名     | 类型                                                      | 必填 | 说明                               |
7136| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7137| type     | string                                                  | 是   | 监听事件,固定为'luminationInfoChange'。         |
7138| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| 否   | 回调函数,可选,用于匹配on('luminationInfoChange')的callback。 |
7139
7140**错误码:**
7141
7142| 错误码ID | 错误信息                     |
7143| ------- | ---------------------- |
7144| 202     | Not System Application. |
7145
7146**示例:**
7147
7148```ts
7149function unregisterLuminationInfoEvent(professionalVideoSession: camera.ProfessionalVideoSession): void {
7150  professionalVideoSession.off('luminationInfoChange');
7151}
7152```
7153
7154## MacroPhotoSession<sup>12+</sup>
7155
7156MacroPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ManualFocus
7157
7158微距拍照模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置微距拍照模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
7159
7160### on('error')<sup>12+</sup>
7161
7162on(type: 'error', callback: ErrorCallback): void
7163
7164监听微距拍照会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
7165
7166**系统接口:** 此接口为系统接口。
7167
7168**系统能力:** SystemCapability.Multimedia.Camera.Core
7169
7170**参数:**
7171
7172| 参数名      | 类型                                                                        | 必填  | 说明                                                                                                                                                                      |
7173|----------|---------------------------------------------------------------------------|-----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
7174| type     | string                                                                    | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
7175| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。                                                                                                           |
7176
7177**错误码:**
7178
7179以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7180
7181| 错误码ID | 错误信息                       |
7182|-------|----------------------------|
7183| 202   | Not System Application.    |
7184
7185**示例:**
7186
7187```ts
7188import { BusinessError } from '@kit.BasicServicesKit';
7189
7190function callback(err: BusinessError): void {
7191  console.error(`MacroPhotoSession error code: ${err.code}`);
7192}
7193
7194function registerSessionError(macroPhotoSession: camera.MacroPhotoSession): void {
7195  macroPhotoSession.on('error', callback);
7196}
7197```
7198
7199### off('error')<sup>12+</sup>
7200
7201off(type: 'error', callback?: ErrorCallback): void
7202
7203注销监听微距拍照会话的错误事件,通过注册回调函数获取结果。
7204
7205**系统接口:** 此接口为系统接口。
7206
7207**系统能力:** SystemCapability.Multimedia.Camera.Core
7208
7209**参数:**
7210
7211| 参数名      | 类型                                                                        | 必填 | 说明                                                          |
7212|----------|---------------------------------------------------------------------------|----|-------------------------------------------------------------|
7213| type     | string                                                                    | 是  | 监听事件,固定为'error',session创建成功之后可监听该接口。                        |
7214| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | 否  | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。 |
7215
7216**错误码:**
7217
7218以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7219
7220| 错误码ID | 错误信息                       |
7221|-------|----------------------------|
7222| 202   | Not System Application.    |
7223
7224**示例:**
7225
7226```ts
7227function unregisterSessionError(macroPhotoSession: camera.MacroPhotoSession): void {
7228  macroPhotoSession.off('error');
7229}
7230```
7231
7232### on('focusStateChange')<sup>12+</sup>
7233
7234on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
7235
7236监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
7237
7238**系统接口:** 此接口为系统接口。
7239
7240**系统能力:** SystemCapability.Multimedia.Camera.Core
7241
7242**参数:**
7243
7244| 参数名       | 类型                                          | 必填 | 说明                                                                      |
7245|-----------|---------------------------------------------|----|-------------------------------------------------------------------------|
7246| type      | string                                      | 是  | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
7247| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | 是  | 回调函数,用于获取当前对焦状态。                                                        |
7248
7249**错误码:**
7250
7251以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7252
7253| 错误码ID | 错误信息                       |
7254|-------|----------------------------|
7255| 202   | Not System Application.    |
7256
7257**示例:**
7258
7259```ts
7260import { BusinessError } from '@kit.BasicServicesKit';
7261
7262function callback(err: BusinessError, focusState: camera.FocusState): void {
7263  if (err !== undefined && err.code !== 0) {
7264    console.error(`Callback Error, errorCode: ${err.code}`);
7265    return;
7266  }
7267  console.info(`Focus state: ${focusState}`);
7268}
7269
7270function registerFocusStateChange(macroPhotoSession: camera.MacroPhotoSession): void {
7271  macroPhotoSession.on('focusStateChange', callback);
7272}
7273```
7274
7275### off('focusStateChange')<sup>12+</sup>
7276
7277off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
7278
7279注销监听相机对焦的状态变化。
7280
7281**系统接口:** 此接口为系统接口。
7282
7283**系统能力:** SystemCapability.Multimedia.Camera.Core
7284
7285**参数:**
7286
7287| 参数名       | 类型                                          | 必填 | 说明                                                           |
7288|-----------|---------------------------------------------|----|--------------------------------------------------------------|
7289| type      | string                                      | 是  | 监听事件,固定为'focusStateChange',session创建成功可监听。                   |
7290| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | 否  | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。  |
7291
7292**错误码:**
7293
7294以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7295
7296| 错误码ID | 错误信息                       |
7297|-------|----------------------------|
7298| 202   | Not System Application.    |
7299
7300**示例:**
7301
7302```ts
7303function unregisterFocusStateChange(macroPhotoSession: camera.MacroPhotoSession): void {
7304  macroPhotoSession.off('focusStateChange');
7305}
7306```
7307
7308### on('smoothZoomInfoAvailable')<sup>12+</sup>
7309
7310on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
7311
7312监听相机平滑变焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
7313
7314**系统接口:** 此接口为系统接口。
7315
7316**系统能力:** SystemCapability.Multimedia.Camera.Core
7317
7318**参数:**
7319
7320| 参数名     | 类型                   | 必填 | 说明                       |
7321| -------- | ----------------------- | ---- | ------------------------ |
7322| type     | string                  | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
7323| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 是   | 回调函数,用于获取当前平滑变焦状态。  |
7324
7325**错误码:**
7326
7327以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7328
7329| 错误码ID | 错误信息                       |
7330|-------|----------------------------|
7331| 202   | Not System Application.    |
7332
7333**示例:**
7334
7335```ts
7336import { BusinessError } from '@kit.BasicServicesKit';
7337
7338function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
7339  if (err !== undefined && err.code !== 0) {
7340    console.error(`Callback Error, errorCode: ${err.code}`);
7341    return;
7342  }
7343  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
7344}
7345
7346function registerSmoothZoomInfo(macroPhotoSession: camera.MacroPhotoSession): void {
7347  macroPhotoSession.on('smoothZoomInfoAvailable', callback);
7348}
7349```
7350
7351### off('smoothZoomInfoAvailable')<sup>12+</sup>
7352
7353off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
7354
7355注销监听相机平滑变焦的状态变化。
7356
7357**系统接口:** 此接口为系统接口。
7358
7359**系统能力:** SystemCapability.Multimedia.Camera.Core
7360
7361**参数:**
7362
7363| 参数名     | 类型                                      | 必填 | 说明                       |
7364| -------- | ----------------------------------------- | ---- | ------------------------ |
7365| type     | string              | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
7366| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 否   | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。 |
7367
7368**错误码:**
7369
7370以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7371
7372| 错误码ID | 错误信息                       |
7373|-------|----------------------------|
7374| 202   | Not System Application.    |
7375
7376**示例:**
7377
7378```ts
7379function unregisterSmoothZoomInfo(macroPhotoSession: camera.MacroPhotoSession): void {
7380  macroPhotoSession.off('smoothZoomInfoAvailable');
7381}
7382```
7383
7384## MacroVideoSession<sup>12+</sup>
7385
7386MacroVideoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ManualFocus
7387
7388微距录像模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置微距录像模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
7389
7390### on('error')<sup>12+</sup>
7391
7392on(type: 'error', callback: ErrorCallback): void
7393
7394监听微距录像会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
7395
7396**系统接口:** 此接口为系统接口。
7397
7398**系统能力:** SystemCapability.Multimedia.Camera.Core
7399
7400**参数:**
7401
7402| 参数名      | 类型                                                                        | 必填  | 说明                                                                                                                                                                      |
7403|----------|---------------------------------------------------------------------------|-----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
7404| type     | string                                                                    | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
7405| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。                                                                                                           |
7406
7407**错误码:**
7408
7409以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7410
7411| 错误码ID | 错误信息                       |
7412|-------|----------------------------|
7413| 202   | Not System Application.    |
7414
7415**示例:**
7416
7417```ts
7418import { BusinessError } from '@kit.BasicServicesKit';
7419
7420function callback(err: BusinessError): void {
7421  console.error(`MacroPhotoSession error code: ${err.code}`);
7422}
7423
7424function registerSessionError(macroVideoSession: camera.MacroVideoSession): void {
7425  macroVideoSession.on('error', callback);
7426}
7427```
7428
7429### off('error')<sup>12+</sup>
7430
7431off(type: 'error', callback?: ErrorCallback): void
7432
7433注销监听微距录像会话的错误事件,通过注册回调函数获取结果。
7434
7435**系统接口:** 此接口为系统接口。
7436
7437**系统能力:** SystemCapability.Multimedia.Camera.Core
7438
7439**参数:**
7440
7441| 参数名      | 类型                                                                        | 必填 | 说明                                                          |
7442|----------|---------------------------------------------------------------------------|----|-------------------------------------------------------------|
7443| type     | string                                                                    | 是  | 监听事件,固定为'error',session创建成功之后可监听该接口。                        |
7444| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | 否  | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。 |
7445
7446**错误码:**
7447
7448以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7449
7450| 错误码ID | 错误信息                       |
7451|-------|----------------------------|
7452| 202   | Not System Application.    |
7453
7454**示例:**
7455
7456```ts
7457function unregisterSessionError(macroVideoSession: camera.MacroVideoSession): void {
7458  macroVideoSession.off('error');
7459}
7460```
7461
7462### on('focusStateChange')<sup>12+</sup>
7463
7464on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
7465
7466监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
7467
7468**系统接口:** 此接口为系统接口。
7469
7470**系统能力:** SystemCapability.Multimedia.Camera.Core
7471
7472**参数:**
7473
7474| 参数名       | 类型                                          | 必填 | 说明                                                                      |
7475|-----------|---------------------------------------------|----|-------------------------------------------------------------------------|
7476| type      | string                                      | 是  | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
7477| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | 是  | 回调函数,用于获取当前对焦状态。                                                        |
7478
7479**错误码:**
7480
7481以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7482
7483| 错误码ID | 错误信息                       |
7484|-------|----------------------------|
7485| 202   | Not System Application.    |
7486
7487**示例:**
7488
7489```ts
7490import { BusinessError } from '@kit.BasicServicesKit';
7491
7492function callback(err: BusinessError, focusState: camera.FocusState): void {
7493  if (err !== undefined && err.code !== 0) {
7494    console.error(`Callback Error, errorCode: ${err.code}`);
7495    return;
7496  }
7497  console.info(`Focus state: ${focusState}`);
7498}
7499
7500function registerFocusStateChange(macroVideoSession: camera.MacroVideoSession): void {
7501  macroVideoSession.on('focusStateChange', callback);
7502}
7503```
7504
7505### off('focusStateChange')<sup>12+</sup>
7506
7507off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
7508
7509注销监听相机对焦的状态变化。
7510
7511**系统接口:** 此接口为系统接口。
7512
7513**系统能力:** SystemCapability.Multimedia.Camera.Core
7514
7515**参数:**
7516
7517| 参数名       | 类型                                          | 必填 | 说明                                                           |
7518|-----------|---------------------------------------------|----|--------------------------------------------------------------|
7519| type      | string                                      | 是  | 监听事件,固定为'focusStateChange',session创建成功可监听。                   |
7520| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | 否  | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。  |
7521
7522**错误码:**
7523
7524以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7525
7526| 错误码ID | 错误信息                       |
7527|-------|----------------------------|
7528| 202   | Not System Application.    |
7529
7530**示例:**
7531
7532```ts
7533function unregisterFocusStateChange(macroVideoSession: camera.MacroVideoSession): void {
7534  macroVideoSession.off('focusStateChange');
7535}
7536```
7537
7538### on('smoothZoomInfoAvailable')<sup>12+</sup>
7539
7540on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
7541
7542监听相机平滑变焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
7543
7544**系统接口:** 此接口为系统接口。
7545
7546**系统能力:** SystemCapability.Multimedia.Camera.Core
7547
7548**参数:**
7549
7550| 参数名     | 类型                   | 必填 | 说明                       |
7551| -------- | ----------------------- | ---- | ------------------------ |
7552| type     | string                  | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
7553| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 是   | 回调函数,用于获取当前平滑变焦状态。  |
7554
7555**错误码:**
7556
7557以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7558
7559| 错误码ID | 错误信息                       |
7560|-------|----------------------------|
7561| 202   | Not System Application.    |
7562
7563**示例:**
7564
7565```ts
7566import { BusinessError } from '@kit.BasicServicesKit';
7567
7568function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
7569  if (err !== undefined && err.code !== 0) {
7570    console.error(`Callback Error, errorCode: ${err.code}`);
7571    return;
7572  }
7573  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
7574}
7575
7576function registerSmoothZoomInfo(macroVideoSession: camera.MacroVideoSession): void {
7577  macroVideoSession.on('smoothZoomInfoAvailable', callback);
7578}
7579```
7580
7581### off('smoothZoomInfoAvailable')<sup>12+</sup>
7582
7583off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
7584
7585注销监听相机平滑变焦的状态变化。
7586
7587**系统接口:** 此接口为系统接口。
7588
7589**系统能力:** SystemCapability.Multimedia.Camera.Core
7590
7591**参数:**
7592
7593| 参数名     | 类型                                      | 必填 | 说明                       |
7594| -------- | ----------------------------------------- | ---- | ------------------------ |
7595| type     | string              | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
7596| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 否   | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。 |
7597
7598**错误码:**
7599
7600以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7601
7602| 错误码ID | 错误信息                       |
7603|-------|----------------------------|
7604| 202   | Not System Application.    |
7605
7606**示例:**
7607
7608```ts
7609function unregisterSmoothZoomInfo(macroVideoSession: camera.MacroVideoSession): void {
7610  macroVideoSession.off('smoothZoomInfoAvailable');
7611}
7612```
7613
7614## FlashQuery<sup>12+</sup>
7615
7616此接口提供了查阅设备闪光灯信息相应的方法,包括是否支持lcd闪光灯。
7617
7618### isLcdFlashSupported<sup>12+</sup>
7619
7620isLcdFlashSupported(): boolean
7621
7622查询是否支持lcd闪光灯。
7623
7624**系统接口:** 此接口为系统接口。
7625
7626**系统能力:** SystemCapability.Multimedia.Camera.Core
7627
7628**返回值:**
7629
7630| 类型            | 说明                     |
7631| -------------- | ----------------------- |
7632| boolean | 查询是否支持lcd闪光灯。|
7633
7634**错误码:**
7635
7636以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7637
7638| 错误码ID         | 错误信息        |
7639| --------------- | --------------- |
7640| 202 | Not System Application. |
7641| 7400103                |  Session not config, only throw in session usage. |
7642
7643**示例:**
7644
7645```ts
7646function isLcdFlashSupported(nightPhotoSession: camera.NightPhotoSession): boolean {
7647  return nightPhotoSession.isLcdFlashSupported();
7648}
7649```
7650
7651## Flash<sup>11+</sup>
7652
7653Flash extends [FlashQuery](js-apis-camera.md#flashquery12)
7654
7655闪光灯类,对设备闪光灯操作。
7656
7657### enableLcdFlash<sup>13+</sup>
7658
7659enableLcdFlash(enabled: boolean): void
7660
7661使能或去使能LCD闪光灯。
7662
7663进行设置之前,需要先检查:设备是否支持LCD闪光灯,可使用方法[isLcdFlashSupported](#islcdflashsupported12)。
7664
7665**系统能力:** SystemCapability.Multimedia.Camera.Core
7666
7667**参数:**
7668
7669| 参数名       | 类型                     | 必填 | 说明                                               |
7670| --------- | ----------------------- | ---- |--------------------------------------------------|
7671| enabled | boolean | 是   | 使能或去使能LCD闪光灯。传参为null或者undefined,作为0处理,去使能LCD闪光灯。 |
7672
7673**错误码:**
7674
7675以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7676
7677| 错误码ID         | 错误信息        |
7678| --------------- | --------------- |
7679| 7400103                |  Session not config.                                   |
7680
7681**示例:**
7682
7683```ts
7684import { BusinessError } from '@kit.BasicServicesKit';
7685
7686function enableLcdFlash(session: camera.PhotoSessionForSys | camera.VideoSessionForSys | camera.NightPhotoSession): void {
7687  try {
7688    session.enableLcdFlash(true);
7689  } catch (error) {
7690    // 失败返回错误码error.code并处理
7691    let err = error as BusinessError;
7692    console.error(`The setFlashMode call failed. error code: ${err.code}`);
7693  }
7694}
7695```
7696
7697## TimeLapseRecordState<sup>12+</sup>
7698
7699枚举,延时摄影录制状态。
7700
7701**系统接口:** 此接口为系统接口。
7702
7703**系统能力:** SystemCapability.Multimedia.Camera.Core
7704
7705| 名称                           | 值   | 说明         |
7706| ----------------------------- | ---- | ----------- |
7707| IDLE          | 0    | 未录制 |
7708| RECORDING     | 1    | 录制中 |
7709
7710## TimeLapsePreviewType<sup>12+</sup>
7711
7712枚举,延时摄影预览类型,影响拍摄算法。
7713
7714**系统接口:** 此接口为系统接口。
7715
7716**系统能力:** SystemCapability.Multimedia.Camera.Core
7717
7718| 名称                           | 值   | 说明         |
7719| ----------------------------- | ---- | ----------- |
7720| DARK         | 1    | 暗光环境,指光照较差的场景,比如夜晚或暗处。 |
7721| LIGHT        | 2    | 亮光环境,指光照较好的场景,比如白天或灯光下。 |
7722
7723## TryAEInfo<sup>12+</sup>
7724
7725TryAE参数信息,TryAE是指延时摄影时硬件会根据环境光照变化上报状态的操作。
7726
7727**系统接口:** 此接口为系统接口。
7728
7729**系统能力:** SystemCapability.Multimedia.Camera.Core
7730
7731| 名称 | 类型    | 只读 | 可选 | 说明           |
7732| ---- | ------- | ---- |--| -------------- |
7733| isTryAEDone        | boolean  | 是   | 否 | TryAE是否完成。        |
7734| isTryAEHintNeeded  | boolean  | 是   | 是 | 是否需要TryAE。        |
7735| previewType        | [TimeLapsePreviewType](#timelapsepreviewtype12) | 是   | 是 | 预览类型。        |
7736| captureInterval    | number   | 是   | 是 | 拍摄间隔,单位毫秒(ms)。        |
7737
7738## TimeLapsePhotoSession<sup>12+</sup>
7739
7740TimeLapsePhotoSession extends Session, Focus, ManualFocus, AutoExposure, ManualExposure, ManualIso, WhiteBalance, Zoom, ColorEffect
7741
7742延时摄影会话类,继承自[Session](js-apis-camera.md#session12),用于设置延时摄影会话的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
7743
7744### on('error')<sup>12+</sup>
7745
7746on(type: 'error', callback: ErrorCallback): void
7747
7748监听延时摄影会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
7749
7750**系统接口:** 此接口为系统接口。
7751
7752**系统能力:** SystemCapability.Multimedia.Camera.Core
7753
7754**参数:**
7755
7756| 参数名     | 类型                                                          | 必填 | 说明                           |
7757| -------- | ----------------------------------------------------------- | ---- | ------------------------------ |
7758| type     | string                                                      | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
7759| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
7760
7761**错误码:**
7762
7763以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7764
7765| 错误码ID   | 错误信息        |
7766|---------| --------------- |
7767| 202     |  Not System Application. |
7768
7769**示例:**
7770
7771```ts
7772import { BusinessError } from '@kit.BasicServicesKit';
7773
7774function callback(err: BusinessError): void {
7775  console.error(`Time lapse photo session error code: ${err.code}`);
7776}
7777
7778function registerSessionError(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7779  timeLapsePhotoSession.on('error', callback);
7780}
7781```
7782
7783### off('error')<sup>12+</sup>
7784
7785off(type: 'error', callback?: ErrorCallback): void
7786
7787注销监听延时摄影会话的错误事件,通过注册回调函数获取结果。
7788
7789**系统接口:** 此接口为系统接口。
7790
7791**系统能力:** SystemCapability.Multimedia.Camera.Core
7792
7793**参数:**
7794
7795| 参数名     | 类型                        | 必填 | 说明                           |
7796| -------- | ------------------------ | ---- | ------------------------------ |
7797| type     | string    | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。 |
7798| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback)| 否   | 回调函数,可选,有就是匿名函数。       |
7799
7800**错误码:**
7801
7802以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7803
7804| 错误码ID   | 错误信息        |
7805|---------| --------------- |
7806| 202     |  Not System Application. |
7807
7808**示例:**
7809
7810```ts
7811function unregisterSessionError(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7812  timeLapsePhotoSession.off('error');
7813}
7814```
7815
7816### on('focusStateChange')<sup>12+</sup>
7817
7818on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
7819
7820监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
7821
7822**系统接口:** 此接口为系统接口。
7823
7824**系统能力:** SystemCapability.Multimedia.Camera.Core
7825
7826**参数:**
7827
7828| 参数名     | 类型                    | 必填 | 说明                       |
7829| -------- | ---------------- | ---- | ------------------------ |
7830| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
7831| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 是   | 回调函数,用于获取当前对焦状态。  |
7832
7833**错误码:**
7834
7835以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7836
7837| 错误码ID   | 错误信息        |
7838|---------| --------------- |
7839| 202     |  Not System Application. |
7840
7841**示例:**
7842
7843```ts
7844import { BusinessError } from '@kit.BasicServicesKit';
7845
7846function callback(err: BusinessError, focusState: camera.FocusState): void {
7847  if (err !== undefined && err.code !== 0) {
7848    console.error(`Callback Error, errorCode: ${err.code}`);
7849    return;
7850  }
7851  console.info(`Focus state: ${focusState}`);
7852}
7853
7854function registerFocusStateChange(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7855  timeLapsePhotoSession.on('focusStateChange', callback);
7856}
7857```
7858
7859### off('focusStateChange')<sup>12+</sup>
7860
7861off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
7862
7863注销监听相机对焦的状态变化。
7864
7865**系统接口:** 此接口为系统接口。
7866
7867**系统能力:** SystemCapability.Multimedia.Camera.Core
7868
7869**参数:**
7870
7871| 参数名     | 类型                                      | 必填 | 说明                       |
7872| -------- | ----------------------------------------- | ---- | ------------------------ |
7873| type     | string                                    | 是   | 监听事件,固定为'focusStateChange',session创建成功可监听。 |
7874| callback | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\> | 否   | 回调函数,可选,有就是匹配on('focusStateChange') callback(callback对象不可是匿名函数)。  |
7875
7876**错误码:**
7877
7878以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
7879
7880| 错误码ID   | 错误信息        |
7881|---------| --------------- |
7882| 202     |  Not System Application. |
7883
7884**示例:**
7885
7886```ts
7887function unregisterFocusStateChange(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7888  timeLapsePhotoSession.off('focusStateChange');
7889}
7890```
7891
7892### on('isoInfoChange')<sup>12+</sup>
7893
7894on(type: 'isoInfoChange', callback: AsyncCallback\<IsoInfo\>): void
7895
7896监听自动ISO变化事件,通过注册回调函数获取实时ISO信息。使用callback异步回调。
7897
7898**系统接口:** 此接口为系统接口。
7899
7900**系统能力:** SystemCapability.Multimedia.Camera.Core
7901
7902**参数:**
7903
7904| 参数名     | 类型                                                      | 必填 | 说明                               |
7905| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7906| type     | string                                                  | 是   | 监听事件,固定为'isoInfoChange'。         |
7907| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| 是   | 回调函数,用于获取ISO信息。         |
7908
7909**错误码:**
7910
7911| 错误码ID | 错误信息                     |
7912| ------- | ---------------------- |
7913| 202     | Not System Application. |
7914
7915**示例:**
7916
7917```ts
7918import { BusinessError } from '@kit.BasicServicesKit';
7919
7920function isoInfoCallback(err: BusinessError, info: camera.IsoInfo): void {
7921  if (err !== undefined && err.code !== 0) {
7922    console.error(`Callback Error, errorCode: ${err.code}`);
7923    return;
7924  }
7925  console.log(`ISO value: ${info.iso}`);
7926}
7927
7928function registerIsoInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7929  timeLapsePhotoSession.on('isoInfoChange', isoInfoCallback);
7930}
7931```
7932
7933### off('isoInfoChange')<sup>12+</sup>
7934
7935off(type: 'isoInfoChange', callback?: AsyncCallback\<IsoInfo\>): void
7936
7937注销监听ISO信息事件,通过注册回调函数来注销。
7938
7939**系统接口:** 此接口为系统接口。
7940
7941**系统能力:** SystemCapability.Multimedia.Camera.Core
7942
7943**参数:**
7944
7945| 参数名     | 类型                                                      | 必填 | 说明                               |
7946| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7947| type     | string                                                  | 是   | 监听事件,固定为'isoInfoChange'。         |
7948| callback | AsyncCallback\<[IsoInfo](#isoinfo12)\>| 否   | 回调函数,可选,用于匹配on('isoInfoChange')的callback。 |
7949
7950**错误码:**
7951
7952| 错误码ID | 错误信息                    |
7953| ------- | ---------------------- |
7954| 202     | Not System Application. |
7955
7956**示例:**
7957
7958```ts
7959function unregisterIsoInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
7960  timeLapsePhotoSession.off('isoInfoChange');
7961}
7962```
7963
7964### on('exposureInfoChange')<sup>12+</sup>
7965
7966on(type: 'exposureInfoChange', callback: AsyncCallback\<ExposureInfo\>): void
7967
7968监听曝光信息事件,通过注册回调函数获取曝光信息。使用callback异步回调。
7969
7970**系统接口:** 此接口为系统接口。
7971
7972**系统能力:** SystemCapability.Multimedia.Camera.Core
7973
7974**参数:**
7975
7976| 参数名     | 类型                                                      | 必填 | 说明                               |
7977| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
7978| type     | string                                                  | 是   | 监听事件,固定为'exposureInfoChange'。         |
7979| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| 是   | 回调函数,用于获取曝光信息。         |
7980
7981**错误码:**
7982
7983| 错误码ID | 错误信息                     |
7984| ------- | ---------------------- |
7985| 202     | Not System Application. |
7986
7987**示例:**
7988
7989```ts
7990import { BusinessError } from '@kit.BasicServicesKit';
7991
7992function exposureInfoCallback(err: BusinessError, info: camera.ExposureInfo): void {
7993  if (err !== undefined && err.code !== 0) {
7994    console.error(`Callback Error, errorCode: ${err.code}`);
7995    return;
7996  }
7997  console.log(`exposureTimeValue: ${info.exposureTime}`);
7998}
7999
8000function registerExposureInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8001  timeLapsePhotoSession.on('exposureInfoChange', exposureInfoCallback);
8002}
8003```
8004
8005### off('exposureInfoChange')<sup>12+</sup>
8006
8007off(type: 'exposureInfoChange', callback?: AsyncCallback\<ExposureInfo\>): void
8008
8009注销监听曝光信息事件,通过注册回调函数来注销。
8010
8011**系统接口:** 此接口为系统接口。
8012
8013**系统能力:** SystemCapability.Multimedia.Camera.Core
8014
8015**参数:**
8016
8017| 参数名     | 类型                                                      | 必填 | 说明                               |
8018| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8019| type     | string                                                  | 是   | 监听事件,固定为'exposureInfoChange'。         |
8020| callback | AsyncCallback\<[ExposureInfo](#exposureinfo12)\>| 否   | 回调函数,可选,用于匹配on('exposureInfoChange')的callback。 |
8021
8022**错误码:**
8023
8024| 错误码ID | 错误信息                     |
8025| ------- | ---------------------- |
8026| 202     | Not System Application. |
8027
8028**示例:**
8029
8030```ts
8031function unregisterExposureInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8032  timeLapsePhotoSession.off('exposureInfoChange');
8033}
8034```
8035
8036### on('luminationInfoChange')<sup>12+</sup>
8037
8038on(type: 'luminationInfoChange', callback: AsyncCallback\<LuminationInfo\>): void
8039
8040监听光照变化事件,通过注册回调函数获取实时光照参数。使用callback异步回调。
8041
8042**系统接口:** 此接口为系统接口。
8043
8044**系统能力:** SystemCapability.Multimedia.Camera.Core
8045
8046**参数:**
8047
8048| 参数名     | 类型                                                      | 必填 | 说明                               |
8049| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8050| type     | string                                                  | 是   | 监听事件,固定为'luminationInfoChange'。         |
8051| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| 是   | 回调函数,用于获取光照参数。         |
8052
8053**错误码:**
8054
8055| 错误码ID | 错误信息                     |
8056| ------- | ---------------------- |
8057| 202     | Not System Application. |
8058
8059**示例:**
8060
8061```ts
8062import { BusinessError } from '@kit.BasicServicesKit';
8063
8064function luminationInfoCallback(err: BusinessError, info: camera.LuminationInfo): void {
8065  if (err !== undefined && err.code !== 0) {
8066    console.error(`Callback Error, errorCode: ${err.code}`);
8067    return;
8068  }
8069  console.log(`Lumination: ${info.lumination}`);
8070}
8071
8072function registerLuminationInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8073  timeLapsePhotoSession.on('luminationInfoChange', luminationInfoCallback);
8074}
8075```
8076
8077### off('luminationInfoChange')<sup>12+</sup>
8078
8079off(type: 'luminationInfoChange', callback?: AsyncCallback\<LuminationInfo\>): void
8080
8081注销监听光照变化事件,通过注册回调函数来注销。
8082
8083**系统接口:** 此接口为系统接口。
8084
8085**系统能力:** SystemCapability.Multimedia.Camera.Core
8086
8087**参数:**
8088
8089| 参数名     | 类型                                                      | 必填 | 说明                               |
8090| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8091| type     | string                                                  | 是   | 监听事件,固定为'luminationInfoChange'。         |
8092| callback | AsyncCallback\<[LuminationInfo](#luminationinfo12)\>| 否   | 回调函数,可选,用于匹配on('luminationInfoChange')的callback。 |
8093
8094**错误码:**
8095
8096| 错误码ID | 错误信息                     |
8097| ------- | ---------------------- |
8098| 202     | Not System Application. |
8099
8100**示例:**
8101
8102```ts
8103function unregisterLuminationInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8104  timeLapsePhotoSession.off('luminationInfoChange');
8105}
8106```
8107
8108### on('tryAEInfoChange')<sup>12+</sup>
8109
8110on(type: 'tryAEInfoChange', callback: AsyncCallback\<TryAEInfo\>): void
8111
8112监听TryAE变化事件,通过注册回调函数获取实时TryAE参数。使用callback异步回调。
8113
8114**系统接口:** 此接口为系统接口。
8115
8116**系统能力:** SystemCapability.Multimedia.Camera.Core
8117
8118**参数:**
8119
8120| 参数名     | 类型                                                      | 必填 | 说明                               |
8121| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8122| type     | string                                                  | 是   | 监听事件,固定为'tryAEInfoChange'。         |
8123| callback | AsyncCallback\<[TryAEInfo](#tryaeinfo12)\>| 是   | 回调函数,用于获取TryAE参数。         |
8124
8125**错误码:**
8126
8127| 错误码ID | 错误信息                     |
8128| ------- | ---------------------- |
8129| 202     | Not System Application. |
8130
8131**示例:**
8132
8133```ts
8134import { BusinessError } from '@kit.BasicServicesKit';
8135
8136function tryAEInfoCallback(err: BusinessError, info: camera.TryAEInfo): void {
8137  if (err !== undefined && err.code !== 0) {
8138    console.error(`Callback Error, errorCode: ${err.code}`);
8139    return;
8140  }
8141  console.log(`TryAEInfo: ${info.isTryAEDone}, ${info.isTryAEHintNeeded}, ${info.previewType}, ${info.captureInterval}`);
8142}
8143
8144function registerTryAEInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8145  timeLapsePhotoSession.on('tryAEInfoChange', tryAEInfoCallback);
8146}
8147```
8148
8149### off('tryAEInfoChange')<sup>12+</sup>
8150
8151off(type: 'tryAEInfoChange', callback?: AsyncCallback\<TryAEInfo\>): void
8152
8153注销监听TryAE变化事件,通过注册回调函数来注销。
8154
8155**系统接口:** 此接口为系统接口。
8156
8157**系统能力:** SystemCapability.Multimedia.Camera.Core
8158
8159**参数:**
8160
8161| 参数名     | 类型                                                      | 必填 | 说明                               |
8162| -------- | ------------------------------------------------------- | ---- | ---------------------------------- |
8163| type     | string                                                  | 是   | 监听事件,固定为'tryAEInfoChange'。         |
8164| callback | AsyncCallback\<[TryAEInfo](#tryaeinfo12)\>| 否   | 回调函数,可选,用于匹配on('tryAEInfoChange')的callback。 |
8165
8166**错误码:**
8167
8168| 错误码ID | 错误信息                     |
8169| ------- | ---------------------- |
8170| 202     | Not System Application. |
8171
8172**示例:**
8173
8174```ts
8175function unregisterTryAEInfoEvent(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8176  timeLapsePhotoSession.off('tryAEInfoChange');
8177}
8178```
8179
8180### isTryAENeeded<sup>12+</sup>
8181
8182isTryAENeeded(): boolean
8183
8184判断是否需要执行TryAE。
8185
8186**系统接口:** 此接口为系统接口。
8187
8188**系统能力:** SystemCapability.Multimedia.Camera.Core
8189
8190**返回值:**
8191
8192| 类型        | 说明                          |
8193| ---------- | ----------------------------- |
8194| boolean   | 是否需要执行TryAE,接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
8195
8196**错误码:**
8197
8198以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8199
8200| 错误码ID         | 错误信息        |
8201| --------------- | --------------- |
8202| 202     | Not System Application. |
8203| 7400103 |  Session not config.    |
8204
8205**示例:**
8206
8207```ts
8208import { BusinessError } from '@kit.BasicServicesKit';
8209
8210function isTryAENeeded(timeLapsePhotoSession: camera.TimeLapsePhotoSession): boolean {
8211  let needed = false;
8212  try {
8213    needed = timeLapsePhotoSession.isTryAENeeded();
8214  } catch (error) {
8215    // 失败返回错误码error.code并处理
8216    let err = error as BusinessError;
8217    console.error(`The isTryAENeeded call failed. error code: ${err.code}`);
8218  }
8219  return needed;
8220}
8221```
8222
8223### startTryAE<sup>12+</sup>
8224
8225startTryAE(): void
8226
8227开始执行TryAE。
8228
8229**系统接口:** 此接口为系统接口。
8230
8231**系统能力:** SystemCapability.Multimedia.Camera.Core
8232
8233**错误码:**
8234
8235以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8236
8237| 错误码ID         | 错误信息        |
8238| --------------- | --------------- |
8239| 202     | Not System Application. |
8240| 7400103 | Session not config.     |
8241
8242**示例:**
8243
8244```ts
8245import { BusinessError } from '@kit.BasicServicesKit';
8246
8247function startTryAE(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8248  try {
8249    timeLapsePhotoSession.startTryAE();
8250  } catch (error) {
8251    // 失败返回错误码error.code并处理
8252    let err = error as BusinessError;
8253    console.error(`The startTryAE call failed. error code: ${err.code}`);
8254  }
8255}
8256```
8257
8258### stopTryAE<sup>12+</sup>
8259
8260stopTryAE(): void
8261
8262停止执行TryAE。
8263
8264**系统接口:** 此接口为系统接口。
8265
8266**系统能力:** SystemCapability.Multimedia.Camera.Core
8267
8268**错误码:**
8269
8270以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8271
8272| 错误码ID         | 错误信息        |
8273| --------------- | --------------- |
8274| 202     | Not System Application. |
8275| 7400103 | Session not config.     |
8276
8277**示例:**
8278
8279```ts
8280import { BusinessError } from '@kit.BasicServicesKit';
8281
8282function stopTryAE(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8283  try {
8284    timeLapsePhotoSession.stopTryAE();
8285  } catch (error) {
8286    // 失败返回错误码error.code并处理
8287    let err = error as BusinessError;
8288    console.error(`The stopTryAE call failed. error code: ${err.code}`);
8289  }
8290}
8291```
8292
8293### getSupportedTimeLapseIntervalRange<sup>12+</sup>
8294
8295getSupportedTimeLapseIntervalRange(): Array\<number\>
8296
8297获取支持的拍摄间隔范围。
8298
8299**系统接口:** 此接口为系统接口。
8300
8301**系统能力:** SystemCapability.Multimedia.Camera.Core
8302
8303**返回值:**
8304
8305| 类型        | 说明                          |
8306| ---------- | ----------------------------- |
8307| Array\<number\>   | 用于获取拍摄间隔范围,单位毫秒(ms),根据底层能力返回为准,接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
8308
8309**错误码:**
8310
8311以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8312
8313| 错误码ID         | 错误信息        |
8314| --------------- | --------------- |
8315| 202     | Not System Application. |
8316| 7400103                |  Session not config.                                   |
8317
8318**示例:**
8319
8320```ts
8321import { BusinessError } from '@kit.BasicServicesKit';
8322
8323function getSupportedTimeLapseIntervalRange(timeLapsePhotoSession: camera.TimeLapsePhotoSession): Array<number> {
8324  let intervalRange: Array<number> = [];
8325  try {
8326    intervalRange = timeLapsePhotoSession.getSupportedTimeLapseIntervalRange();
8327  } catch (error) {
8328    // 失败返回错误码error.code并处理
8329    let err = error as BusinessError;
8330    console.error(`The getSupportedTimeLapseIntervalRange call failed. error code: ${err.code}`);
8331  }
8332  return intervalRange;
8333}
8334```
8335
8336### getTimeLapseInterval<sup>12+</sup>
8337
8338getTimeLapseInterval(): number
8339
8340获取当前的拍摄间隔值。
8341
8342**系统接口:** 此接口为系统接口。
8343
8344**系统能力:** SystemCapability.Multimedia.Camera.Core
8345
8346**返回值:**
8347
8348| 类型        | 说明                          |
8349| ---------- | ----------------------------- |
8350| number    | 返回当前拍摄间隔值,单位毫秒(ms)。 |
8351
8352**错误码:**
8353
8354以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8355
8356| 错误码ID         | 错误信息        |
8357| --------------- | --------------- |
8358| 202     | Not System Application. |
8359| 7400103                |  Session not config.                                   |
8360
8361**示例:**
8362
8363```ts
8364import { BusinessError } from '@kit.BasicServicesKit';
8365
8366function getTimeLapseInterval(timeLapsePhotoSession: camera.TimeLapsePhotoSession): number {
8367  let interval: number = 0;
8368  try {
8369    interval = timeLapsePhotoSession.getTimeLapseInterval();
8370  } catch (error) {
8371    // 失败返回错误码error.code并处理
8372    let err = error as BusinessError;
8373    console.error(`The getTimeLapseInterval call failed. error code: ${err.code}`);
8374  }
8375  return interval;
8376}
8377```
8378
8379### setTimeLapseInterval<sup>12+</sup>
8380setTimeLapseInterval(interval: number): void
8381
8382设置拍摄间隔值。
8383
8384**系统接口:** 此接口为系统接口。
8385
8386**系统能力:** SystemCapability.Multimedia.Camera.Core
8387
8388**参数:**
8389
8390| 参数名      | 类型                     | 必填 | 说明                 |
8391| -------- | ----------------------- | ---- | ------------------- |
8392| interval | number | 是   | 设置拍摄间隔值,单位毫秒(ms)。 |
8393
8394**错误码:**
8395
8396以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8397
8398| 错误码ID         | 错误信息        |
8399| --------------- | --------------- |
8400| 202     | Not System Application. |
8401| 7400101                |  Parameter missing or parameter type incorrect.        |
8402| 7400103                |  Session not config.                                   |
8403
8404**示例:**
8405
8406```ts
8407import { BusinessError } from '@kit.BasicServicesKit';
8408
8409function setTimeLapseInterval(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8410  try {
8411    let interval: number = 10000;
8412    timeLapsePhotoSession.setTimeLapseInterval(interval);
8413  } catch (error) {
8414    // 失败返回错误码error.code并处理
8415    let err = error as BusinessError;
8416    console.error(`The setTimeLapseInterval call failed. error code: ${err.code}`);
8417  }
8418}
8419```
8420
8421### getTimeLapseRecordState<sup>12+</sup>
8422
8423getTimeLapseRecordState(): TimeLapseRecordState
8424
8425获取当前拍摄状态。
8426
8427**系统接口:** 此接口为系统接口。
8428
8429**系统能力:** SystemCapability.Multimedia.Camera.Core
8430
8431**返回值:**
8432
8433| 类型        | 说明                          |
8434| ---------- | ----------------------------- |
8435| [TimeLapseRecordState](#timelapserecordstate12)    | 获取当前拍摄状态。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
8436
8437**错误码:**
8438
8439以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8440
8441| 错误码ID         | 错误信息        |
8442| --------------- | --------------- |
8443| 202     | Not System Application. |
8444| 7400103                |  Session not config.                                   |
8445
8446**示例:**
8447
8448```ts
8449import { BusinessError } from '@kit.BasicServicesKit';
8450
8451function getTimeLapseRecordState(timeLapsePhotoSession: camera.TimeLapsePhotoSession): camera.TimeLapseRecordState {
8452  let state = camera.TimeLapseRecordState.IDLE;
8453  try {
8454    state = timeLapsePhotoSession.getTimeLapseRecordState();
8455  } catch (error) {
8456    // 失败返回错误码error.code并处理
8457    let err = error as BusinessError;
8458    console.error(`The getTimeLapseRecordState call failed. error code: ${err.code}`);
8459  }
8460  return state;
8461}
8462```
8463
8464### setTimeLapseRecordState<sup>12+</sup>
8465
8466setTimeLapseRecordState(state: TimeLapseRecordState): void
8467
8468设置当前拍摄状态。
8469
8470**系统接口:** 此接口为系统接口。
8471
8472**系统能力:** SystemCapability.Multimedia.Camera.Core
8473
8474**参数:**
8475
8476| 参数名      | 类型                            | 必填 | 说明                    |
8477| -------- | -------------------------------| ---- | ----------------------- |
8478| state   | [TimeLapseRecordState](#timelapserecordstate12)  | 是   | 拍摄状态。                |
8479
8480**错误码:**
8481
8482以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8483
8484| 错误码ID         | 错误信息        |
8485| --------------- | --------------- |
8486| 202     | Not System Application. |
8487| 7400101                |  Parameter missing or parameter type incorrect.        |
8488| 7400103                |  Session not config.                                   |
8489
8490**示例:**
8491
8492```ts
8493import { BusinessError } from '@kit.BasicServicesKit';
8494
8495function setTimeLapseRecordState(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8496  try {
8497    timeLapsePhotoSession.setTimeLapseRecordState(camera.TimeLapseRecordState.RECORDING);
8498  } catch (error) {
8499    // 失败返回错误码error.code并处理
8500    let err = error as BusinessError;
8501    console.error(`The setTimeLapseRecordState call failed. error code: ${err.code}`);
8502  }
8503}
8504```
8505
8506### getTimeLapsePreviewType<sup>12+</sup>
8507
8508getTimeLapsePreviewType(): TimeLapsePreviewType
8509
8510获取当前预览类型。
8511
8512**系统接口:** 此接口为系统接口。
8513
8514**系统能力:** SystemCapability.Multimedia.Camera.Core
8515
8516**返回值:**
8517
8518| 类型        | 说明                          |
8519| ---------- | ----------------------------- |
8520| [TimeLapsePreviewType](#timelapsepreviewtype12)    | 获取当前预览类型。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。 |
8521
8522**错误码:**
8523
8524以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8525
8526| 错误码ID         | 错误信息        |
8527| --------------- | --------------- |
8528| 202     | Not System Application. |
8529| 7400103                |  Session not config.                                   |
8530
8531**示例:**
8532
8533```ts
8534import { BusinessError } from '@kit.BasicServicesKit';
8535
8536function getTimeLapsePreviewType(timeLapsePhotoSession: camera.TimeLapsePhotoSession): camera.TimeLapsePreviewType {
8537  let type = camera.TimeLapsePreviewType.DARK;
8538  try {
8539    type = timeLapsePhotoSession.getTimeLapsePreviewType();
8540  } catch (error) {
8541    // 失败返回错误码error.code并处理
8542    let err = error as BusinessError;
8543    console.error(`The getTimeLapsePreviewType call failed. error code: ${err.code}`);
8544  }
8545  return type;
8546}
8547```
8548
8549### setTimeLapsePreviewType<sup>12+</sup>
8550
8551setTimeLapsePreviewType(type: TimeLapsePreviewType): void
8552
8553设置当前预览类型。
8554
8555**系统接口:** 此接口为系统接口。
8556
8557**系统能力:** SystemCapability.Multimedia.Camera.Core
8558
8559**参数:**
8560
8561| 参数名      | 类型                            | 必填 | 说明                    |
8562| -------- | -------------------------------| ---- | ----------------------- |
8563| state   | [TimeLapsePreviewType](#timelapsepreviewtype12)  | 是   | 预览类型。                |
8564
8565**错误码:**
8566
8567以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8568
8569| 错误码ID         | 错误信息        |
8570| --------------- | --------------- |
8571| 202     | Not System Application. |
8572| 7400101                |  Parameter missing or parameter type incorrect.        |
8573| 7400103                |  Session not config.                                   |
8574
8575**示例:**
8576
8577```ts
8578import { BusinessError } from '@kit.BasicServicesKit';
8579
8580function setTimeLapsePreviewType(timeLapsePhotoSession: camera.TimeLapsePhotoSession): void {
8581  try {
8582    timeLapsePhotoSession.setTimeLapsePreviewType(camera.TimeLapsePreviewType.LIGHT);
8583  } catch (error) {
8584    // 失败返回错误码error.code并处理
8585    let err = error as BusinessError;
8586    console.error(`The setTimeLapsePreviewType call failed. error code: ${err.code}`);
8587  }
8588}
8589```
8590
8591## LightPaintingPhotoSession<sup>12+</sup>
8592
8593LightPaintingPhotoSession extends Session, Flash, Focus, Zoom, ColorEffect
8594
8595流光快门拍照模式会话类,继承自[Session](js-apis-camera.md#session11),用于设置流光快门拍照模式的参数以及保存所需要的所有资源[CameraInput](js-apis-camera.md#camerainput)、[CameraOutput](js-apis-camera.md#cameraoutput)。
8596
8597### on('error')<sup>12+</sup>
8598
8599on(type: 'error', callback: ErrorCallback): void
8600
8601监听流光快门拍照会话的错误事件,通过注册回调函数获取结果。使用callback异步回调。
8602
8603**系统接口:** 此接口为系统接口。
8604
8605**系统能力:** SystemCapability.Multimedia.Camera.Core
8606
8607**参数:**
8608
8609| 参数名      | 类型                                                                        | 必填  | 说明                                                                                                                                                                      |
8610|----------|---------------------------------------------------------------------------|-----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
8611| type     | string                                                                    | 是   | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用[beginConfig](js-apis-camera.md#beginconfig11),[commitConfig](js-apis-camera.md#commitconfig11-1),[addInput](js-apis-camera.md#addinput11)等接口发生错误时返回错误信息。 |
8612| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | 是   | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](js-apis-camera.md#cameraerrorcode)。                                                                                                           |
8613
8614**错误码:**
8615
8616以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8617
8618| 错误码ID | 错误信息                       |
8619|-------|----------------------------|
8620| 202   | Not System Application.    |
8621
8622**示例:**
8623
8624```ts
8625import { BusinessError } from '@kit.BasicServicesKit';
8626
8627function callback(err: BusinessError): void {
8628  console.error(`LightPaintingPhotoSession error code: ${err.code}`);
8629}
8630
8631function registerSessionError(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
8632  lightPaintingPhotoSession.on('error', callback);
8633}
8634```
8635
8636### off('error')<sup>12+</sup>
8637
8638off(type: 'error', callback?: ErrorCallback): void
8639
8640注销监听流光快门拍照会话的错误事件,通过注册回调函数获取结果。
8641
8642**系统接口:** 此接口为系统接口。
8643
8644**系统能力:** SystemCapability.Multimedia.Camera.Core
8645
8646**参数:**
8647
8648| 参数名      | 类型                                                                        | 必填 | 说明                                                          |
8649|----------|---------------------------------------------------------------------------|----|-------------------------------------------------------------|
8650| type     | string                                                                    | 是  | 监听事件,固定为'error',session创建成功之后可监听该接口。                        |
8651| callback | [ErrorCallback](../apis-basic-services-kit/js-apis-base.md#errorcallback) | 否  | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。 |
8652
8653**错误码:**
8654
8655以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8656
8657| 错误码ID | 错误信息                       |
8658|-------|----------------------------|
8659| 202   | Not System Application.    |
8660
8661**示例:**
8662
8663```ts
8664function unregisterSessionError(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
8665  lightPaintingPhotoSession.off('error');
8666}
8667```
8668
8669### on('focusStateChange')<sup>12+</sup>
8670
8671on(type: 'focusStateChange', callback: AsyncCallback\<FocusState\>): void
8672
8673监听相机对焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
8674
8675**系统接口:** 此接口为系统接口。
8676
8677**系统能力:** SystemCapability.Multimedia.Camera.Core
8678
8679**参数:**
8680
8681| 参数名       | 类型                                          | 必填 | 说明                                                                      |
8682|-----------|---------------------------------------------|----|-------------------------------------------------------------------------|
8683| type      | string                                      | 是  | 监听事件,固定为'focusStateChange',session创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件。 |
8684| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | 是  | 回调函数,用于获取当前对焦状态。                                                        |
8685
8686**错误码:**
8687
8688以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8689
8690| 错误码ID | 错误信息                       |
8691|-------|----------------------------|
8692| 202   | Not System Application.    |
8693
8694**示例:**
8695
8696```ts
8697import { BusinessError } from '@kit.BasicServicesKit';
8698
8699function callback(err: BusinessError, focusState: camera.FocusState): void {
8700  if (err !== undefined && err.code !== 0) {
8701    console.error(`Callback Error, errorCode: ${err.code}`);
8702    return;
8703  }
8704  console.info(`Focus state: ${focusState}`);
8705}
8706
8707function registerFocusStateChange(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
8708  lightPaintingPhotoSession.on('focusStateChange', callback);
8709}
8710```
8711
8712### off('focusStateChange')<sup>12+</sup>
8713
8714off(type: 'focusStateChange', callback?: AsyncCallback\<FocusState\>): void
8715
8716注销监听相机对焦的状态变化。
8717
8718**系统接口:** 此接口为系统接口。
8719
8720**系统能力:** SystemCapability.Multimedia.Camera.Core
8721
8722**参数:**
8723
8724| 参数名       | 类型                                          | 必填 | 说明                                                           |
8725|-----------|---------------------------------------------|----|--------------------------------------------------------------|
8726| type      | string                                      | 是  | 监听事件,固定为'focusStateChange',session创建成功可监听。                   |
8727| callback  | AsyncCallback\<[FocusState](js-apis-camera.md#focusstate)\>  | 否  | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。  |
8728
8729**错误码:**
8730
8731以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8732
8733| 错误码ID | 错误信息                       |
8734|-------|----------------------------|
8735| 202   | Not System Application.    |
8736
8737**示例:**
8738
8739```ts
8740function unregisterFocusStateChange(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
8741  lightPaintingPhotoSession.off('focusStateChange');
8742}
8743```
8744
8745### on('smoothZoomInfoAvailable')<sup>12+</sup>
8746
8747on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback\<SmoothZoomInfo\>): void
8748
8749监听相机平滑变焦的状态变化,通过注册回调函数获取结果。使用callback异步回调。
8750
8751**系统接口:** 此接口为系统接口。
8752
8753**系统能力:** SystemCapability.Multimedia.Camera.Core
8754
8755**参数:**
8756
8757| 参数名     | 类型                   | 必填 | 说明                       |
8758| -------- | ----------------------- | ---- | ------------------------ |
8759| type     | string                  | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
8760| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 是   | 回调函数,用于获取当前平滑变焦状态。  |
8761
8762**错误码:**
8763
8764以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8765
8766| 错误码ID | 错误信息                       |
8767|-------|----------------------------|
8768| 202   | Not System Application.    |
8769
8770**示例:**
8771
8772```ts
8773import { BusinessError } from '@kit.BasicServicesKit';
8774
8775function callback(err: BusinessError, smoothZoomInfo: camera.SmoothZoomInfo): void {
8776  if (err !== undefined && err.code !== 0) {
8777    console.error(`Callback Error, errorCode: ${err.code}`);
8778    return;
8779  }
8780  console.info(`The duration of smooth zoom: ${smoothZoomInfo.duration}`);
8781}
8782
8783function registerSmoothZoomInfo(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
8784  lightPaintingPhotoSession.on('smoothZoomInfoAvailable', callback);
8785}
8786```
8787
8788### off('smoothZoomInfoAvailable')<sup>12+</sup>
8789
8790off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback\<SmoothZoomInfo\>): void
8791
8792注销监听相机平滑变焦的状态变化。
8793
8794**系统接口:** 此接口为系统接口。
8795
8796**系统能力:** SystemCapability.Multimedia.Camera.Core
8797
8798**参数:**
8799
8800| 参数名     | 类型                                      | 必填 | 说明                       |
8801| -------- | ----------------------------------------- | ---- | ------------------------ |
8802| type     | string              | 是   | 监听事件,固定为'smoothZoomInfoAvailable',session创建成功可监听。|
8803| callback | AsyncCallback\<[SmoothZoomInfo](js-apis-camera.md#smoothzoominfo11)\> | 否   | 回调函数,如果指定参数则取消对应callback(callback对象不可是匿名函数),否则取消所有callback。 |
8804
8805**错误码:**
8806
8807以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8808
8809| 错误码ID | 错误信息                       |
8810|-------|----------------------------|
8811| 202   | Not System Application.    |
8812
8813**示例:**
8814
8815```ts
8816function unregisterSmoothZoomInfo(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
8817  lightPaintingPhotoSession.off('smoothZoomInfoAvailable');
8818}
8819```
8820
8821### getLightPaintingType<sup>12+</sup>
8822
8823getLightPaintingType(): LightPaintingType
8824
8825获取当前生效的流光快门模式类型。
8826
8827**系统接口:** 此接口为系统接口。
8828
8829**系统能力:** SystemCapability.Multimedia.Camera.Core
8830
8831**返回值:**
8832| 类型                                             | 说明                    |
8833|------------------------------------------------- | --------------------- |
8834| [LightPaintingType](#lightpaintingtype12) | 流光快门模式类型。  |
8835
8836**错误码:**
8837
8838以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8839
8840| 错误码ID         | 错误信息        |
8841| --------------- | --------------- |
8842| 202                    |  Not System Application.                               |
8843| 7400103                |  Session not config.                                   |
8844
8845**示例:**
8846
8847```ts
8848function getLightPaintingType(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): camera.LightPaintingType {
8849  let type: camera.LightPaintingType = lightPaintingPhotoSession.getLightPaintingType();
8850  return type;
8851}
8852```
8853
8854### setLightPaintingType<sup>12+</sup>
8855
8856setLightPaintingType(type: LightPaintingType): void
8857
8858设置当前生效的流光快门模式类型。
8859
8860**系统接口:** 此接口为系统接口。
8861
8862**系统能力:** SystemCapability.Multimedia.Camera.Core
8863
8864**返回值:**
8865| 参数名      | 类型                     | 必填 | 说明                 |
8866| -------- | ----------------------- | ---- | ------------------- |
8867| type | [LightPaintingType](#lightpaintingtype12) | 是   | 设置流光快门模式的类型。 |
8868
8869**错误码:**
8870
8871以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8872
8873| 错误码ID         | 错误信息        |
8874| --------------- | --------------- |
8875| 202                    |  Not System Application.                               |
8876| 7400101                |  Parameter missing or parameter type incorrect.        |
8877| 7400103                |  Session not config.                                   |
8878
8879**示例:**
8880
8881```ts
8882import { BusinessError } from '@kit.BasicServicesKit';
8883
8884function setLightPaintingType(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): void {
8885  try {
8886    let type: camera.LightPaintingType = camera.LightPaintingType.TRAFFIC_TRAILS;
8887    lightPaintingPhotoSession.setLightPaintingType(type);
8888  } catch (error) {
8889    // 失败返回错误码error.code并处理
8890    let err = error as BusinessError;
8891    console.error(`The setLightPaintingType call failed. error code: ${err.code}`);
8892  }
8893}
8894```
8895
8896### getSupportedLightPaintingTypes<sup>12+</sup>
8897
8898getSupportedLightPaintingTypes(): Array\<LightPaintingType\>
8899
8900获取当前支持的流光快门模式类型。
8901
8902**系统接口:** 此接口为系统接口。
8903
8904**系统能力:** SystemCapability.Multimedia.Camera.Core
8905
8906**返回值:**
8907| 类型                                             | 说明                    |
8908|------------------------------------------------- | --------------------- |
8909| Array\<[LightPaintingType](#lightpaintingtype12)\> | 支持的流光快门模式类型。  |
8910
8911**错误码:**
8912
8913以下错误码的详细介绍请参见[Camera错误码](errorcode-camera.md)。
8914
8915| 错误码ID         | 错误信息        |
8916| --------------- | --------------- |
8917| 202                    |  Not System Application.                               |
8918| 7400103                |  Session not config.                                   |
8919
8920**示例:**
8921
8922```ts
8923function getSupportedLightPaintingTypes(lightPaintingPhotoSession: camera.LightPaintingPhotoSession): Array<camera.LightPaintingType> {
8924  let types: Array<camera.LightPaintingType> = lightPaintingPhotoSession.getSupportedLightPaintingTypes();
8925  return types
8926}
8927```