harmony 鸿蒙媒体子系统 JS API 变更 Changelog
媒体子系统 JS API 变更 Changelog
OpenHarmony3.2.10.3 相对 OpenHarmony3.2 Beta4 版本,媒体子系统 camera 部件 API 变更如下
cl.subsystemname.1 camera 接口变更
- camera 部件在 API9 版本全量改为 SystemAPI
- 基于以下原因新增部分功能接口以及废弃部分接口:
提升开发者使用相机接口的便利。 帮助开发者快速掌握相机开发接口,快速投入到开发当中。 易于后续版本中框架功能的扩展,降低框架模块之间的耦合度。
具体参考下方变更内容,开发者需要根据以下说明对应用进行适配。
变更影响
影响 API9 版本的 JS 接口,应用需要进行适配才可以在新版本 SDK 环境正常实现功能。
关键的接口/组件变更
模块名 | 类名 | 方法/属性/枚举/常量 | 是否为 SystemApi | 变更类型 |
---|---|---|---|---|
ohos.multimedia.camera | camera | function getCameraManager(context: Context): CameraManager; | 是 | 新增 |
ohos.multimedia.camera | camera | function getCameraManager(context: Context, callback: AsyncCallback function getCameraManager(context: Context): Promise |
是 | 废弃 |
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 |
是 | 新增 |
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; |
是 | 新增 |
ohos.multimedia.camera | CameraManager | getSupportedCameras(callback: AsyncCallback getSupportedCameras(): Promise 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 |
是 | 废弃 |
ohos.multimedia.camera | CameraType | CAMERA_TYPE_DEFAULT = 0 | 是 | 新增 |
ohos.multimedia.camera | CameraType | CAMERA_TYPE_UNSPECIFIED = 0 | 是 | 废弃 |
ohos.multimedia.camera | CameraInput | on(type: ‘error’, camera: CameraDevice, callback: ErrorCallback |
是 | 新增 |
ohos.multimedia.camera | CameraInput | release(callback: AsyncCallback release(): Promise on(type: ‘error’, camera: CameraDevice, callback: ErrorCallback |
是 | 废弃 |
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 |
是 | 废弃 |
ohos.multimedia.camera | CameraInputError | code: CameraInputErrorCode | 是 | 废弃 |
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 |
是 | 新增 |
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 getExposureBiasRange(): Promise 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 getZoomRatioRange(): Promise 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 |
是 | 废弃 |
ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_UNKNOWN = -1 ERROR_INSUFFICIENT_RESOURCES = 0 ERROR_TIMEOUT = 1 |
是 | 废弃 |
ohos.multimedia.camera | CaptureSessionError | code: CaptureSessionErrorCode | 是 | 废弃 |
ohos.multimedia.camera | PreviewOutput | on(type: ‘error’, callback: ErrorCallback |
是 | 新增 |
ohos.multimedia.camera | PreviewOutput | on(type: ‘error’, callback: ErrorCallback |
是 | 废弃 |
ohos.multimedia.camera | PreviewOutputErrorCode | ERROR_UNKNOWN = -1 | 是 | 废弃 |
ohos.multimedia.camera | PreviewOutputError | code: PreviewOutputErrorCode | 是 | 废弃 |
ohos.multimedia.camera | PhotoOutput | capture(): Promise isMirrorSupported(): boolean; on(type: ‘error’, callback: ErrorCallback |
是 | 新增 |
ohos.multimedia.camera | PhotoOutput | isMirrorSupported(callback: AsyncCallback isMirrorSupported(): Promise on(type: ‘error’, callback: ErrorCallback |
是 | 废弃 |
ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_UNKNOWN = -1 ERROR_DRIVER_ERROR = 0 ERROR_INSUFFICIENT_RESOURCES = 1 ERROR_TIMEOUT = 2 |
是 | 废弃 |
ohos.multimedia.camera | PhotoOutputError | code: PhotoOutputErrorCode | 是 | 废弃 |
ohos.multimedia.camera | VideoOutput | on(type: ‘error’, callback: ErrorCallback |
是 | 新增 |
ohos.multimedia.camera | VideoOutput | on(type: ‘error’, callback: ErrorCallback |
是 | 废弃 |
ohos.multimedia.camera | VideoOutputErrorCode | ERROR_UNKNOWN = -1 ERROR_DRIVER_ERROR = 0 |
是 | 废弃 |
ohos.multimedia.camera | VideoOutputError | code: VideoOutputErrorCode | 是 | 废弃 |
ohos.multimedia.camera | MetadataObject | readonly type: MetadataObjectType; readonly timestamp: number; |
是 | 新增 |
ohos.multimedia.camera | MetadataObject | getType(callback: AsyncCallback getType(): Promise getTimestamp(callback: AsyncCallback getTimestamp(): Promise getBoundingBox(callback: AsyncCallback getBoundingBox(): Promise |
是 | 废弃 |
ohos.multimedia.camera | MetadataFaceObject | readonly boundingBox: Rect | 是 | 新增 |
ohos.multimedia.camera | MetadataOutput | on(type: ‘error’, callback: ErrorCallback |
是 | 新增 |
ohos.multimedia.camera | MetadataOutput | on(type: ‘error’, callback: ErrorCallback |
是 | 废弃 |
ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1 ERROR_INSUFFICIENT_RESOURCES = 0 |
是 | 废弃 |
ohos.multimedia.camera | MetadataOutputError | code: MetadataOutputErrorCode | 是 | 废弃 |
适配指导
除新增接口,和废弃接口之外,开发者需要关注变更的接口的适配:
从 Beta4 版本开始,对以下接口进行调整:
新增接口
- 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;
PhotoOutput 接口新增 capture(): Promise
; MetadataObject 接口中新增 readonly type: MetadataObjectType;
MetadataObject 接口中新增 readonly timestamp: number;
MetadataObject 接口中新增 readonly boundingBox: Rect;
废弃接口
CameraInput 中废弃接口 release(callback: AsyncCallback
): void; 以及 release(): Promise ; 废弃枚举 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);
废弃接口 CameraInputError 以及接口属性 code:CameraInputErrorCode;
废弃枚举 CaptureSessionErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_INSUFFICIENT_RESOURCES = 0,ERROR_TIMEOUT = 1);
废弃接口 CaptureSessionError 以及接口属性 code: CaptureSessionErrorCode;
废弃枚举 PreviewOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1);
废弃接口 PreviewOutputError 以及接口属性 code: PreviewOutputErrorCode;
废弃枚举 PhotoOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_DRIVER_ERROR = 0,ERROR_INSUFFICIENT_RESOURCES = 1,ERROR_TIMEOUT = 2);
废弃接口 PhotoOutputError 以及接口属性 code:PhotoOutputErrorCode;
废弃枚举 VideoOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_DRIVER_ERROR = 0);
废弃接口 VideoOutputError 以及接口属性 code:VideoOutputErrorCode;
废弃接口 MetadataObject 中 getType(callback: AsyncCallback
): void; 废弃接口 MetadataObject 中 getType(): Promise
; 废弃接口 MetadataObject 中 getTimestamp(callback: AsyncCallback
): void; 废弃接口 MetadataObject 中 getTimestamp(): Promise
; 废弃接口 MetadataObject 中 getBoundingBox(callback: AsyncCallback
): void; 废弃接口 MetadataObject 中 getBoundingBox(): Promise
; 废弃枚举 MetadataOutputErrorCode 以及所有它里边的枚举值(ERROR_UNKNOWN = -1,ERROR_INSUFFICIENT_RESOURCES = 0);
废弃接口 MetadataOutputError 以及接口属性 code:MetadataOutputErrorCode;
接口变更
- camera 模块中接口 getCameraManager 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getCameraManager(context: Context, callback: AsyncCallback
): void; 以及 getCameraManager(context: Context): Promise ; 变更为 getCameraManager(context: Context): CameraManager;
参考代码如下:
let cameraManager = camera.getCameraManager(context);
- CameraManager 中接口 getSupportedCameras 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getSupportedCameras(callback: AsyncCallback
>): void; 以及 getSupportedCameras(): Promise >; 变更为 getSupportedCameras(): Array ;
参考代码如下:
let cameras = cameraManager.getSupportedCameras();
- CameraManager 中接口 getSupportedOutputCapability 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback
): void; 以及 getSupportedOutputCapability(camera: CameraDevice): Promise ; 变更为 getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability;
参考代码如下:
let cameraDevice = cameras[0];
let CameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraDevice);
- CameraManager 中接口 createCameraInput(camera: CameraDevice) 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCameraInput(camera: CameraDevice, callback: AsyncCallback
): void; 以及 createCameraInput(camera: CameraDevice): Promise ; 变更为 createCameraInput(camera: CameraDevice): CameraInput;
参考代码如下:
let cameraDevice = cameras[0];
let cameraInput = cameraManager.createCameraInput(cameraDevice);
- CameraManager 中接口 createCameraInput(position: CameraPosition, type: CameraType) 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback
): void; 以及 createCameraInput(position: CameraPosition, type: CameraType): Promise ; 变更为 createCameraInput(position: CameraPosition, type: CameraType): CameraInput;
参考代码如下:
let cameraDevice = cameras[0];
let position = cameraDevice.cameraPosition;
let type = cameraDevice.cameraType;
let cameraInput = cameraManager.createCameraInput(position, type);
- CameraManager 中接口 createPreviewOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback
): void; 以及 createPreviewOutput(profile: Profile, surfaceId: string): Promise ; 变更为 createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput;
参考代码如下:
let profile = cameraoutputcapability.previewProfiles[0];
let previewOutput = cameraManager.createPreviewOutput(profile, surfaceId);
- CameraManager 中接口 createPhotoOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback
): void; 以及 createPhotoOutput(profile: Profile, surfaceId: string): Promise ; 变更为 createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput;
参考代码如下:
let profile = cameraoutputcapability.photoProfiles[0];
let photoOutput = cameraManager.createPhotoOutput(profile, surfaceId);
- CameraManager 中接口 createVideoOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback
): void; 以及 createVideoOutput(profile: VideoProfile, surfaceId: string): Promise ; 变更为 createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput;
参考代码如下:
let profile = cameraoutputcapability.videoProfiles[0];
let videoOutput = cameraManager.createVideoOutput(profile, surfaceId);
- CameraManager 中接口 createMetadataOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createMetadataOutput(metadataObjectTypes: Array
, callback: AsyncCallback ): void; 以及 createMetadataOutput(metadataObjectTypes: Array ): Promise ; 变更为 createMetadataOutput(metadataObjectTypes: Array ): MetadataOutput;
参考代码如下:
let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes;
let metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes);
- CameraManager 中接口 createCaptureSession 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 createCaptureSession(callback: AsyncCallback
): void; 以及 createCaptureSession(): Promise ; 变更为 createCaptureSession(): CaptureSession;
参考代码如下:
let captureSession = cameraManager.createCaptureSession();
枚举 CameraType 中,枚举值名称 CAMERA_TYPE_UNSPECIFIED 变更为 CAMERA_TYPE_DEFAULT。
CameraInput 中,on 接口返回值类型由 CameraInputError 变更为 BusinessError,因此旧接口 on(type: ‘error’, camera: CameraDevice, callback: ErrorCallback
): void; 变更为 on(type: ‘error’, camera: CameraDevice, callback: ErrorCallback ): void;
参考代码如下:
let cameraDevice = cameras[0];
cameraInput.on('error', cameraDevice, (BusinessError) => {
})
- CaptureSession 中接口 beginConfig 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 beginConfig(callback: AsyncCallback
): void; 以及 beginConfig(): Promise ; 变更为 beginConfig(): void;
参考代码如下:
captureSession.beginConfig();
- CaptureSession 中接口 addInput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 addInput(cameraInput: CameraInput, callback: AsyncCallback
): void; 以及 addInput(cameraInput: CameraInput): Promise ; 变更为 addInput(cameraInput: CameraInput): void;
参考代码如下:
captureSession.addInput(cameraInput);
- CaptureSession 中接口 removeInput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 removeInput(cameraInput: CameraInput, callback: AsyncCallback
): void; 以及 removeInput(cameraInput: CameraInput): Promise ; 变更为 removeInput(cameraInput: CameraInput): void;
参考代码如下:
captureSession.removeInput(cameraInput);
- CaptureSession 中接口 addOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 addOutput(cameraOutput: CameraOutput, callback: AsyncCallback
): void; 以及 addOutput(cameraOutput: CameraOutput): Promise ; 变更为 addOutput(cameraOutput: CameraOutput): void;
参考代码如下:
captureSession.addOutput(previewOutput);
- CaptureSession 中接口 removeOutput 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback
): void; 以及 removeOutput(cameraOutput: CameraOutput): Promise ; 变更为 removeOutput(cameraOutput: CameraOutput): void;
参考代码如下:
captureSession.removeOutput(previewOutput);
- CaptureSession 中接口 hasFlash 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 hasFlash(callback: AsyncCallback
): void; 以及 hasFlash(): Promise ; 变更为 hasFlash(): boolean;
参考代码如下:
let status = captureSession.hasFlash();
- CaptureSession 中接口 isFlashModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback
): void; 以及 isFlashModeSupported(flashMode: FlashMode): Promise ; 变更为 isFlashModeSupported(flashMode: FlashMode): boolean;
参考代码如下:
let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO);
- CaptureSession 中接口 getFlashMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFlashMode(callback: AsyncCallback
): void; 以及 getFlashMode(): Promise ; 变更为 getFlashMode(): FlashMode;
参考代码如下:
let flashMode = captureSession.getFlashMode();
- CaptureSession 中接口 isExposureModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback
): void; 以及 isExposureModeSupported(aeMode: ExposureMode): Promise ; 变更为 isExposureModeSupported(aeMode: ExposureMode): boolean;
参考代码如下:
let isSupported = captureSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
- CaptureSession 中接口 getExposureMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureMode(callback: AsyncCallback
): void; 以及 getExposureMode(): Promise ; 变更为 getExposureMode(): ExposureMode;
参考代码如下:
let exposureMode = captureSession.getExposureMode();
- CaptureSession 中接口 setExposureMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setExposureMode(aeMode: ExposureMode, callback: AsyncCallback
): void; 以及 setExposureMode(aeMode: ExposureMode): Promise ; 变更为 setExposureMode(aeMode: ExposureMode): void;
参考代码如下:
captureSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
- CaptureSession 中接口 getMeteringPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getMeteringPoint(callback: AsyncCallback
): void; 以及 getMeteringPoint(): Promise ; 变更为 getMeteringPoint(): Point;
参考代码如下:
let exposurePoint = captureSession.getMeteringPoint();
- CaptureSession 中接口 setMeteringPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setMeteringPoint(point: Point, callback: AsyncCallback
): void; 以及 setMeteringPoint(point: Point): Promise ; 变更为 setMeteringPoint(point: Point): void;
参考代码如下:
let Point2 = {x: 2, y: 2};
captureSession.setMeteringPoint(Point2);
- CaptureSession 中接口 getExposureBiasRange 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureBiasRange(callback: AsyncCallback
>): void; 以及 getExposureBiasRange(): Promise >; 变更为 getExposureBiasRange(): Array ;
参考代码如下:
let biasRangeArray = captureSession.getExposureBiasRange();
- CaptureSession 中接口 setExposureBias 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setExposureBias(exposureBias: number, callback: AsyncCallback
): void; 以及 setExposureBias(exposureBias: number): Promise ; 变更为 setExposureBias(exposureBias: number): void;
参考代码如下:
let exposureBias = biasRangeArray[0];
captureSession.setExposureBias(exposureBias);
- CaptureSession 中接口 getExposureValue 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getExposureValue(callback: AsyncCallback
): void; 以及 getExposureValue(): Promise ; 变更为 getExposureValue(): number;
参考代码如下:
let exposureValue = captureSession.getExposureValue();
- CaptureSession 中接口 isFocusModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback
): void; 以及 isFocusModeSupported(afMode: FocusMode): Promise ; 变更为 isFocusModeSupported(afMode: FocusMode): boolean;
参考代码如下:
let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO);
- CaptureSession 中接口 getFocusMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocusMode(callback: AsyncCallback
): void; 以及 getFocusMode(): Promise ; 变更为 getFocusMode(): FocusMode;
参考代码如下:
let afMode = captureSession.getFocusMode();
- CaptureSession 中接口 setFocusMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setFocusMode(afMode: FocusMode, callback: AsyncCallback
): void; 以及 setFocusMode(afMode: FocusMode): Promise ; 变更为 setFocusMode(afMode: FocusMode): void;
参考代码如下:
captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO);
- CaptureSession 中接口 setFocusPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setFocusPoint(point: Point, callback: AsyncCallback
): void; 以及 setFocusPoint(point: Point): Promise ; 变更为 setFocusPoint(point: Point): void;
参考代码如下:
let Point2 = {x: 2, y: 2};
captureSession.setFocusPoint(Point2);
- CaptureSession 中接口 getFocusPoint 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocusPoint(callback: AsyncCallback
): void; 以及 getFocusPoint(): Promise ; 变更为 getFocusPoint(): Point;
参考代码如下:
let point = captureSession.getFocusPoint();
- CaptureSession 中接口 getFocalLength 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getFocalLength(callback: AsyncCallback
): void; 以及 getFocalLength(): Promise ; 变更为 getFocalLength(): number;
参考代码如下:
let focalLength = captureSession.getFocalLength();
- CaptureSession 中接口 getZoomRatioRange 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getZoomRatioRange(callback: AsyncCallback
>): void; 以及 getZoomRatioRange(): Promise >; 变更为 getZoomRatioRange(): Array ;
参考代码如下:
let zoomRatioRange = captureSession.getZoomRatioRange();
- CaptureSession 中接口 getZoomRatio 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getZoomRatio(callback: AsyncCallback
): void; 以及 getZoomRatio(): Promise ; 变更为 getZoomRatio(): number;
参考代码如下:
let zoomRatio = captureSession.getZoomRatio();
- CaptureSession 中接口 setZoomRatio 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setZoomRatio(zoomRatio: number, callback: AsyncCallback
): void; 以及 setZoomRatio(zoomRatio: number): Promise ; 变更为 setZoomRatio(zoomRatio: number): void;
参考代码如下:
let zoomRatio = zoomRatioRange[0];
captureSession.setZoomRatio(zoomRatio);
- CaptureSession 中接口 isVideoStabilizationModeSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback
): void; 以及 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise ; 变更为 isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean;
参考代码如下:
let isSupported = captureSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF);
- CaptureSession 中接口 getActiveVideoStabilizationMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 getActiveVideoStabilizationMode(callback: AsyncCallback
): void; 以及 getActiveVideoStabilizationMode(): Promise ; 变更为 getActiveVideoStabilizationMode(): VideoStabilizationMode;
参考代码如下:
let vsMode = captureSession.getActiveVideoStabilizationMode();
- CaptureSession 中接口 setVideoStabilizationMode 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback
): void; 以及 setVideoStabilizationMode(mode: VideoStabilizationMode): Promise ; 变更为 setVideoStabilizationMode(mode: VideoStabilizationMode): void;
参考代码如下:
captureSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF);
- CaptureSession 中,on(type: ‘error’) callback 类型由 ErrorCallback
变更为 ErrorCallback ,因此旧接口 on(type: ‘error’, callback: ErrorCallback ): void; 变更为 on(type: ‘error’, callback: ErrorCallback ): void;
参考代码如下:
captureSession.on('error', (BusinessError) => {
})
- PreviewOutput 中,on(type: ‘error’) callback 类型由 ErrorCallback
变更为 ErrorCallback ,因此旧接口 on(type: ‘error’, callback: ErrorCallback ): void; 变更为 on(type: ‘error’, callback: ErrorCallback ): void;
参考代码如下:
previewOutput.on('error', (BusinessError) => {
})
- PhotoOutput 中接口 isMirrorSupported 返回方式由异步 callback 跟异步 promise 变更为同步返回,因此旧接口 isMirrorSupported(callback: AsyncCallback
): void; 以及 isMirrorSupported(): Promise ; 变更为 isMirrorSupported(): boolean;
参考代码如下:
let isSupported = photoOutput.isMirrorSupported();
- PhotoOutput 中,on(type: ‘error’) callback 类型由 ErrorCallback
变更为 ErrorCallback ,因此旧接口 on(type: ‘error’, callback: ErrorCallback ): void; 变更为 on(type: ‘error’, callback: ErrorCallback ): void;
参考代码如下:
PhotoOutput.on('error', (BusinessError) => {
})
- VideoOutput 中,on(type: ‘error’) callback 类型由 ErrorCallback
变更为 ErrorCallback ,因此旧接口 on(type: ‘error’, callback: ErrorCallback ): void; 变更为 on(type: ‘error’, callback: ErrorCallback ): void;
参考代码如下:
VideoOutput.on('error', (BusinessError) => {
})
- MetadataOutput 中,on(type: ‘error’) callback 类型由 ErrorCallback
变更为 ErrorCallback ,因此旧接口 on(type: ‘error’, callback: ErrorCallback ): void; 变更为 on(type: ‘error’, callback: ErrorCallback ): void;
参考代码如下:
MetadataOutput.on('error', (BusinessError) => {
})
你可能感兴趣的鸿蒙文章
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