harmony 鸿蒙Multimedia Subsystem Changelog

  • 2023-06-24
  • 浏览 (338)

Multimedia Subsystem Changelog

cl.subsystemname.1 Camera API Changed

  1. All the APIs of the camera component are changed to system APIs in the API version 9.
  2. 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): void;
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): MetadataOutput;
createCaptureSession(): CaptureSession;
Yes Added
ohos.multimedia.camera CameraManager getSupportedCameras(callback: AsyncCallback>): void;
getSupportedCameras(): Promise>;
getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void;
getSupportedOutputCapability(camera: CameraDevice): Promise;
createCameraInput(camera: CameraDevice, callback: AsyncCallback): void;
createCameraInput(camera: CameraDevice): Promise;
createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void;
createCameraInput(position: CameraPosition, type: CameraType): Promise;
createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPreviewOutput(profile: Profile, surfaceId: string): Promise;
createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPhotoOutput(profile: Profile, surfaceId: string): Promise;
createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void;
createVideoOutput(profile: VideoProfile, surfaceId: string): Promise;
createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void;
createMetadataOutput(metadataObjectTypes: Array): Promise;
createCaptureSession(callback: AsyncCallback): void;
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): void; Yes Added
ohos.multimedia.camera CameraInput release(callback: AsyncCallback): void;
release(): Promise;
on(type: ‘error’, camera: CameraDevice, callback: ErrorCallback): void;
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): void;
Yes Added
ohos.multimedia.camera CaptureSession beginConfig(callback: AsyncCallback): void;
beginConfig(): Promise;
addInput(cameraInput: CameraInput, callback: AsyncCallback): void;
addInput(cameraInput: CameraInput): Promise;
removeInput(cameraInput: CameraInput, callback: AsyncCallback): void;
removeInput(cameraInput: CameraInput): Promise;
addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
addOutput(cameraOutput: CameraOutput): Promise;
removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
removeOutput(cameraOutput: CameraOutput): Promise;
hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise;
isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise;
getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise;
setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise;
isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise;
getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise;
setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise;
getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise;
setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise;
getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>;
setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise;
getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise;
isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise;
getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise;
setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise;
setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise;
getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise;
getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise;
getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>;
getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise;
setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise;
getActiveVideoStabilizationMode(callback: AsyncCallback): void;
getActiveVideoStabilizationMode(): Promise;
setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void;
setVideoStabilizationMode(mode: VideoStabilizationMode): Promise;
on(type: ‘error’, callback: ErrorCallback): void;
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): void; Yes Added
ohos.multimedia.camera PreviewOutput on(type: ‘error’, callback: ErrorCallback): void; 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): void;
Yes Added
ohos.multimedia.camera PhotoOutput isMirrorSupported(callback: AsyncCallback): void;
isMirrorSupported(): Promise;
on(type: ‘error’, callback: ErrorCallback): void;
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): void; Yes Added
ohos.multimedia.camera VideoOutput on(type: ‘error’, callback: ErrorCallback): void; 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): void;
getType(): Promise;
getTimestamp(callback: AsyncCallback): void;
getTimestamp(): Promise;
getBoundingBox(callback: AsyncCallback): void;
getBoundingBox(): Promise;
Yes Deprecated
ohos.multimedia.camera MetadataFaceObject readonly boundingBox: Rect Yes Added
ohos.multimedia.camera MetadataOutput on(type: ‘error’, callback: ErrorCallback): void; Yes Added
ohos.multimedia.camera MetadataOutput on(type: ‘error’, callback: ErrorCallback): void; 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

  1. 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

  1. Added capture(): Promise to the PhotoOutput API.

  2. Added the readonly type MetadataObjectType to the MetadataObject API.

  3. Added readonly timestamp: number to the MetadataObject API.

  4. Added readonly boundingBox: Rect to the MetadataObject API.

