diff --git a/frameworks/js/camera_napi/demo/entry/src/main/ets/model/CameraService.ts b/frameworks/js/camera_napi/demo/entry/src/main/ets/model/CameraService.ts index 5257d53541ab1289947caf4f6fc117f62e1da611..03f6f857fd253d6141289a89969068d5d00e5b47 100644 --- a/frameworks/js/camera_napi/demo/entry/src/main/ets/model/CameraService.ts +++ b/frameworks/js/camera_napi/demo/entry/src/main/ets/model/CameraService.ts @@ -22,7 +22,6 @@ import { BusinessError } from '@ohos.base'; import Logger from '../model/Logger'; import MediaUtils from '../model/MediaUtils'; import { Constants } from '../common/Constants'; - const cameraSize = { width: 1280, height: 720 @@ -39,7 +38,6 @@ const TAG: string = 'CameraService'; class CameraService { private mediaUtil: MediaUtils = MediaUtils.getInstance(); - private modeManager: camera.CameraManager | undefined = undefined; private cameraManager: camera.CameraManager | undefined = undefined; private cameras: Array | undefined = undefined; private sceneModes: Array | undefined = undefined; @@ -48,7 +46,7 @@ class CameraService { private previewOutput: camera.PreviewOutput | undefined = undefined; private photoOutPut: camera.PhotoOutput | undefined = undefined; private captureSession: camera.CaptureSession | undefined = undefined; - private portraitSession: camera.PortraitSession | undefined = undefined; + private portraitSession: camera.PortraitPhotoSession | undefined = undefined; private mReceiver: image.ImageReceiver | undefined = undefined; private fileAsset: mediaLibrary.FileAsset | undefined = undefined; private fd: number = -1; @@ -113,7 +111,7 @@ class CameraService { rotation270: 270, }; private videoOutputStatus: boolean = false; - private colorEffect: camera.ColorEffect | undefined = undefined; + private colorEffect: camera.ColorEffectType | undefined = undefined; private isPortraitMode: boolean = false; constructor() { @@ -339,7 +337,7 @@ class CameraService { */ isExposureModeSupportedFn(aeMode: camera.ExposureMode): void { // 检测曝光模式是否支持 - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return; } @@ -367,7 +365,7 @@ class CameraService { */ isMeteringPoint(point: camera.Point): void { // 获取当前曝光模式 - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return; } @@ -386,7 +384,7 @@ class CameraService { isExposureBiasRange(exposureBias: number): void { Logger.debug(TAG, `setExposureBias value ${exposureBias}`); // 查询曝光补偿范围 - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return; } @@ -395,17 +393,13 @@ class CameraService { Logger.debug(TAG, `getExposureBiasRange success, biasRangeArray: ${JSON.stringify(biasRangeArray)}`); // 设置曝光补偿 session.setExposureBias(exposureBias); - // 查询当前曝光值 - let exposureValue: number | undefined = undefined; - exposureValue = session.getExposureValue(); - Logger.debug(TAG, `getExposureValue success, exposureValue: ${JSON.stringify(exposureValue)}`); } /** * 是否支持对应对焦模式 */ isFocusModeSupported(focusMode: camera.FocusMode): boolean { - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return false; } @@ -423,7 +417,7 @@ class CameraService { if (!isSupported) { return; } - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return; } @@ -435,7 +429,7 @@ class CameraService { */ isFocusPoint(point: camera.Point): void { // 设置焦点 - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return; } @@ -451,7 +445,7 @@ class CameraService { * 闪关灯 */ hasFlashFn(flashMode: camera.FlashMode): void { - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return; } @@ -468,8 +462,8 @@ class CameraService { Logger.debug(TAG, `getFlashMode success, nowFlashMode: ${nowFlashMode}`); } - getSession(): camera.PortraitSession | camera.CaptureSession | undefined { - let session: camera.PortraitSession | camera.CaptureSession = undefined; + getSession(): camera.PortraitPhotoSession | camera.CaptureSession | undefined { + let session: camera.PortraitPhotoSession | camera.CaptureSession = undefined; if (this.isPortraitMode) { session = this.portraitSession; } else { @@ -484,7 +478,7 @@ class CameraService { setZoomRatioFn(zoomRatio: number): void { Logger.info(TAG, `setZoomRatioFn value ${zoomRatio}`); // 获取支持的变焦范围 - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return; } @@ -835,8 +829,8 @@ class CameraService { getModeManagerFn(): void { try { - this.modeManager = camera.getModeManager(globalThis.abilityContext); - Logger.info(TAG, `getModeManagerFn success: ${this.modeManager}`); + this.cameraManager = camera.getCameraManager(globalThis.abilityContext); + Logger.info(TAG, `getModeManagerFn success: ${this.cameraManager}`); } catch (error) { let err = error as BusinessError; Logger.error(TAG, `getModeManagerFn failed: ${JSON.stringify(err)}`); @@ -858,7 +852,7 @@ class CameraService { getSupportedModeFn(cameraIndex: number): void { try { - this.sceneModes = this.modeManager.getSupportedModes(this.cameras[cameraIndex]); + this.sceneModes = this.cameraManager.getSupportedSceneModes(this.cameras[cameraIndex]); Logger.info(TAG, `getSupportedModeFn success: ${this.sceneModes}, length: ${this.sceneModes.length}`); } catch (error) { let err = error as BusinessError; @@ -954,7 +948,7 @@ class CameraService { async portraitSessionFlowFn(sceneModeIndex: number): Promise { try { // 创建PortraitSession实例 - this.portraitSession = this.modeManager.createCaptureSession(this.sceneModes[sceneModeIndex]) as camera.PortraitSession; + this.portraitSession = this.cameraManager.createSession(camera.SceneMode.PORTRAIT_PHOTO); // 监听焦距的状态变化 this.onFocusStateChange(); // 监听拍照会话的错误事件 @@ -1004,12 +998,12 @@ class CameraService { } } - setColorEffect(colorEffect: camera.ColorEffect): void { + setColorEffect(colorEffect: camera.ColorEffectType): void { Logger.info(TAG, 'setColorEffect is called.'); if (this.captureSession || this.portraitSession) { - let res: Array | undefined = []; + let res: Array | undefined = []; res = this.getSupportedColorEffects(); - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return; } @@ -1025,11 +1019,11 @@ class CameraService { } } - getColorEffect(): camera.ColorEffect | undefined { + getColorEffect(): camera.ColorEffectType | undefined { Logger.info(TAG, 'getColorEffect is called.'); - let colorEffect: camera.ColorEffect | undefined = undefined; + let colorEffect: camera.ColorEffectType | undefined = undefined; if (this.captureSession || this.portraitSession) { - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return colorEffect; } @@ -1043,11 +1037,11 @@ class CameraService { return colorEffect; } - getSupportedColorEffects(): Array | undefined { + getSupportedColorEffects(): Array | undefined { Logger.info(TAG, 'getSupportedColorEffects is called.'); - let res: Array | undefined = []; + let res: Array | undefined = []; if (this.captureSession || this.portraitSession) { - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return res; } @@ -1133,7 +1127,7 @@ class CameraService { * 监听焦距的状态变化 */ onFocusStateChange(): void { - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return; } @@ -1146,7 +1140,7 @@ class CameraService { * 监听拍照会话的错误事件 */ onCaptureSessionErrorChange(): void { - let session: camera.PortraitSession | camera.CaptureSession = this.getSession(); + let session: camera.PortraitPhotoSession | camera.CaptureSession = this.getSession(); if (!session) { return; } diff --git a/interfaces/kits/js/camera_napi/@ohos.multimedia.camera.d.ts b/interfaces/kits/js/camera_napi/@ohos.multimedia.camera.d.ts index 948806cb5141fc59df020f2e87039f0bcea0c2d6..96bd4ed35a6114c713786aba74bdd1e53b593fbb 100644 --- a/interfaces/kits/js/camera_napi/@ohos.multimedia.camera.d.ts +++ b/interfaces/kits/js/camera_napi/@ohos.multimedia.camera.d.ts @@ -14,8 +14,9 @@ */ import { ErrorCallback, AsyncCallback } from './@ohos.base'; -import { Context } from './app/context'; +import type Context from './application/BaseContext'; import image from './@ohos.multimedia.image'; +import colorSpaceManager from './@ohos.graphics.colorSpaceManager'; /** * @namespace camera @@ -26,30 +27,15 @@ declare namespace camera { /** * Creates a CameraManager instance. * - * @param { Context } context Current application context. + * @param { Context } context - Current application context. * @returns { CameraManager } CameraManager instance. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ function getCameraManager(context: Context): CameraManager; - /** - * Creates a ModeManage instance. - * @param context Current application context. - * @param callback Callback used to return the ModeManage instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - function getModeManager(context: Context, callback: AsyncCallback): void; - /** - * Creates a ModeManage instance. - * @param context Current application context. - * @return Promise used to return the ModeManage instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - function getModeManager(context: Context): Promise; + /** * Enum for camera status. * @@ -65,6 +51,7 @@ declare namespace camera { * @since 10 */ CAMERA_STATUS_APPEAR = 0, + /** * Disappear status. * @@ -72,6 +59,7 @@ declare namespace camera { * @since 10 */ CAMERA_STATUS_DISAPPEAR = 1, + /** * Available status. * @@ -79,6 +67,7 @@ declare namespace camera { * @since 10 */ CAMERA_STATUS_AVAILABLE = 2, + /** * Unavailable status. * @@ -87,223 +76,7 @@ declare namespace camera { */ CAMERA_STATUS_UNAVAILABLE = 3 } - /** - * Enum for camera mode. - * - * @enum { number } - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - enum SceneMode { - /** - * normal mode. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - NORMAL = 0, - /** - * capture mode. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - CAPTURE = 1, - /** - * video mode. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - VIDEO = 2, - /** - * portrait mode. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - PORTRAIT = 3, - /** - * night mode. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - NIGHT = 4, - /** - * pro mode. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - PROFESSIONAL = 5, - /** - * slow motion mode. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - SLOW_MOTION = 6, - } - /** - * Enum for filter type. - * - * @enum { number } - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - enum FilterType { - /** - * Filter disabled. No filter effect is provided. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - NONE = 0, - - /** - * Classic filter effect. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - CLASSIC = 1, - - /** - * Dawn filter effect. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - DAWN = 2, - - /** - * Pure filter effect. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - PURE = 3, - - /** - * Grey filter effect. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - GREY = 4, - - /** - * Natural filter effect. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - NATURAL = 5, - - /** - * Mori filter effect. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - MORI = 6, - - /** - * Fair filter effect. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - FAIR = 7, - - /** - * Pink filter effect. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - PINK = 8 - } - /** - * Enum for portrait effect. - * - * @enum { number } - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - enum PortraitEffect { - /** - * portrait effect off. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - OFF = 0, - - /** - * circular blurring for portrait. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - CIRCLES = 1 - } - /** - * Enum for beauty type. - * - * @enum { number } - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - enum BeautyType { - /** - * Auto beauty type. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - AUTO = 0, - - /** - * Skin smooth beauty type. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - SKIN_SMOOTH = 1, - - /** - * Face slender beauty type. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - FACE_SLENDER = 2, - /** - * Skin tone beauty type. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - SKIN_TONE = 3 - } /** * Profile for camera streams. * @@ -316,14 +89,17 @@ declare namespace camera { * Camera format. * * @type { CameraFormat } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ readonly format: CameraFormat; + /** * Picture size. * * @type { Size } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -342,14 +118,17 @@ declare namespace camera { * Min frame rate. * * @type { number } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ readonly min: number; + /** * Max frame rate. * * @type { number } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -368,6 +147,7 @@ declare namespace camera { * Frame rate in unit fps (frames per second). * * @type { FrameRateRange } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -386,30 +166,37 @@ declare namespace camera { * Preview profiles. * * @type { Array } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ readonly previewProfiles: Array; + /** * Photo profiles. * * @type { Array } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ readonly photoProfiles: Array; + /** * Video profiles. * * @type { Array } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ readonly videoProfiles: Array; + /** * All the supported metadata Object Types. * * @type { Array } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -425,19 +212,21 @@ declare namespace camera { */ enum CameraErrorCode { /** - * Parameter missing or parameter type incorrect + * Parameter missing or parameter type incorrect. * * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ INVALID_ARGUMENT = 7400101, + /** - * Operation not allow. + * Operation not allowed. * * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ OPERATION_NOT_ALLOWED = 7400102, + /** * Session not config. * @@ -445,6 +234,7 @@ declare namespace camera { * @since 10 */ SESSION_NOT_CONFIG = 7400103, + /** * Session not running. * @@ -452,6 +242,7 @@ declare namespace camera { * @since 10 */ SESSION_NOT_RUNNING = 7400104, + /** * Session config locked. * @@ -459,6 +250,7 @@ declare namespace camera { * @since 10 */ SESSION_CONFIG_LOCKED = 7400105, + /** * Device setting locked. * @@ -466,6 +258,7 @@ declare namespace camera { * @since 10 */ DEVICE_SETTING_LOCKED = 7400106, + /** * Can not use camera cause of conflict. * @@ -473,6 +266,7 @@ declare namespace camera { * @since 10 */ CONFLICT_CAMERA = 7400107, + /** * Camera disabled cause of security reason. * @@ -480,6 +274,7 @@ declare namespace camera { * @since 10 */ DEVICE_DISABLED = 7400108, + /** * Can not use camera cause of preempted. * @@ -487,6 +282,7 @@ declare namespace camera { * @since 10 */ DEVICE_PREEMPTED = 7400109, + /** * Camera service fatal error. * @@ -497,86 +293,185 @@ declare namespace camera { } /** - * Prelaunch config object. + * Enum for restore parameter. * - * @typedef PrelaunchConfig + * @enum { number } * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi - * @since 10 + * @since 11 */ - interface PrelaunchConfig { + enum RestoreParamType { /** - * Camera instance. + * No need set restore Stream Parameter, only prelaunch camera device. * - * @type { CameraDevice } * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi - * @since 10 + * @since 11 */ - cameraDevice: CameraDevice; + NO_NEED_RESTORE_PARAM = 0, /** - * Restore param type. - * - * @type { RestoreParamType } - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 10 - */ - restoreParamType: RestoreParamType; - - /** - * begin activing time. + * Presistent default parameter, long-lasting effect after T minutes. * - * @type { number } * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi - * @since 10 + * @since 11 */ - activeTime: number; - + PRESISTENT_DEFAULT_PARAM = 1, + /** - * Setting Param. + * Transistent active parameter, which has a higher priority than PRESISTENT_DEFAULT_PARAM when both exist. * - * @type { SettingParam } * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi - * @since 10 + * @since 11 */ - settingParam: SettingParam; + TRANSISTENT_ACTIVE_PARAM = 2 } /** - * Camera manager object. + * Setting parameter for stream. * - * @interface CameraManager + * @typedef SettingParam * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - interface CameraManager { + interface SettingParam { /** - * Gets supported camera descriptions. + * Skin smooth level value for restore. * - * @returns { Array } An array of supported cameras. + * @type { number } * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getSupportedCameras(): Array; + skinSmoothLevel: number; /** - * Gets supported output capability for specific camera. + * Face slender value for restore. * - * @param { CameraDevice } camera Camera device. - * @returns { CameraOutputCapability } The camera output capability. + * @type { number } * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability; + faceSlender: number; /** - * Determine whether camera is muted. + * Skin tone value for restore. * - * @returns { boolean } Is camera muted. + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + skinTone: number; + } + + /** + * Prelaunch config object. + * + * @typedef PrelaunchConfig + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + interface PrelaunchConfig { + /** + * Camera instance. + * + * @type { CameraDevice } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + cameraDevice: CameraDevice; + + /** + * Restore parameter type. + * + * @type { RestoreParamType } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + restoreParamType: RestoreParamType; + + /** + * Begin activiting time. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + activeTime: number; + + /** + * Setting parameter. + * + * @type { SettingParam } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + settingParam: SettingParam; + } + + /** + * Camera manager object. + * + * @interface CameraManager + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface CameraManager { + /** + * Gets supported camera descriptions. + * + * @returns { Array } An array of supported cameras. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + getSupportedCameras(): Array; + + /** + * Gets supported output capability for specific camera. + * + * @param { CameraDevice } camera - Camera device. + * @returns { CameraOutputCapability } The camera output capability. + * @syscap SystemCapability.Multimedia.Camera.Core + * @deprecated since 11 + * @since 10 + */ + getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability; + + /** + * Gets supported scene mode for specific camera. + * + * @param { CameraDevice } camera - Camera device. + * @returns { Array } An array of supported scene mode of camera. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getSupportedSceneModes(camera: CameraDevice): Array; + + /** + * Gets supported output capability for specific camera. + * + * @param { CameraDevice } camera - Camera device. + * @param { SceneMode } mode - Scene mode. + * @returns { CameraOutputCapability } The camera output capability. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getSupportedOutputCapability(camera: CameraDevice, mode: SceneMode): CameraOutputCapability; + + /** + * Determine whether camera is muted. + * + * @returns { boolean } Is camera muted. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -595,7 +490,7 @@ declare namespace camera { /** * Mute camera. * - * @param { boolean } mute Mute camera if TRUE, otherwise unmute camera. + * @param { boolean } mute - Mute camera if TRUE, otherwise unmute camera. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 10 @@ -606,9 +501,9 @@ declare namespace camera { * Creates a CameraInput instance by camera. * * @permission ohos.permission.CAMERA - * @param { CameraDevice } camera Camera device used to create the instance. + * @param { CameraDevice } camera - Camera device used to create the instance. * @returns { CameraInput } The CameraInput instance. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -618,10 +513,10 @@ declare namespace camera { * Creates a CameraInput instance by camera position and type. * * @permission ohos.permission.CAMERA - * @param { CameraPosition } position Target camera position. - * @param { CameraType } type Target camera type. + * @param { CameraPosition } position - Target camera position. + * @param { CameraType } type - Target camera type. * @returns { CameraInput } The CameraInput instance. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -630,10 +525,10 @@ declare namespace camera { /** * Creates a PreviewOutput instance. * - * @param { Profile } profile Preview output profile. - * @param { string } surfaceId Surface object id used in camera photo output. + * @param { Profile } profile - Preview output profile. + * @param { string } surfaceId - Surface object id used in camera photo output. * @returns { PreviewOutput } The PreviewOutput instance. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -642,22 +537,34 @@ declare namespace camera { /** * Creates a PhotoOutput instance. * - * @param { Profile } profile Photo output profile. - * @param { string } surfaceId Surface object id used in camera photo output. + * @param { Profile } profile - Photo output profile. + * @param { string } surfaceId - Surface object id used in camera photo output. * @returns { PhotoOutput } The PhotoOutput instance. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @syscap SystemCapability.Multimedia.Camera.Core + * @deprecated since 11 * @since 10 */ createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput; + /** + * Creates a PhotoOutput instance. + * + * @param { Profile } profile - Photo output profile. + * @returns { PhotoOutput } The PhotoOutput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + createPhotoOutput(profile: Profile): PhotoOutput; + /** * Creates a VideoOutput instance. * - * @param { VideoProfile } profile Video profile. - * @param { string } surfaceId Surface object id used in camera video output. + * @param { VideoProfile } profile - Video profile. + * @param { string } surfaceId - Surface object id used in camera video output. * @returns { VideoOutput } The VideoOutput instance. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -666,9 +573,9 @@ declare namespace camera { /** * Creates a MetadataOutput instance. * - * @param { Array } metadataObjectTypes Array of MetadataObjectType. + * @param { Array } metadataObjectTypes - Array of MetadataObjectType. * @returns { MetadataOutput } The MetadataOutput instance. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -680,25 +587,47 @@ declare namespace camera { * @returns { CaptureSession } The CaptureSession instance. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core + * @deprecated since 11 * @since 10 */ createCaptureSession(): CaptureSession; + /** + * Gets a Session instance by specific scene mode. + * + * @returns { T } The specific Session instance by specific scene mode. + * @param { SceneMode } mode - Scene mode. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + createSession(mode: SceneMode): T; + /** * Subscribes camera status change event callback. * - * @param { 'cameraStatus' } type Event type. - * @param { AsyncCallback } callback Callback used to get the camera status change. + * @param { 'cameraStatus' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the camera status change. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ on(type: 'cameraStatus', callback: AsyncCallback): void; + /** + * Unsubscribes from camera status change event callback. + * + * @param { 'cameraStatus' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the camera status change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'cameraStatus', callback?: AsyncCallback): void; + /** * Subscribes camera mute change event callback. * - * @param { 'cameraMute' } type Event type. - * @param { AsyncCallback } callback Callback used to get the camera mute change. + * @param { 'cameraMute' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the camera mute change. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 10 @@ -706,11 +635,23 @@ declare namespace camera { on(type: 'cameraMute', callback: AsyncCallback): void; /** - * Determine whether the camera device supports prelaunch startup. - * Called before the setPrelaunchConfig and prelaunch function. + * Unsubscribes from camera mute change event callback. + * + * @param { 'cameraMute' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the camera mute change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + off(type: 'cameraMute', callback?: AsyncCallback): void; + + /** + * Determines whether the camera device supports prelaunch. + * This function must be called in prior to the setPrelaunchConfig and prelaunch functions. * - * @param { CameraDevice } camera Camera device. - * @returns { boolean } Is prelaunch is supported. + * @param { CameraDevice } camera - Camera device. + * @returns { boolean } Whether prelaunch is supported. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 10 @@ -718,12 +659,13 @@ declare namespace camera { isPrelaunchSupported(camera: CameraDevice): boolean; /** - * Configure camera preheating parameters, specify camera device. - * Send prelaunch configuration parameters to the camera service when exit camera or change configuration for the next time. + * Sets the camera prelaunch configuration. + * The configuration is sent to the camera service when you exit the camera or change the configuration next time. * - * @param { PrelaunchConfig } prelaunchConfig Prelaunch configuration info. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect - * @throws { BusinessError } 7400102 - Operation not allow. + * @permission ohos.permission.CAMERA + * @param { PrelaunchConfig } prelaunchConfig - Prelaunch configuration info. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 10 @@ -732,19 +674,28 @@ declare namespace camera { /** * Enable the camera to prelaunch and start. - * The user clicks on the system camera icon, pulls up the camera application, and calls it simultaneously. + * This function is called when the user clicks the system camera icon to start the camera application. * - * @throws { BusinessError } 7400102 - Operation not allow. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 10 */ prelaunch(): void; + /** + * Prepare the camera resources. + * This function is called when the user touch down the camera switch icon in camera application. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + preSwtichCamera(cameraId: string): void; + /** * Creates a deferred PreviewOutput instance. * - * @param { Profile } profile Preview output profile. + * @param { Profile } profile - Preview output profile. * @returns { PreviewOutput } the PreviewOutput instance. * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @syscap SystemCapability.Multimedia.Camera.Core @@ -761,7 +712,7 @@ declare namespace camera { * @since 11 */ isTorchSupported(): boolean; - + /** * Check if a specifies torch mode is supported. * @param { TorchMode } mode torch mode. @@ -770,7 +721,7 @@ declare namespace camera { * @since 11 */ isTorchModeSupported(mode: TorchMode): boolean; - + /** * Get current torch mode. * @@ -779,37 +730,38 @@ declare namespace camera { * @since 11 */ getTorchMode(): TorchMode; - + /** - * Get current torch mode. + * Set torch mode to the device. * * @param { TorchMode } mode torch mode. - * @throws { BusinessError } 7400102 - Operation not allow. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @syscap SystemCapability.Multimedia.Camera.Core * @since 11 */ setTorchMode(mode: TorchMode): void; - + /** * Subscribes torch status change event callback. - * + * * @param { 'torchStatusChange' } type Event type - * @param { AsyncCallback } callback Callback used to get the torch state change + * @param { AsyncCallback } callback Callback used to return the torch state change * @syscap SystemCapability.Multimedia.Camera.Core * @since 11 */ on(type: 'torchStatusChange', callback: AsyncCallback): void; - + /** - * unSubscribes torch status change event callback. + * Unsubscribes torch status change event callback. * * @param { 'torchStatusChange' } type Event type - * @param { AsyncCallback } callback Callback used to get the torch state change + * @param { AsyncCallback } callback Callback used to return the torch state change * @syscap SystemCapability.Multimedia.Camera.Core * @since 11 */ off(type: 'torchStatusChange', callback?: AsyncCallback): void; } + /** * Torch status info. * @@ -818,7 +770,6 @@ declare namespace camera { * @since 11 */ interface TorchStatusInfo { - /** * is torch available * @@ -846,6 +797,7 @@ declare namespace camera { */ readonly torchLevel: number; } + /** * Enum for torch mode. * @@ -861,6 +813,7 @@ declare namespace camera { * @since 11 */ OFF = 0, + /** * The device torch is always on. * @@ -868,6 +821,7 @@ declare namespace camera { * @since 11 */ ON = 1, + /** * The device continuously monitors light levels and uses the torch when necessary. * @@ -877,46 +831,6 @@ declare namespace camera { AUTO = 2 } - /** - * Mode manager object. - * - * @interface ModeManager - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - interface ModeManager { - /** - * Gets supported mode descriptions. - * - * @returns { Array } An array of supported modes. - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - getSupportedModes(camera: CameraDevice): Array; - - /** - * Gets supported output capability in specific mode for specific camera. - * - * @param { CameraDevice } camera Camera device. - * @param { SceneMode } camera Camera mode. - * @returns { CameraOutputCapability } The camera output capability. - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - getSupportedOutputCapability(camera: CameraDevice, mode: SceneMode): CameraOutputCapability; - - /** - * Gets a CaptureSession instance for specific mode. - * - * @param { SceneMode } camera Camera mode. - * @returns { CaptureSession } The CaptureSession instance. - * @throws { BusinessError } 7400201 - Camera service fatal error. - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - createCaptureSession(mode: SceneMode): CaptureSession; - } - /** * Camera status info. * @@ -933,6 +847,7 @@ declare namespace camera { * @since 10 */ camera: CameraDevice; + /** * Current camera status. * @@ -958,6 +873,7 @@ declare namespace camera { * @since 10 */ CAMERA_POSITION_UNSPECIFIED = 0, + /** * Back position. * @@ -965,6 +881,7 @@ declare namespace camera { * @since 10 */ CAMERA_POSITION_BACK = 1, + /** * Front position. * @@ -972,11 +889,12 @@ declare namespace camera { * @since 10 */ CAMERA_POSITION_FRONT = 2, + /** - * camera that is inner when the device is folded. + * Camera that is inner position when the device is folded. * * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @since 11 */ CAMERA_POSITION_FOLD_INNER = 3 } @@ -995,39 +913,7 @@ declare namespace camera { * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - CAMERA_TYPE_DEFAULT = 0, - - /** - * Wide camera - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - CAMERA_TYPE_WIDE_ANGLE = 1, - - /** - * Ultra wide camera - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - CAMERA_TYPE_ULTRA_WIDE = 2, - - /** - * Telephoto camera - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - CAMERA_TYPE_TELEPHOTO = 3, - - /** - * True depth camera - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - CAMERA_TYPE_TRUE_DEPTH = 4 + CAMERA_TYPE_DEFAULT = 0 } /** @@ -1080,6 +966,7 @@ declare namespace camera { * @since 10 */ UNKNOWN_TYPE = 0, + /** * Indicates a smartphone camera. * @@ -1088,6 +975,7 @@ declare namespace camera { * @since 10 */ PHONE = 0x0E, + /** * Indicates a tablet camera. * @@ -1110,47 +998,58 @@ declare namespace camera { * Camera id attribute. * * @type { string } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ readonly cameraId: string; + /** * Camera position attribute. * * @type { CameraPosition } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ readonly cameraPosition: CameraPosition; + /** * Camera type attribute. * * @type { CameraType } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ readonly cameraType: CameraType; + /** * Camera connection type attribute. * * @type { ConnectionType } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ readonly connectionType: ConnectionType; + /** * Camera remote camera device name attribute. * * @type { string } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 10 */ readonly hostDeviceName: string; + /** * Camera remote camera device type attribute. * * @type { HostDeviceType } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 10 @@ -1158,36 +1057,6 @@ declare namespace camera { readonly hostDeviceType: HostDeviceType; } - /** - * SketchStatus parameter. - * - * @typedef SketchStatus - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 11 - */ - interface SketchStatus { - /** - * Sketch status. - * - * @type { number } - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 11 - */ - status: number; - - /** - * Sketch scale ratio. - * - * @type { number } - * @syscap SystemCapability.Multimedia.Camera.Core - * @systemapi - * @since 11 - */ - sketchRatio: number; - } - /** * Size parameter. * @@ -1204,6 +1073,7 @@ declare namespace camera { * @since 10 */ height: number; + /** * Width. * @@ -1230,6 +1100,7 @@ declare namespace camera { * @since 10 */ x: number; + /** * y co-ordinate * @@ -1240,53 +1111,18 @@ declare namespace camera { y: number; } - /** - * setting parameter for stream. + * Camera input object. * - * @interface SettingParam + * @interface CameraInput * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - interface SettingParam { + interface CameraInput { /** - * smooth level value for restore + * Open camera. * - * @type { number } - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - skinSmoothLevel: number; - /** - * face slender value for restore - * - * @type { number } - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - faceSlender: number; - /** - * skin tone value for restore - * - * @type { number } - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - skinTone: number; - } - - /** - * Camera input object. - * - * @interface CameraInput - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - interface CameraInput { - /** - * Open camera. - * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 7400107 - Can not use camera cause of conflict. * @throws { BusinessError } 7400108 - Camera disabled cause of security reason. * @throws { BusinessError } 7400201 - Camera service fatal error. @@ -1310,7 +1146,7 @@ declare namespace camera { /** * Close camera. * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 @@ -1328,15 +1164,69 @@ declare namespace camera { close(): Promise; /** - * Subscribes error event callback. + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { CameraDevice } camera - Camera device. + * @param { ErrorCallback } callback - Callback used to get the camera input errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; + + /** + * Unsubscribes from error events. * - * @param { 'error' } type Event type. - * @param { CameraDevice } camera Camera device. - * @param { ErrorCallback } callback Callback used to get the camera input errors. + * @param { 'error' } type - Event type. + * @param { CameraDevice } camera - Camera device. + * @param { ErrorCallback } callback - Callback used to get the camera input errors. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; + off(type: 'error', camera: CameraDevice, callback?: ErrorCallback): void; + } + + /** + * Enumerates the camera scene modes. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + enum SceneMode { + /** + * Normal photo mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + NORMAL_PHOTO = 1, + + /** + * Normal video mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + NORMAL_VIDEO = 2, + + /** + * Portrait photo mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + PORTRAIT_PHOTO = 3, + + /** + * Night photo mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + NIGHT_PHOTO = 4 } /** @@ -1369,7 +1259,23 @@ declare namespace camera { * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - CAMERA_FORMAT_JPEG = 2000 + CAMERA_FORMAT_JPEG = 2000, + + /** + * YCBCR P010 Format. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + CAMERA_FORMAT_YCBCR_P010, + + /** + * YCRCB P010 Format. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + CAMERA_FORMAT_YCRCB_P010 } /** @@ -1387,6 +1293,7 @@ declare namespace camera { * @since 10 */ FLASH_MODE_CLOSE = 0, + /** * Open mode. * @@ -1394,6 +1301,7 @@ declare namespace camera { * @since 10 */ FLASH_MODE_OPEN = 1, + /** * Auto mode. * @@ -1401,6 +1309,7 @@ declare namespace camera { * @since 10 */ FLASH_MODE_AUTO = 2, + /** * Always open mode. * @@ -1411,34 +1320,53 @@ declare namespace camera { } /** - * Enum for restore param. + * Flash object. * - * @enum { number } + * @interface Flash * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @since 11 */ - enum RestoreParamType { + interface Flash { /** - * no need set restore Stream Param, only prelauch cameradevice + * Check if device has flash light. * + * @returns { boolean } The flash light support status. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - NO_NEED_RESTORE_PARAM = 0, + hasFlash(): boolean; + /** - * persistent default param, long-lasting effect after T minutes + * Checks whether a specified flash mode is supported. + * + * @param { FlashMode } flashMode - Flash mode + * @returns { boolean } Is the flash mode supported. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + isFlashModeSupported(flashMode: FlashMode): boolean; + + /** + * Gets current flash mode. * + * @returns { FlashMode } The current flash mode. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - PERSISTENT_DEFAULT_PARAM = 1, + getFlashMode(): FlashMode; + /** - * transisitent active param, This parameter has a higher priority than PERSISTENT_DEFAULT_PARAM when both exist. + * Sets flash mode. * + * @param { FlashMode } flashMode - Target flash mode. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - TRANSISTENT_ACTIVE_PARAM = 2, + setFlashMode(flashMode: FlashMode): void; } /** @@ -1456,6 +1384,7 @@ declare namespace camera { * @since 10 */ EXPOSURE_MODE_LOCKED = 0, + /** * Auto exposure mode. * @@ -1463,6 +1392,7 @@ declare namespace camera { * @since 10 */ EXPOSURE_MODE_AUTO = 1, + /** * Continuous automatic exposure. * @@ -1473,206 +1403,797 @@ declare namespace camera { } /** - * Enum for focus mode. + * AutoExposure object. * - * @enum { number } + * @interface AutoExposure * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @since 11 */ - enum FocusMode { + interface AutoExposure { /** - * Manual mode. + * Checks whether a specified exposure mode is supported. * + * @param { ExposureMode } aeMode - Exposure mode + * @returns { boolean } Is the exposure mode supported. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - FOCUS_MODE_MANUAL = 0, + isExposureModeSupported(aeMode: ExposureMode): boolean; + /** - * Continuous auto mode. + * Gets current exposure mode. * + * @returns { ExposureMode } The current exposure mode. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - FOCUS_MODE_CONTINUOUS_AUTO = 1, + getExposureMode(): ExposureMode; + /** - * Auto mode. + * Sets Exposure mode. * + * @param { ExposureMode } aeMode - Exposure mode + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - FOCUS_MODE_AUTO = 2, + setExposureMode(aeMode: ExposureMode): void; + /** - * Locked mode. + * Gets current metering point. * + * @returns { Point } The current metering point. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - FOCUS_MODE_LOCKED = 3 - } + getMeteringPoint(): Point; - /** - * Enum for focus state. - * - * @enum { number } - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - enum FocusState { /** - * Scan state. + * Set the center point of the metering area. * + * @param { Point } point - metering point + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - FOCUS_STATE_SCAN = 0, + setMeteringPoint(point: Point): void; + /** - * Focused state. + * Query the exposure compensation range. * + * @returns { Array } The array of compensation range. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - FOCUS_STATE_FOCUSED = 1, + getExposureBiasRange(): Array; + /** - * Unfocused state. + * Set exposure compensation. * + * @param { number } exposureBias - Exposure compensation + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - FOCUS_STATE_UNFOCUSED = 2 + setExposureBias(exposureBias: number): void; } /** - * Enum for video stabilization mode. + * Enum for focus mode. * * @enum { number } * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - enum VideoStabilizationMode { - /** - * Turn off video stablization. - * - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - OFF = 0, + enum FocusMode { /** - * LOW mode provides basic stabilization effect. + * Manual mode. * * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - LOW = 1, + FOCUS_MODE_MANUAL = 0, + /** - * MIDDLE mode means algorithms can achieve better effects than LOW mode. + * Continuous auto mode. * * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - MIDDLE = 2, + FOCUS_MODE_CONTINUOUS_AUTO = 1, + /** - * HIGH mode means algorithms can achieve better effects than MIDDLE mode. + * Auto mode. * * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - HIGH = 3, + FOCUS_MODE_AUTO = 2, + /** - * Camera HDF can select mode automatically. + * Locked mode. * * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - AUTO = 4 + FOCUS_MODE_LOCKED = 3 } /** - * Capture session object. + * Enum for focus state. * - * @interface CaptureSession + * @enum { number } * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - interface CaptureSession { + enum FocusState { /** - * Begin capture session config. + * Scan state. * - * @throws { BusinessError } 7400105 - Session config locked. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - beginConfig(): void; + FOCUS_STATE_SCAN = 0, /** - * Commit capture session config. + * Focused state. * - * @param { AsyncCallback } callback Callback used to return the result. - * @throws { BusinessError } 7400102 - Operation not allow. - * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - commitConfig(callback: AsyncCallback): void; + FOCUS_STATE_FOCUSED = 1, /** - * Commit capture session config. + * Unfocused state. * - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 7400102 - Operation not allow. - * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - commitConfig(): Promise; + FOCUS_STATE_UNFOCUSED = 2 + } + /** + * Focus object. + * + * @interface Focus + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Focus { /** - * Adds a camera input. + * Checks whether a specified focus mode is supported. * - * @param { CameraInput } cameraInput Target camera input to add. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect - * @throws { BusinessError } 7400102 - Operation not allow. + * @param { FocusMode } afMode - Focus mode. + * @returns { boolean } Is the focus mode supported. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - addInput(cameraInput: CameraInput): void; + isFocusModeSupported(afMode: FocusMode): boolean; /** - * Removes a camera input. + * Gets current focus mode. * - * @param { CameraInput } cameraInput Target camera input to remove. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect - * @throws { BusinessError } 7400102 - Operation not allow. + * @returns { FocusMode } The current focus mode. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - removeInput(cameraInput: CameraInput): void; + getFocusMode(): FocusMode; /** - * Adds a camera output. + * Sets focus mode. * - * @param { CameraOutput } cameraOutput Target camera output to add. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect - * @throws { BusinessError } 7400102 - Operation not allow. + * @param { FocusMode } afMode - Target focus mode. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - addOutput(cameraOutput: CameraOutput): void; + setFocusMode(afMode: FocusMode): void; /** - * Removes a camera output. + * Sets focus point. * - * @param { CameraOutput } cameraOutput Target camera output to remove. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect - * @throws { BusinessError } 7400102 - Operation not allow. + * @param { Point } point - Target focus point. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - removeOutput(cameraOutput: CameraOutput): void; + setFocusPoint(point: Point): void; /** - * Starts capture session. + * Gets current focus point. * - * @param { AsyncCallback } callback Callback used to return the result. + * @returns { Point } The current focus point. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + getFocusPoint(): Point; + + /** + * Gets current focal length. + * + * @returns { number } The current focal point. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + getFocalLength(): number; + } + + /** + * Enum for smooth zoom mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + enum SmoothZoomMode { + /** + * Normal zoom mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + NORMAL = 0 + } + + /** + * SmoothZoomInfo object + * + * @typedef SmoothZoomInfo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface SmoothZoomInfo { + /** + * The duration of smooth zoom. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + duration: number; + } + + /** + * Zoom object. + * + * @interface Zoom + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Zoom { + /** + * Gets all supported zoom ratio range. + * + * @returns { Array } The zoom ratio range. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + getZoomRatioRange(): Array; + + /** + * Gets zoom ratio. + * + * @returns { number } The zoom ratio value. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + getZoomRatio(): number; + + /** + * Sets zoom ratio. + * + * @param { number } zoomRatio - Target zoom ratio. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + setZoomRatio(zoomRatio: number): void; + + /** + * Sets target zoom ratio by smooth method. + * + * @param { number } targetRatio - Target zoom ratio. + * @param { SmoothZoomMode } mode - Smooth zoom mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + setSmoothZoom(targetRatio: number, mode?: SmoothZoomMode): void; + + /** + * Notify device to prepare for zoom. + * + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + prepareZoom(): void; + + /** + * Notify device of zoom completion. + * + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + unPrepareZoom(): void; + } + + /** + * Enum for video stabilization mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum VideoStabilizationMode { + /** + * Turn off video stablization. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + OFF = 0, + + /** + * LOW mode provides basic stabilization effect. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + LOW = 1, + + /** + * MIDDLE mode means algorithms can achieve better effects than LOW mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + MIDDLE = 2, + + /** + * HIGH mode means algorithms can achieve better effects than MIDDLE mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + HIGH = 3, + + /** + * Camera HDF can select mode automatically. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + AUTO = 4 + } + + /** + * Stabilization object. + * + * @interface Stabilization + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Stabilization { + /** + * Check whether the specified video stabilization mode is supported. + * + * @param { VideoStabilizationMode } vsMode - Video Stabilization mode. + * @returns { boolean } Is flash mode supported. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean; + + /** + * Query the video stabilization mode currently in use. + * + * @returns { VideoStabilizationMode } The current video stabilization mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + getActiveVideoStabilizationMode(): VideoStabilizationMode; + + /** + * Set video stabilization mode. + * + * @param { VideoStabilizationMode } mode - video stabilization mode to set. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + setVideoStabilizationMode(mode: VideoStabilizationMode): void; + } + + /** + * Enumerates the camera beauty effect types. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + enum BeautyType { + /** + * Auto beauty type. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + AUTO = 0, + + /** + * Skin smooth beauty type. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + SKIN_SMOOTH = 1, + + /** + * Face slender beauty type. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + FACE_SLENDER = 2, + + /** + * Skin tone beauty type. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + SKIN_TONE = 3 + } + + /** + * Beauty object. + * + * @interface Beauty + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface Beauty { + /** + * Gets supported beauty effect types. + * + * @returns { Array } List of beauty effect types. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + getSupportedBeautyTypes(): Array; + + /** + * Gets the specific beauty effect type range. + * + * @param { BeautyType } type - The type of beauty effect. + * @returns { Array } The array of the specific beauty effect range. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + getSupportedBeautyRange(type: BeautyType): Array; + + /** + * Gets the beauty effect in use. + * + * @param { BeautyType } type - The type of beauty effect. + * @returns { number } the beauty effect in use. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + getBeauty(type: BeautyType): number; + + /** + * Sets a beauty effect for a camera device. + * + * @param { BeautyType } type - The type of beauty effect. + * @param { number } value The number of beauty effect. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + setBeauty(type: BeautyType, value: number): void; + } + + /** + * Enumerates the camera color effect types. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + enum ColorEffectType { + /** + * Normal color effect type. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + NORMAL = 0, + + /** + * Bright color effect type. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + BRIGHT = 1, + + /** + * Soft color effect type. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + SOFT = 2 + } + + /** + * Color effect object. + * + * @interface ColorEffect + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface ColorEffect { + /** + * Gets supported color effect types. + * + * @returns { Array } List of color effect types. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + getSupportedColorEffects(): Array; + + /** + * Gets the specific color effect type. + * + * @returns { ColorEffectType } The array of the specific color effect type. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + getColorEffect(): ColorEffectType; + + /** + * Sets a color effect for a camera device. + * + * @param { ColorEffectType } type - The type of color effect. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + setColorEffect(type: ColorEffectType): void; + } + + /** + * Color Management object. + * + * @interface ColorManagement + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface ColorManagement { + /** + * Gets the specific color space type. + * + * @returns { colorSpaceManager.ColorSpace } Current color space. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + getActiveColorSpace(): colorSpaceManager.ColorSpace; + + /** + * Gets the supported color space types. + * + * @returns { Array } The array of the supported color space for the session. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + getSupportedColorSpaces(): Array; + + /** + * Sets a color space for the session. + * + * @param { colorSpaceManager.ColorSpace } colorSpace - The type of color space. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + setColorSpace(colorSpace: colorSpaceManager.ColorSpace): void; + } + + /** + * Macro object. + * + * @interface Macro + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface Macro { + /** + * Determine whether camera macro is supported. + * + * @returns { boolean } Is camera macro supported. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + isMacroSupported(): boolean; + + /** + * Enable macro for camera. + * + * @param { boolean } enabled - enable macro for camera if TRUE. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + enableMacro(enabled: boolean): void; + } + + /** + * Session object. + * + * @interface Session + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Session { + /** + * Begin capture session config. + * + * @throws { BusinessError } 7400105 - Session config locked. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + beginConfig(): void; + + /** + * Commit capture session config. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + commitConfig(callback: AsyncCallback): void; + + /** + * Commit capture session config. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + commitConfig(): Promise; + + /** + * Determines whether the camera input can be added into the session. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraInput } cameraInput - Target camera input to add. + * @returns { boolean } You can add the input into the session. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + canAddInput(cameraInput: CameraInput): boolean; + + /** + * Adds a camera input. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraInput } cameraInput - Target camera input to add. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + addInput(cameraInput: CameraInput): void; + + /** + * Removes a camera input. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraInput } cameraInput - Target camera input to remove. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + removeInput(cameraInput: CameraInput): void; + + /** + * Determines whether the camera output can be added into the session. + * This method is valid after Session.addInput(cameraInput) and before Session.commitConfig(). + * + * @param { CameraOutput } cameraOutput - Target camera output to add. + * @returns { boolean } You can add the output into the session. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + canAddOutput(cameraOutput: CameraOutput): boolean; + + /** + * Adds a camera output. + * This method is valid after Session.addInput(cameraInput) and before Session.commitConfig(). + * + * @param { CameraOutput } cameraOutput - Target camera output to add. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + addOutput(cameraOutput: CameraOutput): void; + + /** + * Removes a camera output. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraOutput } cameraOutput - Target camera output to remove. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + removeOutput(cameraOutput: CameraOutput): void; + + /** + * Starts capture session. + * + * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 7400103 - Session not config. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core @@ -1694,7 +2215,7 @@ declare namespace camera { /** * Stops capture session. * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 @@ -1714,7 +2235,7 @@ declare namespace camera { /** * Release capture session instance. * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 @@ -1730,379 +2251,688 @@ declare namespace camera { * @since 10 */ release(): Promise; + } + /** + * Capture session object. + * + * @interface CaptureSession + * @syscap SystemCapability.Multimedia.Camera.Core + * @deprecated since 11 + * @since 10 + */ + interface CaptureSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty { /** - * Check if device has flash light. + * Subscribes to error events. * - * @returns { boolean } The flash light support status. - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - hasFlash(): boolean; + on(type: 'error', callback: ErrorCallback): void; /** - * Checks whether a specified flash mode is supported. + * Unsubscribes from error events. * - * @param { FlashMode } flashMode Flash mode - * @returns { boolean } Is the flash mode supported. - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - isFlashModeSupported(flashMode: FlashMode): boolean; + off(type: 'error', callback?: ErrorCallback): void; /** - * Gets current flash mode. + * Subscribes focus status change event callback. * - * @returns { FlashMode } The current flash mode. - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - getFlashMode(): FlashMode; + on(type: 'focusStateChange', callback: AsyncCallback): void; /** - * Sets flash mode. + * Unsubscribes from focus status change event callback. * - * @param { FlashMode } flashMode Target flash mode. - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - setFlashMode(flashMode: FlashMode): void; + off(type: 'focusStateChange', callback?: AsyncCallback): void; /** - * Checks whether a specified exposure mode is supported. + * Subscribes zoom info event callback. + * + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback): void; + + /** + * Unsubscribes from zoom info event callback. + * + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback): void; + } + + /** + * Photo session object. + * + * @interface PhotoSession + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface PhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty, ColorEffect, ColorManagement, Macro { + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + + /** + * Subscribes focus status change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'focusStateChange', callback: AsyncCallback): void; + + /** + * Unsubscribes from focus status change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'focusStateChange', callback?: AsyncCallback): void; + + /** + * Subscribes zoom info event callback. + * + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback): void; + + /** + * Unsubscribes from zoom info event callback. + * + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback): void; + + /** + * Subscribes camera macro status event callback. + * + * @param { 'macroStatusChanged' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + on(type: 'macroStatusChanged', callback: AsyncCallback): void; + + /** + * Unsubscribes camera macro status event callback. + * + * @param { 'macroStatusChanged' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + off(type: 'macroStatusChanged', callback?: AsyncCallback): void; + } + + /** + * Video session object. + * + * @interface VideoSession + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface VideoSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty, ColorEffect, ColorManagement, Macro, Stabilization { + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + + /** + * Subscribes focus status change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'focusStateChange', callback: AsyncCallback): void; + + /** + * Unsubscribes from focus status change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'focusStateChange', callback?: AsyncCallback): void; + + /** + * Subscribes zoom info event callback. + * + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback): void; + + /** + * Unsubscribes from zoom info event callback. + * + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback): void; + + /** + * Subscribes camera macro status event callback. + * + * @param { 'macroStatusChanged' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + on(type: 'macroStatusChanged', callback: AsyncCallback): void; + + /** + * Unsubscribes camera macro status event callback. + * + * @param { 'macroStatusChanged' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + off(type: 'macroStatusChanged', callback?: AsyncCallback): void; + } + + /** + * Enumerates the camera portrait effects. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + enum PortraitEffect { + /** + * portrait effect off. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + OFF = 0, + + /** + * circular blurring for portrait. * - * @param { ExposureMode } aeMode Exposure mode - * @returns { boolean } Is the exposure mode supported. - * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi * @since 10 */ - isExposureModeSupported(aeMode: ExposureMode): boolean; + CIRCLES = 1, + + /** + * heart blurring for portrait. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + HEART = 2, + + /** + * rotated blurring for portrait. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + ROTATED = 3, /** - * Gets current exposure mode. + * studio blurring for portrait. * - * @returns { ExposureMode } The current exposure mode. - * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getExposureMode(): ExposureMode; + STUDIO = 4, /** - * Sets Exposure mode. + * theator blurring for portrait. * - * @param { ExposureMode } aeMode Exposure mode - * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - setExposureMode(aeMode: ExposureMode): void; + THEATOR = 5 + } + /** + * Portrait object. + * + * @interface Portrait + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface Portrait { /** - * Gets current metering point. + * Gets supported portrait effect. * - * @returns { Point } The current metering point. + * @returns { Array } List of portrait effect. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi * @since 10 */ - getMeteringPoint(): Point; + getSupportedPortraitEffects(): Array; /** - * Set the center point of the metering area. + * Gets the portrait effect in use. * - * @param { Point } point metering point + * @returns { PortraitEffect } The portrait effect in use. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi * @since 10 */ - setMeteringPoint(point: Point): void; + getPortraitEffect(): PortraitEffect; /** - * Query the exposure compensation range. + * Sets a portrait effect for a camera device. * - * @returns { Array } The array of compensation range. + * @param { PortraitEffect } effect - Effect Portrait effect to set. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi * @since 10 */ - getExposureBiasRange(): Array; + setPortraitEffect(effect: PortraitEffect): void; + } + /** + * Zoom range. + * + * @typedef ZoomRange + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface ZoomRange { /** - * Set exposure compensation. + * Min zoom value. * - * @param { number } exposureBias Exposure compensation - * @throws { BusinessError } 7400103 - Session not config. + * @type { number } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - setExposureBias(exposureBias: number): void; + readonly min: number; /** - * Query the exposure value. + * Max zoom value. * - * @returns { number } The exposure value. - * @throws { BusinessError } 7400103 - Session not config. + * @type { number } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getExposureValue(): number; + readonly max: number; + } + /** + * Physical Aperture object + * + * @typedef PhysicalAperture + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface PhysicalAperture { /** - * Checks whether a specified focus mode is supported. + * Zoom Range of the specific physical aperture. * - * @param { FocusMode } afMode Focus mode. - * @returns { boolean } Is the focus mode supported. - * @throws { BusinessError } 7400103 - Session not config. + * @type { ZoomRange } * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - isFocusModeSupported(afMode: FocusMode): boolean; + zoomRange: ZoomRange; /** - * Gets current focus mode. + * The supported physical apertures. * - * @returns { FocusMode } The current focus mode. - * @throws { BusinessError } 7400103 - Session not config. + * @type { Array } * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getFocusMode(): FocusMode; + apertures: Array; + } + /** + * Aperture object. + * + * @interface Aperture + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface Aperture { /** - * Sets focus mode. + * Gets the supported virtual apertures. * - * @param { FocusMode } afMode Target focus mode. + * @returns { Array } The array of supported virtual apertures. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - setFocusMode(afMode: FocusMode): void; + getSupportedVirtualApertures(): Array; /** - * Sets focus point. + * Gets current virtual aperture value. * - * @param { Point } point Target focus point. + * @returns { number } The current virtual aperture value. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - setFocusPoint(point: Point): void; + getVirtualAperture(): number; /** - * Gets current focus point. + * Sets virtual aperture value. * - * @returns { Point } The current focus point. + * @param { number } aperture - virtual aperture value * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getFocusPoint(): Point; + setVirtualAperture(aperture: number): void; /** - * Gets current focal length. + * Gets the supported physical apertures. * - * @returns { number } The current focal point. + * @returns { Array } The array of supported physical apertures. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getFocalLength(): number; + getSupportedPhysicalApertures(): Array; /** - * Gets all supported zoom ratio range. + * Gets current physical aperture value. * - * @returns { Array } The zoom ratio range. + * @returns { number } The current physical aperture value. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getZoomRatioRange(): Array; + getPhysicalAperture(): number; /** - * Gets zoom ratio. + * Sets physical aperture value. * - * @returns { number } The zoom ratio value. + * @param { number } aperture - physical aperture value * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getZoomRatio(): number; + setPhysicalAperture(aperture: number): void; + } + /** + * Portrait Photo session object. + * + * @interface PortraitPhotoSession + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface PortraitPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, Beauty, ColorEffect, ColorManagement, Portrait, Aperture { /** - * Sets zoom ratio. + * Subscribes to error events. * - * @param { number } zoomRatio Target zoom ratio. - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - setZoomRatio(zoomRatio: number): void; + on(type: 'error', callback: ErrorCallback): void; /** - * Check whether the specified video stabilization mode is supported. + * Unsubscribes from error events. * - * @param { VideoStabilizationMode } vsMode Video Stabilization mode. - * @returns { boolean } Is flash mode supported. - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean; + off(type: 'error', callback?: ErrorCallback): void; /** - * Query the video stabilization mode currently in use. + * Subscribes focus status change event callback. * - * @returns { VideoStabilizationMode } The current video stabilization mode. - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - getActiveVideoStabilizationMode(): VideoStabilizationMode; + on(type: 'focusStateChange', callback: AsyncCallback): void; /** - * Set video stabilization mode. + * Unsubscribes from focus status change event callback. * - * @param { VideoStabilizationMode } mode video stabilization mode to set. - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - setVideoStabilizationMode(mode: VideoStabilizationMode): void; + off(type: 'focusStateChange', callback?: AsyncCallback): void; /** - * Subscribes focus status change event callback. + * Subscribes zoom info event callback. * - * @param { 'focusStateChange' } type Event type. - * @param { AsyncCallback } callback Callback used to get the focus state change. + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @since 11 */ - on(type: 'focusStateChange', callback: AsyncCallback): void; + on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback): void; /** - * Subscribes error event callback. + * Unsubscribes from zoom info event callback. * - * @param { 'error' } type Event type. - * @param { ErrorCallback } callback Callback used to get the capture session errors. + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @since 11 */ - on(type: 'error', callback: ErrorCallback): void; + off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback): void; } /** - * Portrait session object. + * ManualExposure object. * - * @interface PortraitSession + * @interface ManualExposure * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - interface PortraitSession { - /** - * Gets supported portrait effects. - * - * @returns { Array } an array of supported portrait effects. - * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 - */ - getSupportedPortraitEffects(): Array; - + interface ManualExposure { /** - * Query the portrait effect. + * Gets the supported manual exposure range. * - * @returns { PortraitEffect } The portrait effect. + * @returns { Array } The array of manual exposure range. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getPortraitEffect(): PortraitEffect; + getSupportedExposureRange(): Array; /** - * Set portrait effect. + * Gets current exposure value. * - * @param { PortraitEffect } effect portrait effect + * @returns { number } The current exposure value. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - setPortraitEffect(effect: PortraitEffect): void; + getExposure(): number; /** - * Gets supported filters. + * Sets Exposure value. * - * @returns { Array } an array of supported filters. + * @param { number } exposure - Exposure value + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - getSupportedFilters(): Array; + setExposure(exposure: number): void; + } + /** + * Night photo session object. + * + * @interface NightPhotoSession + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface NightPhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorEffect, ColorManagement, ManualExposure { /** - * Query the filter type. + * Subscribes to error events. * - * @returns { number } The filter type. - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - getFilter(): number; + on(type: 'error', callback: ErrorCallback): void; /** - * Set filter type. + * Unsubscribes from error events. * - * @param { number } filter filter - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - setFilter(filter: number): void; + off(type: 'error', callback?: ErrorCallback): void; /** - * Gets supported beauty types. + * Subscribes focus status change event callback. * - * @returns { Array } an array of supported beauty types. + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - getSupportedBeautyTypes(): Array; + on(type: 'focusStateChange', callback: AsyncCallback): void; /** - * Gets supported beauty range for specific beauty type. + * Unsubscribes from focus status change event callback. * - * @param { BeautyType } type beauty type. - * @returns { Array } an array of supported ranges. + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - getSupportedBeautyRanges(type: BeautyType): Array; + off(type: 'focusStateChange', callback?: AsyncCallback): void; /** - * Query the beauty level for specific beauty type. + * Subscribes zoom info event callback. * - * @param { BeautyType } type beauty type. - * @returns { number } The beauty level. - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @since 11 */ - getBeauty(type: BeautyType): number; + on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback): void; /** - * Set beauty type and level. + * Unsubscribes from zoom info event callback. * - * @param { BeautyType } type beauty type - * @param { number } value beauty level - * @throws { BusinessError } 7400103 - Session not config. + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @since 11 */ - setBeauty(type: BeautyType, value: number): void; + off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback): void; } + /** * Camera output object. * @@ -2114,7 +2944,7 @@ declare namespace camera { /** * Release output instance. * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 @@ -2132,6 +2962,37 @@ declare namespace camera { release(): Promise; } + /** + * SketchStatusData object + * + * @typedef SketchStatusData + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface SketchStatusData { + /** + * Status of the sketch stream. + * 0 is stop, and 1 is start. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + status: number; + + /** + * The zoom ratio of the sketch stream. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + sketchRatio: number; + } + /** * Preview output object. * @@ -2143,9 +3004,10 @@ declare namespace camera { /** * Start output instance. * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core + * @deprecated since 11 * @since 10 */ start(callback: AsyncCallback): void; @@ -2156,6 +3018,7 @@ declare namespace camera { * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core + * @deprecated since 11 * @since 10 */ start(): Promise; @@ -2163,8 +3026,9 @@ declare namespace camera { /** * Stop output instance. * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Camera.Core + * @deprecated since 11 * @since 10 */ stop(callback: AsyncCallback): void; @@ -2174,6 +3038,7 @@ declare namespace camera { * * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Camera.Core + * @deprecated since 11 * @since 10 */ stop(): Promise; @@ -2181,70 +3046,138 @@ declare namespace camera { /** * Subscribes frame start event callback. * - * @param { 'frameStart' } type Event type. - * @param { AsyncCallback } callback Callback used to return the result. + * @param { 'frameStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ on(type: 'frameStart', callback: AsyncCallback): void; /** - * Subscribes frame end event callback. + * Unsubscribes from frame start event callback. + * + * @param { 'frameStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'frameStart', callback?: AsyncCallback): void; + + /** + * Subscribes frame end event callback. + * + * @param { 'frameEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'frameEnd', callback: AsyncCallback): void; + + /** + * Unsubscribes from frame end event callback. + * + * @param { 'frameEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'frameEnd', callback?: AsyncCallback): void; + + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the preview output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the preview output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + + /** + * Adds a deferred surface. + * + * @param { string } surfaceId - Surface object id used in camera photo output. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + addDeferredSurface(surfaceId: string): void; + + /** + * Determine whether camera sketch is supported. * - * @param { 'frameEnd' } type Event type. - * @param { AsyncCallback } callback Callback used to return the result. + * @returns { boolean } Is camera sketch supported. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - on(type: 'frameEnd', callback: AsyncCallback): void; + isSketchSupported(): boolean; /** - * Subscribes error event callback. + * Gets the specific zoom ratio when sketch stream open. * - * @param { 'error' } type Event type. - * @param { ErrorCallback } callback Callback used to get the preview output errors. + * @returns { number } The specific zoom ratio of sketch. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core - * @since 10 + * @systemapi + * @since 11 */ - on(type: 'error', callback: ErrorCallback): void; + getSketchRatio(): number; /** - * Add deferred surface. + * Enable sketch for camera. * - * @param { string } surfaceId Surface object id used in camera photo output. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @param { boolean } enabled - enable sketch for camera if TRUE. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi - * @since 10 + * @since 11 */ - addDeferredSurface(surfaceId: string): void; + enalbeSketch(enabled: boolean): void; /** - * Check whether sketch is currently supported + * Attach surface to the sketch stream. * + * @param { string } surfaceId - Surface object id used in sketch stream. + * @throws { BusinessError } 7400103 - Session not config. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 11 */ - isSketchSupported(): void; + attachSketchSurface(surfaceId: string): void; /** - * Get current sketch threshold of zoom ratio + * Subscribes sketch status changed event callback. * + * @param { 'sketchStatusChanged' } type - Event type. + * @param { AsyncCallback } callback - Callback used to sketch status data. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 11 */ - getSketchRatio(): number; + on(type: 'sketchStatusChanged', callback: AsyncCallback): void; /** - * Enable sketch feature or not, defalut is false + * Unsubscribes sketch status changed event callback. * + * @param { 'sketchStatusChanged' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get sketch status data. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 11 */ - enableSketch(isEnable: boolean):void; + off(type: 'sketchStatusChanged', callback?: AsyncCallback): void; } /** @@ -2402,6 +3335,101 @@ declare namespace camera { mirror?: boolean; } + /** + * Enumerates the delivery image types. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + enum DeferredDeliveryImageType { + /** + * Undefer image delivery. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + NONE = 0, + + /** + * Defer photo delivery when capturing photos. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + PHOTO = 1, + + /** + * Defer video delivery when capturing videos. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + VIDEO = 2 + } + + /** + * Photo object + * + * @typedef Photo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Photo { + /** + * Main image. + * + * @type { image.Image } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + main: image.Image; + + /** + * Release Photo object. + * + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + release(): Promise; + } + + /** + * DeferredPhotoProxy object + * + * @typedef DeferredPhotoProxy + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + interface DeferredPhotoProxy { + /** + * Thumbnail image. + * + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + getThumbnail(): Promise; + + /** + * Release DeferredPhotoProxy object. + * + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + release(): Promise; + } + + /** * Photo output object. * @@ -2413,7 +3441,7 @@ declare namespace camera { /** * Start capture output. * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 7400104 - Session not running. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core @@ -2435,9 +3463,9 @@ declare namespace camera { /** * Start capture output. * - * @param { PhotoCaptureSetting } setting Photo capture settings. - * @param { AsyncCallback } callback Callback used to return the result. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect + * @param { PhotoCaptureSetting } setting - Photo capture settings. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @throws { BusinessError } 7400104 - Session not running. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core @@ -2448,15 +3476,109 @@ declare namespace camera { /** * Start capture output. * - * @param { PhotoCaptureSetting } setting Photo capture settings. + * @param { PhotoCaptureSetting } setting - Photo capture settings. * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. * @throws { BusinessError } 7400104 - Session not running. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - capture(setting?: PhotoCaptureSetting): Promise; + capture(setting: PhotoCaptureSetting): Promise; + + /** + * Confirm capture in Night mode. + * + * @throws { BusinessError } 7400104 - Session not running. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + confirmCapture(); + + /** + * Confirm if the deferred image delivery supported in the specific device. + * + * @param { DeferredDeliveryImageType } type - Type of delivery image. + * @returns { boolean } TRUE if the type of delivery image is support. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400104 - Session not running. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + isDeferredImageDeliverySupported(type: DeferredDeliveryImageType): boolean; + + /** + * Confirm if the deferred image delivery enalbed. + * + * @param { DeferredDeliveryImageType } type - Type of delivery image. + * @returns { boolean } TRUE if the type of delivery image is enable. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400104 - Session not running. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + isDeferredImageDeliveryEnabled(type: DeferredDeliveryImageType): boolean; + + /** + * Sets the image type for deferred image delivery. + * + * @param { DeferredDeliveryImageType } type - Type of delivery image. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400104 - Session not running. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + deferImageDeliveryFor(type: DeferredDeliveryImageType): void; + + /** + * Subscribes photo available event callback. + * + * @param { 'photoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the Photo. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'photoAvailable', callback: AsyncCallback): void; + + /** + * Unsubscribes photo available event callback. + * + * @param { 'photoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the Photo. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'photoAvailable', callback?: AsyncCallback): void; + + /** + * Subscribes deferred photo proxy available event callback. + * + * @param { 'deferredPhotoProxyAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the DeferredPhotoProxy. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + on(type: 'deferredPhotoProxyAvailable', callback: AsyncCallback): void; + + /** + * Unsubscribes deferred photo proxy available event callback. + * + * @param { 'deferredPhotoProxyAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the DeferredPhotoProxy. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 11 + */ + off(type: 'deferredPhotoProxyAvailable', callback?: AsyncCallback): void; /** * Check whether to support mirror photo. @@ -2470,48 +3592,110 @@ declare namespace camera { /** * Subscribes capture start event callback. * - * @param { 'captureStart' } type Event type. - * @param { AsyncCallback } callback Callback used to get the capture ID. + * @param { 'captureStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture ID. * @syscap SystemCapability.Multimedia.Camera.Core + * @deprecated since 11 * @since 10 */ on(type: 'captureStart', callback: AsyncCallback): void; + /** + * Unsubscribes from capture start event callback. + * + * @param { 'captureStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture ID. + * @syscap SystemCapability.Multimedia.Camera.Core + * @deprecated since 11 + * @since 10 + */ + off(type: 'captureStart', callback?: AsyncCallback): void; + + /** + * Subscribes capture start event callback. + * + * @param { 'captureStartWithInfo' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture start info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'captureStartWithInfo', callback: AsyncCallback): void; + + /** + * Unsubscribes from capture start event callback. + * + * @param { 'captureStartWithInfo' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture start info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'captureStartWithInfo', callback?: AsyncCallback): void; + /** * Subscribes frame shutter event callback. * - * @param { 'frameShutter' } type Event type. - * @param { AsyncCallback } callback Callback used to get the frame shutter information. + * @param { 'frameShutter' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the frame shutter information. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ on(type: 'frameShutter', callback: AsyncCallback): void; + /** + * Unsubscribes from frame shutter event callback. + * + * @param { 'frameShutter' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the frame shutter information. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'frameShutter', callback?: AsyncCallback): void; + /** * Subscribes capture end event callback. * - * @param { 'captureEnd' } type Event type. - * @param { AsyncCallback } callback Callback used to get the capture end information. + * @param { 'captureEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture end information. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ on(type: 'captureEnd', callback: AsyncCallback): void; /** - * Subscribes error event callback. + * Unsubscribes from capture end event callback. + * + * @param { 'captureEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture end information. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'captureEnd', callback?: AsyncCallback): void; + + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the photo output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * Unsubscribes from error events. * - * @param { 'error' } type Event type. - * @param { ErrorCallback } callback Callback used to get the photo output errors. + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the photo output errors. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - on(type: 'error', callback: ErrorCallback): void; + off(type: 'error', callback?: ErrorCallback): void; /** - * Check if PhotoOutput supports quick thumbnails. - * Effective between CaptureSession.addIutput() and CaptureSession.addOutput(photoOutput). + * Checks whether PhotoOutput supports quick thumbnail. + * This method is valid after Session.addInput() and Session.addOutput(photoOutput) are called. * - * @returns { boolean } Is quick thumbnail supported. + * @returns { boolean } Whether quick thumbnail is supported. * @throws { BusinessError } 7400104 - session is not running. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi @@ -2520,12 +3704,12 @@ declare namespace camera { isQuickThumbnailSupported(): boolean; /** - * Enable/disable quick thumbnails. - * The method should be called after CaptureSession.addIutput() and CaptureSession.addOutput(photoOutput), - * and advised to use before CaptureSession.commitConfig(). Your Application can also call this method - * after CaptureSession.commitConfig(), but will cause streams reconfig, and then cause loss of performance. - * - * @param { boolean } enabled Enable quick thumbnail if TRUE, otherwise disable quick thumbnail. + * Enables or disables quick thumbnail. + * The method must be called after Session.addInput() and Session.addOutput(photoOutput) are called. + * To avoid stream reconfiguration and performance loss, + * you are advised to call the method before Session.commitConfig(). + * + * @param { boolean } enabled - The value TRUE means to enable quick thumbnail, and FALSE means the opposite. * @throws { BusinessError } 7400104 - session is not running. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi @@ -2534,17 +3718,28 @@ declare namespace camera { enableQuickThumbnail(enabled: boolean): void; /** - * Configure camera thumbnail callback interface. - * Effective after enableQuickThumbnail(true). + * Subscribes to camera thumbnail events. + * This method is valid only after enableQuickThumbnail(true) is called. * - * @param { 'quickThumbnail' } type Event type. - * @param { AsyncCallback } callback Callback used to get the quick thumbnail. - * @throws { BusinessError } 7400104 - session is not running. + * @param { 'quickThumbnail' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the quick thumbnail. * @syscap SystemCapability.Multimedia.Camera.Core * @systemapi * @since 10 */ on(type: 'quickThumbnail', callback: AsyncCallback): void; + + /** + * Unsubscribes from camera thumbnail events. + * This method is valid only after enableQuickThumbnail(true) is called. + * + * @param { 'quickThumbnail' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the quick thumbnail. + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + * @since 10 + */ + off(type: 'quickThumbnail', callback?: AsyncCallback): void; } /** @@ -2573,6 +3768,32 @@ declare namespace camera { timestamp: number; } + /** + * Capture start info. + * + * @typedef CaptureStartInfo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface CaptureStartInfo { + /** + * Capture id. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + captureId: number; + /** + * Time(in milliseconds) which after the value can obtain the photo. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + time: number; + } + /** * Capture end info. * @@ -2610,7 +3831,7 @@ declare namespace camera { /** * Start video output. * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 7400103 - Session not config. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core @@ -2632,7 +3853,7 @@ declare namespace camera { /** * Stop video output. * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -2650,32 +3871,62 @@ declare namespace camera { /** * Subscribes frame start event callback. * - * @param { 'frameStart' } type Event type. - * @param { AsyncCallback } callback Callback used to return the result. + * @param { 'frameStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ on(type: 'frameStart', callback: AsyncCallback): void; + /** + * Unsubscribes from frame start event callback. + * + * @param { 'frameStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'frameStart', callback?: AsyncCallback): void; + /** * Subscribes frame end event callback. * - * @param { 'frameEnd' } type Event type. - * @param { AsyncCallback } callback Callback used to return the result. + * @param { 'frameEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ on(type: 'frameEnd', callback: AsyncCallback): void; /** - * Subscribes error event callback. + * Unsubscribes from frame end event callback. + * + * @param { 'frameEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'frameEnd', callback?: AsyncCallback): void; + + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the video output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * Unsubscribes from error events. * - * @param { 'error' } type Event type. - * @param { ErrorCallback } callback Callback used to get the video output errors. + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the video output errors. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - on(type: 'error', callback: ErrorCallback): void; + off(type: 'error', callback?: ErrorCallback): void; } /** @@ -2743,6 +3994,7 @@ declare namespace camera { * Metadata object type. * * @type { MetadataObjectType } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -2751,6 +4003,7 @@ declare namespace camera { * Metadata object timestamp in milliseconds. * * @type { number } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -2759,6 +4012,7 @@ declare namespace camera { * The axis-aligned bounding box of detected metadata object. * * @type { Rect } + * @readonly * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -2776,7 +4030,7 @@ declare namespace camera { /** * Start output metadata * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 7400103 - Session not config. * @throws { BusinessError } 7400201 - Camera service fatal error. * @syscap SystemCapability.Multimedia.Camera.Core @@ -2798,7 +4052,7 @@ declare namespace camera { /** * Stop output metadata * - * @param { AsyncCallback } callback Callback used to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ @@ -2816,22 +4070,42 @@ declare namespace camera { /** * Subscribes to metadata objects available event callback. * - * @param { 'metadataObjectsAvailable' } type Event type. - * @param { AsyncCallback> } callback Callback used to get the available metadata objects. + * @param { 'metadataObjectsAvailable' } type - Event type. + * @param { AsyncCallback> } callback - Callback used to get the available metadata objects. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ on(type: 'metadataObjectsAvailable', callback: AsyncCallback>): void; /** - * Subscribes error event callback. + * Unsubscribes from metadata objects available event callback. + * + * @param { 'metadataObjectsAvailable' } type - Event type. + * @param { AsyncCallback> } callback - Callback used to get the available metadata objects. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'metadataObjectsAvailable', callback?: AsyncCallback>): void; + + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the video output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * Unsubscribes from error events. * - * @param { 'error' } type Event type. - * @param { ErrorCallback } callback Callback used to get the video output errors. + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the video output errors. * @syscap SystemCapability.Multimedia.Camera.Core * @since 10 */ - on(type: 'error', callback: ErrorCallback): void; + off(type: 'error', callback?: ErrorCallback): void; } } diff --git a/interfaces/kits/js/camera_napi/include/input/camera_napi.h b/interfaces/kits/js/camera_napi/include/input/camera_napi.h index a14ed4e3c908a71b811279006238d230d3e9d3f9..111e521bda574ace6214a5f3ba73a8fad0fa551e 100644 --- a/interfaces/kits/js/camera_napi/include/input/camera_napi.h +++ b/interfaces/kits/js/camera_napi/include/input/camera_napi.h @@ -131,10 +131,12 @@ static const std::unordered_map mapExposureState = { static const std::unordered_map mapSceneMode = { {"NORMAL", 0}, - {"CAPTURE", 1}, - {"VIDEO", 2}, + {"NORMAL_PHOTO", 1}, + {"NORMAL_VIDEO", 2}, {"PORTRAIT", 3}, + {"PORTRAIT_PHOTO", 3}, {"NIGHT", 4}, + {"NIGHT_PHOTO", 4}, {"PROFESSIONAL", 5}, {"SLOW_MOTION", 6}, };