Multimedia Subsystem Changelog
cl.subsystemname.1 Camera API Changed
- All the APIs of the camera component are changed to system APIs in the API version 9.
- Some functional APIs are added and some others are deprecated to:
Improve the usability of camera APIs. Help you quickly understand camera APIs and use them for development. Facilitate expansion of framework functions in later versions, and reduce coupling between framework modules.
You need to refer to the following change description to adapt your application.
Change Impact
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
Key API/Component Changes
Module | Class | Method/Attribute/Enum/Constant | Is System API | Change Type |
---|---|---|---|---|
ohos.multimedia.camera | camera | function getCameraManager(context: Context): CameraManager; | Yes | Added |
ohos.multimedia.camera | camera | function getCameraManager(context: Context, callback: AsyncCallback function getCameraManager(context: Context): Promise |
Yes | Deprecated |
ohos.multimedia.camera | CameraErrorCode | INVALID_ARGUMENT = 7400101, OPERATION_NOT_ALLOWED = 7400102, SESSION_NOT_CONFIG = 7400103, SESSION_NOT_RUNNING = 7400104, SESSION_CONFIG_LOCKED = 7400105, DEVICE_SETTING_LOCKED = 7400106, CONFILICT_CAMERA = 7400107, DEVICE_DISABLED = 7400108, SERVICE_FATAL_ERROR = 7400201 |
Yes | Added |
ohos.multimedia.camera | CameraManager | getSupportedCameras(): Array getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability; createCameraInput(camera: CameraDevice): CameraInput; createCameraInput(position: CameraPosition, type: CameraType): CameraInput; createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput; createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput; createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput; createMetadataOutput(metadataObjectTypes: Array createCaptureSession(): CaptureSession; |
Yes | Added |
ohos.multimedia.camera | CameraManager | getSupportedCameras(callback: AsyncCallback<Array getSupportedCameras(): Promise<Array getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback getSupportedOutputCapability(camera: CameraDevice): Promise createCameraInput(camera: CameraDevice, callback: AsyncCallback createCameraInput(camera: CameraDevice): Promise createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback createCameraInput(position: CameraPosition, type: CameraType): Promise createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback createPreviewOutput(profile: Profile, surfaceId: string): Promise createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback createPhotoOutput(profile: Profile, surfaceId: string): Promise createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback createVideoOutput(profile: VideoProfile, surfaceId: string): Promise createMetadataOutput(metadataObjectTypes: Array createMetadataOutput(metadataObjectTypes: Array createCaptureSession(callback: AsyncCallback createCaptureSession(): Promise |
Yes | Deprecated |
ohos.multimedia.camera | CameraType | CAMERA_TYPE_DEFAULT = 0 | Yes | Added |
ohos.multimedia.camera | CameraType | CAMERA_TYPE_UNSPECIFIED = 0 | Yes | Deprecated |
ohos.multimedia.camera | CameraInput | on(type: 'error', camera: CameraDevice, callback: ErrorCallback |
Yes | Added |
ohos.multimedia.camera | CameraInput | release(callback: AsyncCallback release(): Promise on(type: 'error', camera: CameraDevice, callback: ErrorCallback |
Yes | Deprecated |
ohos.multimedia.camera | CameraInputErrorCode | ERROR_UNKNOWN = -1 ERROR_NO_PERMISSION = 0 ERROR_DEVICE_PREEMPTED = 1 ERROR_DEVICE_DISCONNECTED = 2 ERROR_DEVICE_IN_USE = 3 ERROR_DRIVER_ERROR = 4 |
Yes | Deprecated |
ohos.multimedia.camera | CameraInputError | code: CameraInputErrorCode | Yes | Deprecated |
ohos.multimedia.camera | CaptureSession | beginConfig(): void; addInput(cameraInput: CameraInput): void; removeInput(cameraInput: CameraInput): void; addOutput(cameraOutput: CameraOutput): void; removeOutput(cameraOutput: CameraOutput): void; hasFlash(): boolean; isFlashModeSupported(flashMode: FlashMode): boolean; getFlashMode(): FlashMode; setFlashMode(flashMode: FlashMode): void; isExposureModeSupported(aeMode: ExposureMode): boolean; getExposureMode(): ExposureMode; setExposureMode(aeMode: ExposureMode): void; getMeteringPoint(): Point; setMeteringPoint(point: Point): void; getExposureBiasRange(): Array setExposureBias(exposureBias: number): void; getExposureValue(): number; isFocusModeSupported(afMode: FocusMode): boolean; getFocusMode(): FocusMode; setFocusMode(afMode: FocusMode): void; setFocusPoint(point: Point): void; getFocusPoint(): Point; getFocalLength(): number; getZoomRatioRange(): Array getZoomRatio(): number; setZoomRatio(zoomRatio: number): void; isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean; getActiveVideoStabilizationMode(): VideoStabilizationMode; setVideoStabilizationMode(mode: VideoStabilizationMode): void; on(type: 'error', callback: ErrorCallback |
Yes | Added |
ohos.multimedia.camera | CaptureSession | beginConfig(callback: AsyncCallback beginConfig(): Promise addInput(cameraInput: CameraInput, callback: AsyncCallback addInput(cameraInput: CameraInput): Promise removeInput(cameraInput: CameraInput, callback: AsyncCallback removeInput(cameraInput: CameraInput): Promise addOutput(cameraOutput: CameraOutput, callback: AsyncCallback addOutput(cameraOutput: CameraOutput): Promise removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback removeOutput(cameraOutput: CameraOutput): Promise hasFlash(callback: AsyncCallback hasFlash(): Promise isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback isFlashModeSupported(flashMode: FlashMode): Promise getFlashMode(callback: AsyncCallback getFlashMode(): Promise setFlashMode(flashMode: FlashMode, callback: AsyncCallback setFlashMode(flashMode: FlashMode): Promise isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback isExposureModeSupported(aeMode: ExposureMode): Promise getExposureMode(callback: AsyncCallback getExposureMode(): Promise setExposureMode(aeMode: ExposureMode, callback: AsyncCallback setExposureMode(aeMode: ExposureMode): Promise getMeteringPoint(callback: AsyncCallback getMeteringPoint(): Promise setMeteringPoint(point: Point, callback: AsyncCallback setMeteringPoint(point: Point): Promise getExposureBiasRange(callback: AsyncCallback<Array getExposureBiasRange(): Promise<Array setExposureBias(exposureBias: number, callback: AsyncCallback setExposureBias(exposureBias: number): Promise getExposureValue(callback: AsyncCallback getExposureValue(): Promise isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback isFocusModeSupported(afMode: FocusMode): Promise getFocusMode(callback: AsyncCallback getFocusMode(): Promise setFocusMode(afMode: FocusMode, callback: AsyncCallback setFocusMode(afMode: FocusMode): Promise setFocusPoint(point: Point, callback: AsyncCallback setFocusPoint(point: Point): Promise getFocusPoint(callback: AsyncCallback getFocusPoint(): Promise getFocalLength(callback: AsyncCallback getFocalLength(): Promise getZoomRatioRange(callback: AsyncCallback<Array getZoomRatioRange(): Promise<Array getZoomRatio(callback: AsyncCallback getZoomRatio(): Promise setZoomRatio(zoomRatio: number, callback: AsyncCallback setZoomRatio(zoomRatio: number): Promise isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise getActiveVideoStabilizationMode(callback: AsyncCallback getActiveVideoStabilizationMode(): Promise setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback setVideoStabilizationMode(mode: VideoStabilizationMode): Promise on(type: 'error', callback: ErrorCallback |
Yes | Deprecated |
ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_UNKNOWN = -1 ERROR_INSUFFICIENT_RESOURCES = 0 ERROR_TIMEOUT = 1 |
Yes | Deprecated |
ohos.multimedia.camera | CaptureSessionError | code: CaptureSessionErrorCode | Yes | Deprecated |
ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback |
Yes | Added |
ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback |
Yes | Deprecated |
ohos.multimedia.camera | PreviewOutputErrorCode | ERROR_UNKNOWN = -1 | Yes | Deprecated |
ohos.multimedia.camera | PreviewOutputError | code: PreviewOutputErrorCode | Yes | Deprecated |
ohos.multimedia.camera | PhotoOutput | capture(): Promise isMirrorSupported(): boolean; on(type: 'error', callback: ErrorCallback |
Yes | Added |
ohos.multimedia.camera | PhotoOutput | isMirrorSupported(callback: AsyncCallback isMirrorSupported(): Promise on(type: 'error', callback: ErrorCallback |
Yes | Deprecated |
ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_UNKNOWN = -1 ERROR_DRIVER_ERROR = 0 ERROR_INSUFFICIENT_RESOURCES = 1 ERROR_TIMEOUT = 2 |
Yes | Deprecated |
ohos.multimedia.camera | PhotoOutputError | code: PhotoOutputErrorCode | Yes | Deprecated |
ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback |
Yes | Added |
ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback |
Yes | Deprecated |
ohos.multimedia.camera | VideoOutputErrorCode | ERROR_UNKNOWN = -1 ERROR_DRIVER_ERROR = 0 |
Yes | Deprecated |
ohos.multimedia.camera | VideoOutputError | code: VideoOutputErrorCode | Yes | Deprecated |
ohos.multimedia.camera | MetadataObject | readonly type: MetadataObjectType; readonly timestamp: number; |
Yes | Added |
ohos.multimedia.camera | MetadataObject | getType(callback: AsyncCallback getType(): Promise getTimestamp(callback: AsyncCallback getTimestamp(): Promise getBoundingBox(callback: AsyncCallback getBoundingBox(): Promise |
Yes | Deprecated |
ohos.multimedia.camera | MetadataFaceObject | readonly boundingBox: Rect | Yes | Added |
ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback |
Yes | Added |
ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback |
Yes | Deprecated |
ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1 ERROR_INSUFFICIENT_RESOURCES = 0 |
Yes | Deprecated |
ohos.multimedia.camera | MetadataOutputError | code: MetadataOutputErrorCode | Yes | Deprecated |
Adaptation Guide
In addition to new APIs and deprecated APIs, you need to adapt your application to changed APIs.
In Beta4 and later versions, the following APIs are changed.
New APIs
-
CameraErrorCode enums
Enum: INVALID_ARGUMENT; value: 7400101
Enum: OPERATION_NOT_ALLOWED; value: 7400102
Enum: SESSION_NOT_CONFIG; value: 7400103
Enum: SESSION_NOT_RUNNING; value: 7400104
Enum: SESSION_CONFIG_LOCKED; value: 7400105
Enum: DEVICE_SETTING_LOCKED; value: 7400106
Enum: CONFILICT_CAMERA; value: 7400107
Enum: DEVICE_DISABLED; value: 7400108
Enum: SERVICE_FATAL_ERROR; value: 7400201
-
Added capture(): Promise
to the PhotoOutput API. -
Added the readonly type MetadataObjectType to the MetadataObject API.
-
Added readonly timestamp: number to the MetadataObject API.
-
Added readonly boundingBox: Rect to the MetadataObject API.
Deprecated APIs
-
Deprecated the release(callback: AsyncCallback
): void and release(): PromiseAPIs in CameraInput. -
Deprecated the CameraInputErrorCode enums and all their values: ERROR_UNKNOWN = -1, ERROR_NO_PERMISSION = 0, ERROR_DEVICE_PREEMPTED = 1, ERROR_DEVICE_DISCONNECTED = 2, ERROR_DEVICE_IN_USE = 3, ERROR_DRIVER_ERROR = 4
-
Deprecated the CameraInputError API and its attribute CameraInputErrorCode.
-
Deprecated the CaptureSessionErrorCode enums and all their values: ERROR_UNKNOWN = -1, ERROR_INSUFFICIENT_RESOURCES = 0, ERROR_TIMEOUT = 1
-
Deprecated the CaptureSessionError API and its attribute CaptureSessionErrorCode.
-
Deprecated the PreviewOutputErrorCode enum and its value: ERROR_UNKNOWN = -1
-
Deprecated the PreviewOutputError API and its attribute PreviewOutputErrorCode.
-
Deprecated the PhotoOutputErrorCode enums and all their values: ERROR_UNKNOWN = -1, ERROR_DRIVER_ERROR = 0, ERROR_INSUFFICIENT_RESOURCES = 1, ERROR_TIMEOUT = 2
-
Deprecated the PhotoOutputError API and its attribute PhotoOutputErrorCode.
-
Deprecated the VideoOutputErrorCode enums and all their values: ERROR_UNKNOWN = -1, ERROR_DRIVER_ERROR = 0
-
Deprecated the VideoOutputError API and its attribute VideoOutputErrorCode.
-
Deprecated getType(callback: AsyncCallback
): void in the MetadataObject API. -
Deprecated getType(): Promise
in the MetadataObject API. -
Deprecated getTimestamp(callback: AsyncCallback
): void in the MetadataObject API. -
Deprecated getTimestamp(): Promise
in the MetadataObject API. -
Deprecated getBoundingBox(callback: AsyncCallback
): void in the MetadataObject API. -
Deprecated getBoundingBox(): Promise
in the MetadataObject API. -
Deprecated the MetadataOutputErrorCode enums and all their values: ERROR_UNKNOWN = -1, ERROR_INSUFFICIENT_RESOURCES = 0
-
Deprecated the MetadataOutputError API and its attribute MetadataOutputErrorCode.
Changed APIs
-
Changed the return modes of the getCameraManager API in the camera module from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getCameraManager(context: Context, callback: AsyncCallback
): void and getCameraManager(context: Context): Promiseare changed to getCameraManager(context: Context): CameraManager. The code snippet is as follows:
let cameraManager = camera.getCameraManager(context);
-
Changed the return modes of the getSupportedCameras API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getSupportedCameras(callback: AsyncCallback<Array
>): void and getSupportedCameras(): Promise<Array> are changed to getSupportedCameras(): Array. The code snippet is as follows:
let cameras = cameraManager.getSupportedCameras();
-
Changed the return modes of the getSupportedOutputCapability API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback
): void and getSupportedOutputCapability(camera: CameraDevice): Promiseare changed to getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability. The code snippet is as follows:
let cameraDevice = cameras[0]; let CameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraDevice);
-
Changed the return modes of the createCameraInput(camera: CameraDevice) API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs createCameraInput(camera: CameraDevice, callback: AsyncCallback
): void and createCameraInput(camera: CameraDevice): Promiseare changed to createCameraInput(camera: CameraDevice): CameraInput. The code snippet is as follows:
let cameraDevice = cameras[0]; let cameraInput = cameraManager.createCameraInput(cameraDevice);
-
Changed the return modes of the createCameraInput(position: CameraPosition, type: CameraType) API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback
): void and createCameraInput(position: CameraPosition, type: CameraType): Promiseare changed to createCameraInput(position: CameraPosition, type: CameraType): CameraInput. The code snippet is as follows:
let cameraDevice = cameras[0]; let position = cameraDevice.cameraPosition; let type = cameraDevice.cameraType; let cameraInput = cameraManager.createCameraInput(position, type);
-
Changed the return modes of the createPreviewOutput API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback
): void and createPreviewOutput(profile: Profile, surfaceId: string): Promiseare changed to createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput. The code snippet is as follows:
let profile = cameraoutputcapability.previewProfiles[0]; let previewOutput = cameraManager.createPreviewOutput(profile, surfaceId);
-
Changed the return modes of the createPhotoOutput API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback
): void and createPhotoOutput(profile: Profile, surfaceId: string): Promiseare changed to createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput. The code snippet is as follows:
let profile = cameraoutputcapability.photoProfiles[0]; let photoOutput = cameraManager.createPhotoOutput(profile, surfaceId);
-
Changed the return modes of the createVideoOutput API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback
): void and createVideoOutput(profile: VideoProfile, surfaceId: string): Promiseare changed to createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput. The code snippet is as follows:
let profile = cameraoutputcapability.videoProfiles[0]; let videoOutput = cameraManager.createVideoOutput(profile, surfaceId);
-
Changed the return modes of the createMetadataOutput API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs createMetadataOutput(metadataObjectTypes: Array
, callback: AsyncCallback and createMetadataOutput(metadataObjectTypes: Array): void ): Promise are changed to createMetadataOutput(metadataObjectTypes: Array): MetadataOutput .The code snippet is as follows:
let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes; let metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes);
-
Changed the return modes of the createCaptureSession API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs createCaptureSession(callback: AsyncCallback
): void and createCaptureSession(): Promiseare changed to createCaptureSession(): CaptureSession. The code snippet is as follows:
let captureSession = cameraManager.createCaptureSession();
-
Changed the enum CAMERA_TYPE_UNSPECIFIED of CameraType to CAMERA_TYPE_DEFAULT.
-
Changed the return value type of the on API in CameraInput from CameraInputError to BusinessError. Therefore, the original API on(type: 'error', camera: CameraDevice, callback: ErrorCallback
): void is changed to on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void .The code snippet is as follows:
let cameraDevice = cameras[0]; cameraInput.on('error', cameraDevice, (BusinessError) => { })
-
Changed the return modes of the beginConfig API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs beginConfig(callback: AsyncCallback
): void and beginConfig(): Promiseare changed to beginConfig(): void. The code snippet is as follows:
captureSession.beginConfig();
-
Changed the return modes of the addInput API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs addInput(cameraInput: CameraInput, callback: AsyncCallback
): void and addInput(cameraInput: CameraInput): Promiseare changed to addInput(cameraInput: CameraInput): void. The code snippet is as follows:
captureSession.addInput(cameraInput);
-
Changed the return modes of the removeInput API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs removeInput(cameraInput: CameraInput, callback: AsyncCallback
): void and removeInput(cameraInput: CameraInput): Promiseare changed to removeInput(cameraInput: CameraInput): void. The code snippet is as follows:
captureSession.removeInput(cameraInput);
-
Changed the return modes of the addOutput API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs addOutput(cameraOutput: CameraOutput, callback: AsyncCallback
): void and addOutput(cameraOutput: CameraOutput): Promiseare changed to addOutput(cameraOutput: CameraOutput): void. The code snippet is as follows:
captureSession.addOutput(previewOutput);
-
Changed the return modes of the removeOutput API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback
): void and removeOutput(cameraOutput: CameraOutput): Promiseare changed to removeOutput(cameraOutput: CameraOutput): void. The code snippet is as follows:
captureSession.removeOutput(previewOutput);
-
Changed the return modes of the hasFlash API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs hasFlash(callback: AsyncCallback
): void and hasFlash(): Promiseare changed to hasFlash(): boolean. The code snippet is as follows:
let status = captureSession.hasFlash();
-
Changed the return modes of the isFlashModeSupported API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback
): void and isFlashModeSupported(flashMode: FlashMode): Promiseare changed to isFlashModeSupported(flashMode: FlashMode): boolean. The code snippet is as follows:
let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO);
-
Changed the return modes of the getFlashMode API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getFlashMode(callback: AsyncCallback
): void and getFlashMode(): Promiseare changed to getFlashMode(): FlashMode. The code snippet is as follows:
let flashMode = captureSession.getFlashMode();
-
Changed the return modes of the isExposureModeSupported API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback
): void and isExposureModeSupported(aeMode: ExposureMode): Promiseare changed to isExposureModeSupported(aeMode: ExposureMode): boolean. The code snippet is as follows:
let isSupported = captureSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
-
Changed the return modes of the getExposureMode API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getExposureMode(callback: AsyncCallback
): void and getExposureMode(): Promiseare changed to getExposureMode(): ExposureMode. The code snippet is as follows:
let exposureMode = captureSession.getExposureMode();
-
Changed the return modes of the setExposureMode API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs setExposureMode(aeMode: ExposureMode, callback: AsyncCallback
): void and setExposureMode(aeMode: ExposureMode): Promiseare changed to setExposureMode(aeMode: ExposureMode): void. The code snippet is as follows:
captureSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
-
Changed the return modes of the getMeteringPoint API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getMeteringPoint(callback: AsyncCallback
): void and getMeteringPoint(): Promiseare changed to getMeteringPoint(): Point. The code snippet is as follows:
let exposurePoint = captureSession.getMeteringPoint();
-
Changed the return modes of the setMeteringPoint API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs setMeteringPoint(point: Point, callback: AsyncCallback
): void and setMeteringPoint(point: Point): Promiseare changed to setMeteringPoint(point: Point): void. The code snippet is as follows:
let Point2 = {x: 2, y: 2}; captureSession.setMeteringPoint(Point2);
-
Changed the return modes of the getExposureBiasRange API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getExposureBiasRange(callback: AsyncCallback<Array
>): void and getExposureBiasRange(): Promise<Array> are changed to getExposureBiasRange(): Array. The code snippet is as follows:
let biasRangeArray = captureSession.getExposureBiasRange();
-
Changed the return modes of the setExposureBias API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs setExposureBias(exposureBias: number, callback: AsyncCallback
): void and setExposureBias(exposureBias: number): Promiseare changed to setExposureBias(exposureBias: number): void. The code snippet is as follows:
let exposureBias = biasRangeArray[0]; captureSession.setExposureBias(exposureBias);
-
Changed the return modes of the getExposureValue API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getExposureValue(callback: AsyncCallback
): void and getExposureValue(): Promiseare changed to getExposureValue(): number. The code snippet is as follows:
let exposureValue = captureSession.getExposureValue();
-
Changed the return modes of the isFocusModeSupported API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback
): void and isFocusModeSupported(afMode: FocusMode): Promiseare changed to isFocusModeSupported(afMode: FocusMode): boolean. The code snippet is as follows:
let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO);
-
Changed the return modes of the getFocusMode API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getFocusMode(callback: AsyncCallback
): void and getFocusMode(): Promiseare changed to getFocusMode(): FocusMode. The code snippet is as follows:
let afMode = captureSession.getFocusMode();
-
Changed the return modes of the setFocusMode API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs setFocusMode(afMode: FocusMode, callback: AsyncCallback
): void and setFocusMode(afMode: FocusMode): Promiseare changed to setFocusMode(afMode: FocusMode): void. The code snippet is as follows:
captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO);
-
Changed the return modes of the setFocusPoint API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs setFocusPoint(point: Point, callback: AsyncCallback
): void and setFocusPoint(point: Point): Promiseare changed to setFocusPoint(point: Point): void. The code snippet is as follows:
let Point2 = {x: 2, y: 2}; captureSession.setFocusPoint(Point2);
-
Changed the return modes of the getFocusPoint API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getFocusPoint(callback: AsyncCallback
): void and getFocusPoint(): Promiseare changed to getFocusPoint(): Point. The code snippet is as follows:
let point = captureSession.getFocusPoint();
-
Changed the return modes of the getFocalLength API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getFocalLength(callback: AsyncCallback
): void and getFocalLength(): Promiseare changed to getFocalLength(): number. The code snippet is as follows:
let focalLength = captureSession.getFocalLength();
-
Changed the return modes of the getZoomRatioRange API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getZoomRatioRange(callback: AsyncCallback<Array
>): void and getZoomRatioRange(): Promise<Array> are changed to getZoomRatioRange(): Array. The code snippet is as follows:
let zoomRatioRange = captureSession.getZoomRatioRange();
-
Changed the return modes of the getZoomRatio API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getZoomRatio(callback: AsyncCallback
): void and getZoomRatio(): Promiseare changed to getZoomRatio(): number. The code snippet is as follows:
let zoomRatio = captureSession.getZoomRatio();
-
Changed the return modes of the setZoomRatio API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs setZoomRatio(zoomRatio: number, callback: AsyncCallback
): void and setZoomRatio(zoomRatio: number): Promiseare changed to setZoomRatio(zoomRatio: number): void. The code snippet is as follows:
let zoomRatio = zoomRatioRange[0]; captureSession.setZoomRatio(zoomRatio);
-
Changed the return modes of the isVideoStabilizationModeSupported API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback
): void and isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promiseare changed to isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean. The code snippet is as follows:
let isSupported = captureSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF);
-
Changed the return modes of the getActiveVideoStabilizationMode API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs getActiveVideoStabilizationMode(callback: AsyncCallback
): void and getActiveVideoStabilizationMode(): Promiseare changed to getActiveVideoStabilizationMode(): VideoStabilizationMode. The code snippet is as follows:
let vsMode = captureSession.getActiveVideoStabilizationMode();
-
Changed the return modes of the setVideoStabilizationMode API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback
): void and setVideoStabilizationMode(mode: VideoStabilizationMode): Promiseare changed to setVideoStabilizationMode(mode: VideoStabilizationMode): void. The code snippet is as follows:
captureSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF);
-
Changed the on(type:'error') callback type in CaptureSession from ErrorCallback
to ErrorCallback . Therefore, the original API on(type: 'error', callback: ErrorCallback ): void is changed to on(type: 'error', callback: ErrorCallback): void .The code snippet is as follows:
captureSession.on('error', (BusinessError) => { })
-
Changed the on(type:'error') callback type in PreviewOutput, from ErrorCallback
to ErrorCallback . Therefore, the original API on(type: 'error', callback: ErrorCallback ): void is changed to on(type: 'error', callback: ErrorCallback): void .The code snippet is as follows:
previewOutput.on('error', (BusinessError) => { })
-
Changed the return modes of the isMirrorSupported API in PhotoOutput from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs isMirrorSupported(callback: AsyncCallback
): void and isMirrorSupported(): Promiseare changed to isMirrorSupported(): boolean. The code snippet is as follows:
let isSupported = photoOutput.isMirrorSupported();
-
Changed the on(type:'error') callback type in PhotoOutput, from ErrorCallback
to ErrorCallback . Therefore, the original API on(type: 'error', callback: ErrorCallback ): void is changed to on(type: 'error', callback: ErrorCallback): void .The code snippet is as follows:
PhotoOutput.on('error', (BusinessError) => { })
-
Changed the on(type:'error') callback type in VideoOutput, from ErrorCallback
to ErrorCallback . Therefore, the original API on(type: 'error', callback: ErrorCallback ): void is changed to on(type: 'error', callback: ErrorCallback): void .The code snippet is as follows:
VideoOutput.on('error', (BusinessError) => { })
-
Changed the on(type:'error') callback type in MetadataOutput, from ErrorCallback
to ErrorCallback . Therefore, the original API on(type: 'error', callback: ErrorCallback ): void is changed to on(type: 'error', callback: ErrorCallback): void .The code snippet is as follows:
MetadataOutput.on('error', (BusinessError) => { })