Deprecated APIs

  1. Deprecated the release(callback: AsyncCallback): void and release(): Promise APIs in CameraInput.

  2. 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

  3. Deprecated the CameraInputError API and its attribute CameraInputErrorCode.

  4. Deprecated the CaptureSessionErrorCode enums and all their values: ERROR_UNKNOWN = -1, ERROR_INSUFFICIENT_RESOURCES = 0, ERROR_TIMEOUT = 1

  5. Deprecated the CaptureSessionError API and its attribute CaptureSessionErrorCode.

  6. Deprecated the PreviewOutputErrorCode enum and its value: ERROR_UNKNOWN = -1

  7. Deprecated the PreviewOutputError API and its attribute PreviewOutputErrorCode.

  8. Deprecated the PhotoOutputErrorCode enums and all their values: ERROR_UNKNOWN = -1, ERROR_DRIVER_ERROR = 0, ERROR_INSUFFICIENT_RESOURCES = 1, ERROR_TIMEOUT = 2

  9. Deprecated the PhotoOutputError API and its attribute PhotoOutputErrorCode.

  10. Deprecated the VideoOutputErrorCode enums and all their values: ERROR_UNKNOWN = -1, ERROR_DRIVER_ERROR = 0

  11. Deprecated the VideoOutputError API and its attribute VideoOutputErrorCode.

  12. Deprecated getType(callback: AsyncCallback): void in the MetadataObject API.

  13. Deprecated getType(): Promise in the MetadataObject API.

  14. Deprecated getTimestamp(callback: AsyncCallback): void in the MetadataObject API.

  15. Deprecated getTimestamp(): Promise in the MetadataObject API.

  16. Deprecated getBoundingBox(callback: AsyncCallback): void in the MetadataObject API.

  17. Deprecated getBoundingBox(): Promise in the MetadataObject API.

  18. Deprecated the MetadataOutputErrorCode enums and all their values: ERROR_UNKNOWN = -1, ERROR_INSUFFICIENT_RESOURCES = 0

  19. Deprecated the MetadataOutputError API and its attribute MetadataOutputErrorCode.

Changed APIs

  1. 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): Promise are changed to getCameraManager(context: Context): CameraManager.

The code snippet is as follows:

   let cameraManager = camera.getCameraManager(context);
  1. 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>): void and getSupportedCameras(): Promise> are changed to getSupportedCameras(): Array.

The code snippet is as follows:

   let cameras = cameraManager.getSupportedCameras();
  1. 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): Promise are changed to getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability.

The code snippet is as follows:

   let cameraDevice = cameras[0];
   let CameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraDevice);
  1. 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): Promise are changed to createCameraInput(camera: CameraDevice): CameraInput.

The code snippet is as follows:

   let cameraDevice = cameras[0];
   let cameraInput = cameraManager.createCameraInput(cameraDevice);
  1. 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): Promise are 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);
  1. 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): Promise are 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);
  1. 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): Promise are 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);
  1. 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): Promise are 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);
  1. 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): void and createMetadataOutput(metadataObjectTypes: Array): Promise are changed to createMetadataOutput(metadataObjectTypes: Array): MetadataOutput.

The code snippet is as follows:

   let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes;
   let metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes);
  1. 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(): Promise are changed to createCaptureSession(): CaptureSession.

    The code snippet is as follows:

    let captureSession = cameraManager.createCaptureSession();
    
  2. Changed the enum CAMERA_TYPE_UNSPECIFIED of CameraType to CAMERA_TYPE_DEFAULT.

  3. 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) => {
    
    
    })
    
  4. 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(): Promise are changed to beginConfig(): void.

    The code snippet is as follows:

    captureSession.beginConfig();
    
  5. 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): Promise are changed to addInput(cameraInput: CameraInput): void.

    The code snippet is as follows:

    captureSession.addInput(cameraInput);
    
  6. 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): Promise are changed to removeInput(cameraInput: CameraInput): void.

    The code snippet is as follows:

    captureSession.removeInput(cameraInput);
    
  7. 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): Promise are changed to addOutput(cameraOutput: CameraOutput): void.

    The code snippet is as follows:

    captureSession.addOutput(previewOutput);
    
  8. 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): Promise are changed to removeOutput(cameraOutput: CameraOutput): void.

    The code snippet is as follows:

    captureSession.removeOutput(previewOutput);
    
  9. 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(): Promise are changed to hasFlash(): boolean.

    The code snippet is as follows:

    let status = captureSession.hasFlash();
    
  10. 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): Promise are changed to isFlashModeSupported(flashMode: FlashMode): boolean.

    The code snippet is as follows:

    let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO);
    
  11. 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(): Promise are changed to getFlashMode(): FlashMode.

    The code snippet is as follows:

    let flashMode = captureSession.getFlashMode();
    
  12. 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): Promise are changed to isExposureModeSupported(aeMode: ExposureMode): boolean.

    The code snippet is as follows:

    let isSupported = captureSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
    
  13. 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(): Promise are changed to getExposureMode(): ExposureMode.

    The code snippet is as follows:

    let exposureMode = captureSession.getExposureMode();
    
  14. 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): Promise are changed to setExposureMode(aeMode: ExposureMode): void.

    The code snippet is as follows:

    captureSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
    
  15. 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(): Promise are changed to getMeteringPoint(): Point.

    The code snippet is as follows:

    let exposurePoint = captureSession.getMeteringPoint();
    
  16. 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): Promise are changed to setMeteringPoint(point: Point): void.

    The code snippet is as follows:

    let Point2 = {x: 2, y: 2};
    captureSession.setMeteringPoint(Point2);
    
  17. 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>): void and getExposureBiasRange(): Promise> are changed to getExposureBiasRange(): Array.

    The code snippet is as follows:

    let biasRangeArray = captureSession.getExposureBiasRange();
    
  18. 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): Promise are changed to setExposureBias(exposureBias: number): void.

    The code snippet is as follows:

    let exposureBias = biasRangeArray[0];
    captureSession.setExposureBias(exposureBias);
    
  19. 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(): Promise are changed to getExposureValue(): number.

    The code snippet is as follows:

    let exposureValue = captureSession.getExposureValue();
    
  20. 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): Promise are changed to isFocusModeSupported(afMode: FocusMode): boolean.

    The code snippet is as follows:

    let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO);
    
  21. 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(): Promise are changed to getFocusMode(): FocusMode.

    The code snippet is as follows:

    let afMode = captureSession.getFocusMode();
    
  22. 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): Promise are changed to setFocusMode(afMode: FocusMode): void.

    The code snippet is as follows:

    captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO);
    
  23. 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): Promise are changed to setFocusPoint(point: Point): void.

    The code snippet is as follows:

    let Point2 = {x: 2, y: 2};
    captureSession.setFocusPoint(Point2);
    
  24. 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(): Promise are changed to getFocusPoint(): Point.

    The code snippet is as follows:

    let point = captureSession.getFocusPoint();
    
  25. 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(): Promise are changed to getFocalLength(): number.

    The code snippet is as follows:

    let focalLength = captureSession.getFocalLength();
    
  26. 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>): void and getZoomRatioRange(): Promise> are changed to getZoomRatioRange(): Array.

    The code snippet is as follows:

    let zoomRatioRange = captureSession.getZoomRatioRange();
    
  27. 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(): Promise are changed to getZoomRatio(): number.

    The code snippet is as follows:

    let zoomRatio = captureSession.getZoomRatio();
    
  28. 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): Promise are changed to setZoomRatio(zoomRatio: number): void.

    The code snippet is as follows:

    let zoomRatio = zoomRatioRange[0];
    captureSession.setZoomRatio(zoomRatio);
    
  29. 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): Promise are changed to isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean.

    The code snippet is as follows:

    let isSupported = captureSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF);
    
  30. 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(): Promise are changed to getActiveVideoStabilizationMode(): VideoStabilizationMode.

    The code snippet is as follows:

    let vsMode = captureSession.getActiveVideoStabilizationMode();
    
  31. 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): Promise are changed to setVideoStabilizationMode(mode: VideoStabilizationMode): void.

    The code snippet is as follows:

    captureSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF);
    
  32. 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) => {
    
    
    })
    
  33. 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) => {
    
    
    })
    
  34. 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(): Promise are changed to isMirrorSupported(): boolean.

    The code snippet is as follows:

    let isSupported = photoOutput.isMirrorSupported();
    
  35. 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) => {
    
    
    })
    
  36. 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) => {
    
    
    })
    
  37. 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) => {
    
    
    })
    

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Readme

harmony 鸿蒙Example Subsystem Changelog

harmony 鸿蒙Ability Framework Changelog

harmony 鸿蒙Account Subsystem Changelog

harmony 鸿蒙ArkUI Subsystem ChangeLog

harmony 鸿蒙Common Library Subsystem Changelog

harmony 鸿蒙Distributed Data Management Subsystem JS API Changelog

harmony 鸿蒙File Management Subsystem Changelog

harmony 鸿蒙Input Method Framework ChangeLog

harmony 鸿蒙File Management Subsystem Changelog

0  赞