changelogs-camera.md 48.8 KB
Newer Older
M
mali 已提交
1 2 3
# 媒体子系统JS API变更Changelog

## camera接口变更
4 5 6 7
基于以下原因新增部分功能接口以及废弃部分接口:
1. 提升开发者使用相机接口的便利。
2. 帮助开发者快速掌握相机开发接口,快速投入到开发当中。
3. 易于后续版本中框架功能的扩展,降低框架模块之间的耦合度。
8

9
具体参考下方变更内容,开发者需要根据以下说明对应用进行适配。
M
mali 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157

 **变更影响**

影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。

**关键的接口/组件变更**

| 模块名                 | 类名                    | 方法/属性/枚举/常量                                          | 变更类型 |
| ---------------------- | ----------------------- | ------------------------------------------------------------ | -------- |
| ohos.multimedia.camera | Profile                 | readonly format:CameraFormat;                                | 新增     |
| ohos.multimedia.camera | Profile                 | readonly size: Size;                                         | 新增     |
| ohos.multimedia.camera | FrameRateRange          | readonly min: number;                                        | 新增     |
| ohos.multimedia.camera | FrameRateRange          | readonly max: number;                                        | 新增     |
| ohos.multimedia.camera | VideoProfile            | readonly frameRateRange: FrameRateRange;                     | 新增     |
| ohos.multimedia.camera | CameraOutputCapability  | readonly previewProfiles: Array<Profile>;                    | 新增     |
| ohos.multimedia.camera | CameraOutputCapability  | readonly photoProfiles: Array<Profile>;                      | 新增     |
| ohos.multimedia.camera | CameraOutputCapability  | readonly videoProfiles: Array<VideoProfile>;                 | 新增     |
| ohos.multimedia.camera | CameraOutputCapability  | readonly supportedMetadataObjectTypes: Array<MetadataObjectType>; | 新增     |
| ohos.multimedia.camera | CameraManager           | getSupportedCameras(callback: AsyncCallback<Array<CameraDevice>>): void;<br/>getSupportedCameras(): Promise<Array<CameraDevice>>; | 新增     |
| ohos.multimedia.camera | CameraManager           | getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback<CameraOutputCapability>): void;<br/>getSupportedOutputCapability(camera: CameraDevice): Promise<CameraOutputCapability>; | 新增     |
| ohos.multimedia.camera | CameraManager           | isCameraMuted(): boolean;                                    | 新增     |
| ohos.multimedia.camera | CameraManager           | isCameraMuteSupported(): boolean;                            | 新增     |
| ohos.multimedia.camera | CameraManager           | muteCamera(mute: boolean): void;                             | 新增     |
| ohos.multimedia.camera | CameraManager           | createCameraInput(camera: CameraDevice, callback: AsyncCallback<CameraInput>): void;<br/>createCameraInput(camera: CameraDevice): Promise<CameraInput>; | 新增     |
| ohos.multimedia.camera | CameraManager           | createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PreviewOutput>): void;<br/>createPreviewOutput(profile: Profile, surfaceId: string): Promise<PreviewOutput>; | 新增     |
| ohos.multimedia.camera | CameraManager           | createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PhotoOutput>): void;<br/>createPhotoOutput(profile: Profile, surfaceId: string): Promise<PhotoOutput>; | 新增     |
| ohos.multimedia.camera | CameraManager           | createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback<VideoOutput>): void;<br/>createVideoOutput(profile: VideoProfile, surfaceId: string): Promise<VideoOutput>; | 新增     |
| ohos.multimedia.camera | CameraManager           | createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>, callback: AsyncCallback<MetadataOutput>): void;<br/>createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): Promise<MetadataOutput>; | 新增     |
| ohos.multimedia.camera | CameraManager           | createCaptureSession(callback: AsyncCallback<CaptureSession>): void;<br/>createCaptureSession(): Promise<CaptureSession>; | 新增     |
| ohos.multimedia.camera | CameraManager           | on(type: 'cameraMute', callback: AsyncCallback<boolean>): void; | 新增     |
| ohos.multimedia.camera | CameraManager           | getCameras(callback: AsyncCallback<Array<Camera>>): void;<br/>getCameras(): Promise<Array<Camera>>; | 废弃     |
| ohos.multimedia.camera | CameraManager           | createCameraInput(cameraId: string, callback: AsyncCallback<CameraInput>): void;<br/>createCameraInput(cameraId: string): Promise<CameraInput>; | 废弃     |
| ohos.multimedia.camera | CameraManager           | createCaptureSession(context: Context, callback: AsyncCallback<CaptureSession>): void;<br/>createCaptureSession(context: Context): Promise<CaptureSession>; | 废弃     |
| ohos.multimedia.camera | CameraManager           | createPreviewOutput(surfaceId: string, callback: AsyncCallback<PreviewOutput>): void;<br/>createPreviewOutput(surfaceId: string): Promise<PreviewOutput>; | 废弃     |
| ohos.multimedia.camera | CameraManager           | CreatePhotoOutput(surfaceId: string, callback: AsyncCallback<PhotoOutput>): void;<br/>CreatePhotoOutput(surfaceId: string): Promise<PhotoOutput>; | 废弃     |
| ohos.multimedia.camera | CameraManager           | createVideoOutput(surfaceId: string, callback: AsyncCallback<VideoOutput>): void;<br/>createVideoOutput(surfaceId: string): Promise<VideoOutput>; | 废弃     |
| ohos.multimedia.camera | CameraManager           | createMetadataOutput(callback: AsyncCallback<MetadataOutput>): void;<br/>createVideoOutput(): Promise<MetadataOutput>; | 废弃     |
| ohos.multimedia.camera | CameraStatusInfo        | camera: CameraDevice;                                        | 新增     |
| ohos.multimedia.camera | CameraStatusInfo        | camera: Camera;                                              | 废弃     |
| ohos.multimedia.camera | CameraDevice            | interface CameraDevice                                       | 新增     |
| ohos.multimedia.camera | Camera                  | interface Camera                                             | 废弃     |
| ohos.multimedia.camera | CameraInput             | open(callback: AsyncCallback<void>): void;<br/>open(): Promise<void>; | 新增     |
| ohos.multimedia.camera | CameraInput             | close(callback: AsyncCallback<void>): void;<br/>close(): Promise<void>; | 新增     |
| ohos.multimedia.camera | CameraInput             | on(type: 'error', camera: CameraDevice, callback: ErrorCallback<CameraInputError>): void; | 新增     |
| ohos.multimedia.camera | CameraInput             | isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<boolean>): void;<br/>isFocusModeSupported(afMode: FocusMode): Promise<boolean>; | 废弃     |
| ohos.multimedia.camera | CameraInput             | getFocusMode(callback: AsyncCallback<FocusMode>): void;<br/>getFocusMode(): Promise<FocusMode>; | 废弃     |
| ohos.multimedia.camera | CameraInput             | setFocusMode(afMode: FocusMode, callback: AsyncCallback<void>): void;<br/>setFocusMode(afMode: FocusMode): Promise<void>; | 废弃     |
| ohos.multimedia.camera | CameraInput             | getZoomRatioRange(callback: AsyncCallback<Array<number>>): void;<br/>getZoomRatioRange(): Promise<Array<number>>; | 废弃     |
| ohos.multimedia.camera | CameraInput             | getZoomRatio(callback: AsyncCallback<number>): void;<br/>getZoomRatio(): Promise<number>; | 废弃     |
| ohos.multimedia.camera | CameraInput             | setZoomRatio(zoomRatio: number, callback: AsyncCallback<void>): void;<br/>setZoomRatio(zoomRatio: number): Promise<void>; | 废弃     |
| ohos.multimedia.camera | CameraInput             | getCameraId(callback: AsyncCallback<string>): void;<br/>getCameraId(): Promise<string>; | 废弃     |
| ohos.multimedia.camera | CameraInput             | getExposurePoint(callback: AsyncCallback<Point>): void;<br/>getExposurePoint(): Promise<Point>; | 废弃     |
| ohos.multimedia.camera | CameraInput             | setExposurePoint(exposurePoint: Point, callback: AsyncCallback<void>): void;<br/>setExposurePoint(exposurePoint: Point): Promise<void>; | 废弃     |
| ohos.multimedia.camera | CameraInput          | hasFlash(callback: AsyncCallback<boolean>): void;<br/>hasFlash(): Promise<boolean>;                                                                         | 废弃     |
| ohos.multimedia.camera | CameraInput          | isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback<boolean>): void;<br/>isFlashModeSupported(flashMode: FlashMode): Promise<boolean>;       | 废弃     |
| ohos.multimedia.camera | CameraInput          | getFlashMode(callback: AsyncCallback<FlashMode>): void;<br/>getFlashMode(): Promise<FlashMode>;                                                             | 废弃     |
| ohos.multimedia.camera | CameraInput          | setFlashMode(flashMode: FlashMode, callback: AsyncCallback<void>): void;<br/>setFlashMode(flashMode: FlashMode): Promise<void>;                             | 废弃     |
| ohos.multimedia.camera | CameraInput          | isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback<boolean>): void;<br/>isExposureModeSupported(aeMode: ExposureMode): Promise<boolean>; | 废弃     |
| ohos.multimedia.camera | CameraInput          | getExposureMode(callback: AsyncCallback<ExposureMode>): void;<br/>getExposureMode(): Promise<ExposureMode>;                                                 | 废弃     |
| ohos.multimedia.camera | CameraInput          | setExposureMode(aeMode: ExposureMode, callback: AsyncCallback<void>): void;<br/>setExposureMode(aeMode: ExposureMode): Promise<void>;                       | 废弃     |
| ohos.multimedia.camera | CameraInput          | getMeteringPoint(callback: AsyncCallback<Point>): void;<br/>getMeteringPoint(): Promise<Point>;                                                             | 废弃     |
| ohos.multimedia.camera | CameraInput          | setMeteringPoint(point: Point, callback: AsyncCallback<void>): void;<br/>setMeteringPoint(point: Point): Promise<void>;                                     | 废弃     |
| ohos.multimedia.camera | CameraInput          | getExposureBiasRange(callback: AsyncCallback<Array<number>>): void;<br/>getExposureBiasRange(): Promise<Array<number>>;                                     | 废弃     |
| ohos.multimedia.camera | CameraInput          | setExposureBias(exposureBias: number, callback: AsyncCallback<void>): void;<br/>setExposureBias(exposureBias: number): Promise<void>;                       | 废弃     |
| ohos.multimedia.camera | CameraInput          | getExposureValue(callback: AsyncCallback<number>): void;<br/>getExposureValue(): Promise<number>;                                                           | 废弃     |
| ohos.multimedia.camera | CameraInput          | isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<boolean>): void;<br/>isFocusModeSupported(afMode: FocusMode): Promise<boolean>;             | 废弃     |
| ohos.multimedia.camera | CameraInput          | getFocusMode(callback: AsyncCallback<FocusMode>): void;<br/>getFocusMode(): Promise<FocusMode>;                                                             | 废弃     |
| ohos.multimedia.camera | CameraInput          | setFocusMode(afMode: FocusMode, callback: AsyncCallback<void>): void;<br/>setFocusMode(afMode: FocusMode): Promise<void>;                                   | 废弃     |
| ohos.multimedia.camera | CameraInput          | setFocusPoint(point: Point, callback: AsyncCallback<void>): void;<br/>setFocusPoint(point: Point): Promise<void>;                                           | 废弃     |
| ohos.multimedia.camera | CameraInput          | getFocusPoint(callback: AsyncCallback<Point>): void;<br/>getFocusPoint(): Promise<Point>;                                                                   | 废弃     |
| ohos.multimedia.camera | CameraInput          | getFocalLength(callback: AsyncCallback<number>): void;<br/>getFocalLength(): Promise<number>;                                                               | 废弃     |
| ohos.multimedia.camera | CameraInput          | getZoomRatioRange(callback: AsyncCallback<Array<number>>): void;<br/>getZoomRatioRange(): Promise<Array<number>>;                                           | 废弃     |
| ohos.multimedia.camera | CameraInput          | getZoomRatio(callback: AsyncCallback<number>): void;<br/>getZoomRatio(): Promise<number>;                                                                   | 废弃     |
| ohos.multimedia.camera | CameraInput          | setZoomRatio(zoomRatio: number, callback: AsyncCallback<void>): void;<br/>setZoomRatio(zoomRatio: number): Promise<void>;                                   | 废弃     |
| ohos.multimedia.camera | CameraInput             | on(type: 'focusStateChange', callback: AsyncCallback<FocusState>): void; | 废弃     |
| ohos.multimedia.camera | CameraInput             | on(type: 'exposureStateChange', callback: AsyncCallback<ExposureState>): void; | 废弃     |
| ohos.multimedia.camera | CameraInput             | on(type: 'error', callback: ErrorCallback<CameraInputError>): void; | 废弃     |
| ohos.multimedia.camera | CameraInputErrorCode    | ERROR_NO_PERMISSION = 0                                      | 新增     |
| ohos.multimedia.camera | CameraInputErrorCode    | ERROR_DEVICE_PREEMPTED = 1                                   | 新增     |
| ohos.multimedia.camera | CameraInputErrorCode    | ERROR_DEVICE_DISCONNECTED = 2                                | 新增     |
| ohos.multimedia.camera | CameraInputErrorCode    | ERROR_DEVICE_IN_USE = 3                                      | 新增     |
| ohos.multimedia.camera | CameraInputErrorCode    | ERROR_DRIVER_ERROR = 4                                       | 新增     |
| ohos.multimedia.camera | CameraFormat            | CAMERA_FORMAT_RGBA_8888 = 3                                  | 新增     |
| ohos.multimedia.camera | ExposureMode            | EXPOSURE_MODE_AUTO = 1                                       | 新增     |
| ohos.multimedia.camera | ExposureMode            | EXPOSURE_MODE_CONTINUOUS_AUTO = 2                            | 新增     |
| ohos.multimedia.camera | ExposureMode            | EXPOSURE_MODE_AUTO                                      | 废弃     |
| ohos.multimedia.camera | ExposureMode            | EXPOSURE_MODE_CONTINUOUS_AUTO                          | 废弃     |
| ohos.multimedia.camera | VideoStabilizationMode  | LOW = 1                                                      | 新增     |
| ohos.multimedia.camera | VideoStabilizationMode  | MIDDLE = 2                                                   | 新增     |
| ohos.multimedia.camera | VideoStabilizationMode  | HIGH = 3                                                     | 新增     |
| ohos.multimedia.camera | VideoStabilizationMode  | AUTO = 4                                                     | 新增     |
| ohos.multimedia.camera | VideoStabilizationMode  | LOW                                                    | 废弃     |
| ohos.multimedia.camera | VideoStabilizationMode  | MIDDLE                                                 | 废弃     |
| ohos.multimedia.camera | VideoStabilizationMode  | HIGH                                                     | 废弃     |
| ohos.multimedia.camera | VideoStabilizationMode  | AUTO                                                     | 废弃     |
| ohos.multimedia.camera | CaptureSession          | addOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void;<br/>addOutput(cameraOutput: CameraOutput): Promise<void>; | 新增     |
| ohos.multimedia.camera | CaptureSession          | removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(cameraOutput: CameraOutput): Promise<void>; | 新增     |
| ohos.multimedia.camera | CaptureSession          | isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback<boolean>): void;<br/>isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise<boolean>; | 新增     |
| ohos.multimedia.camera | CaptureSession          | getActiveVideoStabilizationMode(callback: AsyncCallback<VideoStabilizationMode>): void;<br/>getActiveVideoStabilizationMode(): Promise<VideoStabilizationMode>; | 新增     |
| ohos.multimedia.camera | CaptureSession          | setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback<void>): void;<br/>setVideoStabilizationMode(mode: VideoStabilizationMode): Promise<void>; | 新增     |
| ohos.multimedia.camera | CaptureSession          | on(type: 'focusStateChange', callback: AsyncCallback<FocusState>): void; | 新增     |
| ohos.multimedia.camera | CaptureSession          | hasFlash(callback: AsyncCallback<boolean>): void;<br/>hasFlash(): Promise<boolean>;                                                                         | 新增     |
| ohos.multimedia.camera | CaptureSession          | isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback<boolean>): void;<br/>isFlashModeSupported(flashMode: FlashMode): Promise<boolean>;       | 新增     |
| ohos.multimedia.camera | CaptureSession          | getFlashMode(callback: AsyncCallback<FlashMode>): void;<br/>getFlashMode(): Promise<FlashMode>;                                                             | 新增     |
| ohos.multimedia.camera | CaptureSession          | setFlashMode(flashMode: FlashMode, callback: AsyncCallback<void>): void;<br/>setFlashMode(flashMode: FlashMode): Promise<void>;                             | 新增     |
| ohos.multimedia.camera | CaptureSession          | isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback<boolean>): void;<br/>isExposureModeSupported(aeMode: ExposureMode): Promise<boolean>; | 新增     |
| ohos.multimedia.camera | CaptureSession          | getExposureMode(callback: AsyncCallback<ExposureMode>): void;<br/>getExposureMode(): Promise<ExposureMode>;                                                 | 新增     |
| ohos.multimedia.camera | CaptureSession          | setExposureMode(aeMode: ExposureMode, callback: AsyncCallback<void>): void;<br/>setExposureMode(aeMode: ExposureMode): Promise<void>;                       | 新增     |
| ohos.multimedia.camera | CaptureSession          | getMeteringPoint(callback: AsyncCallback<Point>): void;<br/>getMeteringPoint(): Promise<Point>;                                                             | 新增     |
| ohos.multimedia.camera | CaptureSession          | setMeteringPoint(point: Point, callback: AsyncCallback<void>): void;<br/>setMeteringPoint(point: Point): Promise<void>;                                     | 新增     |
| ohos.multimedia.camera | CaptureSession          | getExposureBiasRange(callback: AsyncCallback<Array<number>>): void;<br/>getExposureBiasRange(): Promise<Array<number>>;                                     | 新增     |
| ohos.multimedia.camera | CaptureSession          | setExposureBias(exposureBias: number, callback: AsyncCallback<void>): void;<br/>setExposureBias(exposureBias: number): Promise<void>;                       | 新增     |
| ohos.multimedia.camera | CaptureSession          | getExposureValue(callback: AsyncCallback<number>): void;<br/>getExposureValue(): Promise<number>;                                                           | 新增     |
| ohos.multimedia.camera | CaptureSession          | isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<boolean>): void;<br/>isFocusModeSupported(afMode: FocusMode): Promise<boolean>;             | 新增     |
| ohos.multimedia.camera | CaptureSession          | getFocusMode(callback: AsyncCallback<FocusMode>): void;<br/>getFocusMode(): Promise<FocusMode>;                                                             | 新增     |
| ohos.multimedia.camera | CaptureSession          | setFocusMode(afMode: FocusMode, callback: AsyncCallback<void>): void;<br/>setFocusMode(afMode: FocusMode): Promise<void>;                                   | 新增     |
| ohos.multimedia.camera | CaptureSession          | setFocusPoint(point: Point, callback: AsyncCallback<void>): void;<br/>setFocusPoint(point: Point): Promise<void>;                                           | 新增     |
| ohos.multimedia.camera | CaptureSession          | getFocusPoint(callback: AsyncCallback<Point>): void;<br/>getFocusPoint(): Promise<Point>;                                                                   | 新增     |
| ohos.multimedia.camera | CaptureSession          | getFocalLength(callback: AsyncCallback<number>): void;<br/>getFocalLength(): Promise<number>;                                                               | 新增     |
| ohos.multimedia.camera | CaptureSession          | getZoomRatioRange(callback: AsyncCallback<Array<number>>): void;<br/>getZoomRatioRange(): Promise<Array<number>>;                                           | 新增     |
| ohos.multimedia.camera | CaptureSession          | getZoomRatio(callback: AsyncCallback<number>): void;<br/>getZoomRatio(): Promise<number>;                                                                   | 新增     |
| ohos.multimedia.camera | CaptureSession          | setZoomRatio(zoomRatio: number, callback: AsyncCallback<void>): void;<br/>setZoomRatio(zoomRatio: number): Promise<void>;                                   | 新增     |
| ohos.multimedia.camera | CaptureSession          | addOutput(previewOutput: PreviewOutput, callback: AsyncCallback<void>): void;<br/>addOutput(previewOutput: PreviewOutput): Promise<void>;<br/>addOutput(photoOutput: PhotoOutput, callback: AsyncCallback<void>): void;<br/>addOutput(photoOutput: PhotoOutput): Promise<void>;<br/>addOutput(videoOutput: VideoOutput, callback: AsyncCallback<void>): void;<br/>addOutput(videoOutput: VideoOutput): Promise<void>; | 废弃     |
| ohos.multimedia.camera | CaptureSession          | removeOutput(previewOutput: PreviewOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(previewOutput: PreviewOutput): Promise<void>;<br/>removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(photoOutput: PhotoOutput): Promise<void>;removeOutput(videoOutput: VideoOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(videoOutput: VideoOutput): Promise<void>;<br/>removeOutput(metadataOutput: MetadataOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(metadataOutput: MetadataOutput): Promise<void>; | 废弃     |
| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_INSUFFICIENT_RESOURCES = 0                             | 新增     |
| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_TIMEOUT = 1                                            | 新增     |
| ohos.multimedia.camera | CameraOutput            | release(callback: AsyncCallback<void>): void;<br/>release(): Promise<void>; | 新增     |
| ohos.multimedia.camera | PreviewOutput           | start(callback: AsyncCallback<void>): void;<br/>start(): Promise<void>; | 新增     |
| ohos.multimedia.camera | PreviewOutput           | stop(callback: AsyncCallback<void>): void;<br/>stop(): Promise<void>; | 新增     |
| ohos.multimedia.camera | PreviewOutput           | release(callback: AsyncCallback<void>): void;<br/>release(): Promise<void>; | 废弃     |
| ohos.multimedia.camera | PhotoOutput             | release(callback: AsyncCallback<void>): void;<br/>release(): Promise<void>; | 废弃     |
| ohos.multimedia.camera | VideoOutput             | release(callback: AsyncCallback<void>): void;<br/>release(): Promise<void>; | 废弃     |
| ohos.multimedia.camera | PhotoCaptureSetting     | mirror?: boolean;                                            | 新增     |
| ohos.multimedia.camera | PhotoOutputErrorCode    | ERROR_DRIVER_ERROR = 0                                       | 新增     |
| ohos.multimedia.camera | PhotoOutputErrorCode    | ERROR_INSUFFICIENT_RESOURCES = 1                             | 新增     |
| ohos.multimedia.camera | PhotoOutputErrorCode    | ERROR_TIMEOUT = 2                                            | 新增     |
| ohos.multimedia.camera | VideoOutputErrorCode    | ERROR_DRIVER_ERROR = 0                                       | 新增     |
| ohos.multimedia.camera | MetadataObjectType      | FACE_DETECTION = 0                                           | 新增     |
| ohos.multimedia.camera | MetadataObjectType      | FACE = 0                                                 | 废弃     |
| ohos.multimedia.camera | MetadataOutput          | on(type: 'error', callback: ErrorCallback<MetadataOutputError>): void; | 新增     |
| ohos.multimedia.camera | MetadataOutput      | setCapturingMetadataObjectTypes(metadataObjectTypes: Array<MetadataObjectType>, callback: AsyncCallback<void>): void;<br/>setCapturingMetadataObjectTypes(metadataObjectTypes: Array<MetadataObjectType>): Promise<void>;    | 废弃     |
| ohos.multimedia.camera | MetadataOutput      | getSupportedMetadataObjectTypes(callback: AsyncCallback<Array<MetadataObjectType>>): void;<br/>getSupportedMetadataObjectTypes(): Promise<Array<MetadataObjectType>>;    | 废弃     |
| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1                                           | 新增     |
| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_INSUFFICIENT_RESOURCES = 0                             | 新增     |
| ohos.multimedia.camera | MetadataOutputError     | code: MetadataOutputErrorCode;                              | 新增     |

**适配指导**

158 159
除新增接口,和废弃接口之外,开发者需要关注变更的接口的适配:

M
mali 已提交
160 161
从Beta4版本开始,对以下接口进行调整:

162
**新增接口**
M
mali 已提交
163

164
1. Profile接口
M
mali 已提交
165

166
   属性1:readonly format,类型:CameraFormat;
M
mali 已提交
167

168
   属性2:readonly size,类型:Size;
M
mali 已提交
169

170
2. FrameRateRange接口
M
mali 已提交
171

172
   属性1:readonly min,类型:number;
M
mali 已提交
173

174
   属性2:readonly max,类型:number;
M
mali 已提交
175

176
3. VideoProfile接口,继承自Profile
M
mali 已提交
177

178
   属性:readonly frameRateRange,类型:FrameRateRange;
M
mali 已提交
179

180
4. CameraOutputCapability接口
M
mali 已提交
181

182
   属性1:readonly previewProfiles,类型:Array<Profile>;
M
mali 已提交
183

184
   属性2:readonly photoProfiles,类型:Array<Profile>;
M
mali 已提交
185

186
   属性3:readonly videoProfiles,类型:Array<VideoProfile>;
M
mali 已提交
187

188
   属性4:readonly supportedMetadataObjectTypes,类型:Array<MetadataObjectType>;
M
mali 已提交
189

190
5. CameraManager中新增
M
mali 已提交
191

192
   getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback<CameraOutputCapability>): void;
M
mali 已提交
193

194
   getSupportedOutputCapability(camera: CameraDevice): Promise<CameraOutputCapability>;
M
mali 已提交
195 196 197 198

   参考代码如下:

   ```
199 200 201 202 203 204 205 206 207
   cameraManager.getSupportedCameras().then((cameras) => {
       let cameraDevice = cameras[0];
       cameraManager.getSupportedOutputCapability(cameraDevice, (err, CameraOutputCapability) => {
           if (err) {
               console.error(`Failed to get the outputCapability. ${err.message}`);
               return;
           }
           console.log('Callback returned with an array of supported outputCapability');
       })
M
mali 已提交
208 209 210 211
   })
   ```

   ```
212 213 214 215 216
   cameraManager.getSupportedCameras().then((cameras) => {
       let cameraDevice = cameras[0];
       cameraManager.getSupportedOutputCapability(cameraDevice).then((cameraoutputcapability) => {
           console.log('Promise returned with an array of supported outputCapability');
       })
M
mali 已提交
217 218 219
   })
   ```

220
6. CameraManager中新增isCameraMuted(): boolean; 
M
mali 已提交
221 222 223 224

   参考代码如下:

   ```
225
   let ismuted = cameraManager.isCameraMuted();
M
mali 已提交
226 227
   ```

228
7. CameraManager中新增isCameraMuteSupported(): boolean; 
M
mali 已提交
229 230 231 232

   参考代码如下:

   ```
233 234 235 236 237 238
   let ismutesuppotred = cameraManager.isCameraMuteSupported();
   ```

8. CameraManager中新增muteCamera(mute: boolean): void;

   参考代码如下:
M
mali 已提交
239 240

   ```
241 242
   let mute = true;
   cameraManager.muteCamera(mute);
M
mali 已提交
243 244
   ```

245
9. CameraManager中新增on(type: 'cameraMute', callback: AsyncCallback<boolean>): void;
M
mali 已提交
246 247 248 249

   参考代码如下:

   ```
250 251 252 253 254
   cameraManager.on('cameraMute', (err, curMuetd) => {
       if (err) {
           console.error(`Failed to get cameraMute callback. ${err.message}`);
           return;
       }
M
mali 已提交
255 256 257
   })
   ```

258
10. CameraInput中新增open(callback: AsyncCallback<void>): void;以及open(): Promise<void>;
M
mali 已提交
259

260
参考代码如下:
M
mali 已提交
261

262 263 264 265 266 267 268 269 270
```
cameraInput.open((err) => {
    if (err) {
        console.error(`Failed to open the camera. ${err.message}`);
        return;
    }
    console.log('Callback returned with camera opened.');
})
```
M
mali 已提交
271

272 273 274 275 276
```
cameraInput.open().then(() => {
    console.log('Promise returned with camera opened.');
})
```
M
mali 已提交
277

278
11. CameraInput中新增close(callback: AsyncCallback<void>): void;以及close(): Promise<void>;
M
mali 已提交
279

280
    参考代码如下:
M
mali 已提交
281

282 283 284 285 286 287 288 289 290
    ```
    cameraInput.close((err) => {
        if (err) {
            console.error(`Failed to close the cameras. ${err.message}`);
            return;
        }
        console.log('Callback returned with camera closed.');
    })
    ```
M
mali 已提交
291

292 293 294 295 296
    ```
    cameraInput.close().then(() => {
        console.log('Promise returned with camera closed.');
    })
    ```
M
mali 已提交
297

298
12. 枚举CameraInputErrorCode中新增
M
mali 已提交
299

300
    枚举值名称:ERROR_NO_PERMISSION,值:0;
M
mali 已提交
301

302
    枚举值名称:ERROR_DEVICE_PREEMPTED,值:1;
M
mali 已提交
303

304
    枚举值名称:ERROR_DEVICE_DISCONNECTED,值:2;
M
mali 已提交
305

306
    枚举值名称:ERROR_DEVICE_IN_USE,值:3;
M
mali 已提交
307

308
    枚举值名称:ERROR_DRIVER_ERROR,值:4;
M
mali 已提交
309

310
13. 枚举CameraFormat中新增
M
mali 已提交
311

312
    枚举值名称:CAMERA_FORMAT_RGBA_8888,值:3;
M
mali 已提交
313

314
14. CaptureSession中新增getMeteringPoint(callback: AsyncCallback<Point>): void;以及getMeteringPoint(): Promise<Point>;
M
mali 已提交
315

316
    参考代码如下:
M
mali 已提交
317

318 319 320 321 322 323 324 325 326
    ```
    captureSession.getMeteringPoint((err, exposurePoint) => {
        if (err) {
            console.log(`Failed to get the current exposure point ${err.message}`);
            return ;
        }
        console.log(`Callback returned with current exposure point: ${exposurePoint}`);
    })
    ```
M
mali 已提交
327

328 329 330 331 332
    ```
    captureSession.getMeteringPoint().then((exposurePoint) => {
        console.log(`Promise returned with current exposure point : ${exposurePoint}`);
    })
    ```
M
mali 已提交
333

334
15. CaptureSession中新增setMeteringPoint(point: Point, callback: AsyncCallback<void>): void;以及setMeteringPoint(point: Point): Promise<void>;
M
mali 已提交
335 336 337 338

    参考代码如下:

    ```
339 340 341 342 343 344 345 346
    const Point1 = {x: 1, y: 1};
    
    captureSession.setMeteringPoint(Point1,(err) => {
        if (err) {
            console.log(`Failed to set the exposure point ${err.message}`);
            return ;
        }
        console.log('Callback returned with the successful execution of setMeteringPoint');
M
mali 已提交
347 348 349
    })
    ```

350 351 352 353 354 355 356
    ```
    const Point2 = {x: 2, y: 2};
    
    captureSession.setMeteringPoint(Point2).then(() => {
        console.log('Promise returned with the successful execution of setMeteringPoint');
    })
    ```
M
mali 已提交
357

358
16. 枚举CaptureSessionErrorCode中新增
M
mali 已提交
359

360
    枚举值名称:ERROR_INSUFFICIENT_RESOURCES,值:0;
M
mali 已提交
361

362
    枚举值名称:ERROR_TIMEOUT,值:1;
M
mali 已提交
363

364
17. 新增接口CameraOutput,接口下有release(callback: AsyncCallback<void>): void;以及release(): Promise<void>;方法
M
mali 已提交
365

366
    参考代码如下:用previewOutput做示例
M
mali 已提交
367

368 369 370 371 372 373 374 375 376
    ```
    previewOutput.release((err) => {
        if (err) {
            console.error(`Failed to release the PreviewOutput instance ${err.message}`);
            return;
        }
        console.log('Callback invoked to indicate that the PreviewOutput instance is released successfully.');
    });
    ```
M
mali 已提交
377

378 379 380 381 382
    ```
    previewOutput.release().then(() => {
        console.log('Promise returned to indicate that the PreviewOutput instance is released successfully.');
    })
    ```
M
mali 已提交
383

384
18. PreviewOutput中新增start(callback: AsyncCallback<void>): void;以及start(): Promise<void>;
M
mali 已提交
385

386
    参考代码如下
M
mali 已提交
387

388 389 390 391 392 393 394 395 396
    ```
    previewOutput.start((err) => {
        if (err) {
            console.error(`Failed to start the previewOutput. ${err.message}`);
            return;
        }
        console.log('Callback returned with previewOutput started.');
    })
    ```
M
mali 已提交
397

398 399 400 401 402
    ```
    previewOutput.start().then(() => {
        console.log('Promise returned with previewOutput started.');
    })
    ```
M
mali 已提交
403

404
19. PreviewOutput中新增stop(callback: AsyncCallback<void>): void;以及stop(): Promise<void>;
M
mali 已提交
405

406
    参考代码如下
M
mali 已提交
407 408

    ```
409
    previewOutput.stop((err) => {
M
mali 已提交
410
        if (err) {
411
            console.error(`Failed to stop the previewOutput. ${err.message}`);
M
mali 已提交
412 413
            return;
        }
414
        console.log('Callback returned with previewOutput stopped.');
M
mali 已提交
415 416 417 418
    })
    ```

    ```
419 420
    previewOutput.stop().then(() => {
        console.log('Callback returned with previewOutput stopped.');
M
mali 已提交
421 422 423
    })
    ```

424
20. PhotoCaptureSetting接口
M
mali 已提交
425

426
    属性1:mirror?,类型:boolean;
M
mali 已提交
427

428
21. 枚举PhotoOutputErrorCode中新增
M
mali 已提交
429

430
    枚举值名称:ERROR_DRIVER_ERROR,值:0;
M
mali 已提交
431

432
    枚举值名称:ERROR_INSUFFICIENT_RESOURCES,值:1;
M
mali 已提交
433

434
    枚举值名称:ERROR_TIMEOUT,值:2;
M
mali 已提交
435

436 437 438 439 440 441 442
22. 枚举VideoOutputErrorCode中新增

    枚举值名称:ERROR_DRIVER_ERROR,值:0;

23. MetadataOutput中新增on(type: 'error', callback: ErrorCallback<MetadataOutputError>): void;

    参考代码如下
M
mali 已提交
443 444

    ```
445 446
    metadataOutput.on('error', (metadataOutputError) => {
        console.log(`Metadata output error code: ${metadataOutputError.code}`);
M
mali 已提交
447 448 449
    })
    ```

450
24. MetadataOutputErrorCode枚举
M
mali 已提交
451

452
    枚举值名称:ERROR_UNKNOWN,值:-1;
M
mali 已提交
453

454
    枚举值名称:ERROR_INSUFFICIENT_RESOURCES,值:0;
M
mali 已提交
455

456
25. MetadataOutputError接口
M
mali 已提交
457

458
    属性名称:code,值:MetadataOutputErrorCode
M
mali 已提交
459

460
**废弃接口**
M
mali 已提交
461

462
1. CameraInput中废弃接口on(type: 'exposureStateChange', callback: AsyncCallback<ExposureState>): void;
M
mali 已提交
463

464
2. previewOutput中废弃接口release(callback: AsyncCallback<void>): void;以及release(): Promise<void>;
M
mali 已提交
465

466
3. metadataOutput中废弃接口
M
mali 已提交
467

468
   setCapturingMetadataObjectTypes(metadataObjectTypes: Array<MetadataObjectType>, callback: AsyncCallback<void>): void;<br/>setCapturingMetadataObjectTypes(metadataObjectTypes: Array<MetadataObjectType>): Promise<void>;
M
mali 已提交
469

470
4. metadataOutput中废弃接口
M
mali 已提交
471

472
   getSupportedMetadataObjectTypes(callback: AsyncCallback<Array<MetadataObjectType>>): void;<br/>getSupportedMetadataObjectTypes(): Promise<Array<MetadataObjectType>>;
M
mali 已提交
473

474
5. PreviewOutput中废弃接口release(callback: AsyncCallback<void>): void;以及release(): Promise<void>;
M
mali 已提交
475

476
6. PhotoOutput中废弃接口release(callback: AsyncCallback<void>): void;以及release(): Promise<void>;
M
mali 已提交
477

478
7. VideoOutput中废弃接口release(callback: AsyncCallback<void>): void;以及release(): Promise<void>;
M
mali 已提交
479

480
8. CameraInput中废弃接口getCameraId(callback: AsyncCallback<string>): void;以及getCameraId(): Promise<string>;
M
mali 已提交
481

482
9. CameraInput中废弃接口getExposurePoint(callback: AsyncCallback<Point>): void;以及getExposurePoint(): Promise<Point>;
M
mali 已提交
483

484
10. CameraInput中废弃接口setExposurePoint(exposurePoint: Point, callback: AsyncCallback<void>): void;以及setExposurePoint(exposurePoint: Point): Promise<void>;
M
mali 已提交
485

486
**接口变更**
M
mali 已提交
487

488
1. CameraManager中接口getCameras返回值由Array<Camera>变更为Array<CameraDevice>,接口名由getCameras 更换为 getSupportedCameras,因此旧接口getCameras(callback: AsyncCallback<Array<Camera>>): void;以及getCameras(): Promise<Array<Camera>>;变更为getSupportedCameras(callback: AsyncCallback<Array<CameraDevice>>): void和getSupportedCameras(): Promise<Array<CameraDevice>>;
M
mali 已提交
489 490 491 492

   参考代码如下:

   ```
493 494 495 496 497 498
   cameraManager.getSupportedCameras((err, cameras) => {
       if (err) {
           console.error(`Failed to get the cameras. ${err.message}`);
           return;
       }
       console.log(`Callback returned with an array of supported cameras: ${cameras.length}`);
M
mali 已提交
499 500 501 502 503
   })
   ```

   ```
   cameraManager.getSupportedCameras().then((cameras) => {
504
       console.log(`Promise returned with an array of supported cameras: ${cameras.length}`);
M
mali 已提交
505 506 507
   })
   ```

508
2. CameraManager中接口createCameraInput传递参数由原来cameraId: string变更为camera: CameraDevice,因此旧接口createCameraInput(cameraId: string, callback: AsyncCallback<CameraInput>): void;以及createCameraInput(cameraId: string): Promise<CameraInput>;变更为createCameraInput(camera: CameraDevice, callback: AsyncCallback<CameraInput>): void;和createCameraInput(camera: CameraDevice): Promise<CameraInput>;
M
mali 已提交
509 510 511 512

   参考代码如下:

   ```
513 514 515 516 517 518 519 520
   let cameraDevice = cameras[0];
   cameraManager.createCameraInput(cameraDevice, (err, cameraInput) => {
       if (err) {
           console.error(`Failed to create the CameraInput instance. ${err.message}`);
           return;
       }
       console.log('Callback returned with the CameraInput instance.');
   })
M
mali 已提交
521 522
   ```

523 524 525 526 527 528 529 530
   ```
   let cameraDevice = cameras[0];
   cameraManager.createCameraInput(cameraDevice).then((cameraInput) => {
       console.log('Promise returned with the CameraInput instance');
   })
   ```

3. CameraManager中接口createPreviewOutput新增传递参数profile: Profile,profile参数由getSupportedOutputCapability接口获取,因此旧接口createPreviewOutput(surfaceId: string, callback: AsyncCallback<PreviewOutput>): void;以及createPreviewOutput(surfaceId: string): Promise<PreviewOutput>;变更为createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PreviewOutput>): void;createPreviewOutput(profile: Profile, surfaceId: string): Promise<PreviewOutput>;
M
mali 已提交
531 532 533 534

   参考代码如下:

   ```
535 536 537 538 539 540 541 542
   let profile = cameraoutputcapability.previewProfiles[0];
   cameraManager.createPreviewOutput(profile, surfaceId, (err, previewOutput) => {
       if (err) {
           console.error(`Failed to gcreate previewOutput. ${err.message}`);
           return;
       }
       console.log('Callback returned with previewOutput created.');
   })
M
mali 已提交
543 544
   ```

545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618
   ```
   let profile = cameraoutputcapability.previewProfiles[0];
   cameraManager.createPreviewOutput(profile, surfaceId).then((previewOutput) => {
       console.log('Promise returned with previewOutput created.');
   })
   ```

4. CameraManager中接口createPhotoOutput新增传递参数profile: Profile,profile参数由getSupportedOutputCapability接口获取,因此旧接口CreatePhotoOutput(surfaceId: string, callback: AsyncCallback<PhotoOutput>): void;以及CreatePhotoOutput(surfaceId: string): Promise<PhotoOutput>;变更为createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PhotoOutput>): void;和createPhotoOutput(profile: Profile, surfaceId: string): Promise<PhotoOutput>;

   参考代码如下:

   ```
   let profile = cameraoutputcapability.photoProfiles[0];
   cameraManager.createPhotoOutput(profile, surfaceId, (err, photoOutput) => {
       if (err) {
           console.error(`Failed to create photoOutput. ${err.message}`);
           return;
       }
       console.log('Callback returned with photoOutput created.');
   })
   ```

   ```
   let profile = cameraoutputcapability.photoProfiles[0];
   cameraManager.createPhotoOutput(profile, surfaceId).then((photoOutput) => {
       console.log('Promise returned with photoOutput created.');
   })
   ```

5. CameraManager中接口createVideoOutput新增传递参数profile: Profile,profile参数由getSupportedOutputCapability接口获取,因此旧接口createVideoOutput(surfaceId: string, callback: AsyncCallback<VideoOutput>): void;以及createVideoOutput(surfaceId: string): Promise<VideoOutput>;变更为createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback<VideoOutput>): void;和createVideoOutput(profile: VideoProfile, surfaceId: string): Promise<VideoOutput>;

   参考代码如下:

   ```
   let profile = cameraoutputcapability.videoProfiles[0];
   cameraManager.createVideoOutput(profile, surfaceId, (err, videoOutput) => {
       if (err) {
           console.error(`Failed to create videoOutput. ${err.message}`);
           return;
       }
       console.log('Callback returned with an array of supported outputCapability' );
   })
   ```

   ```
   let profile = cameraoutputcapability.videoProfiles[0];
   cameraManager.createVideoOutput(profile, surfaceId).then((videoOutput) => {
       console.log('Promise returned with videoOutput created.');
   })
   ```

6. CameraManager中接口createMetadataOutput新增传递参数metadataObjectTypes: Array<MetadataObjectType>,metadataObjectTypes参数由getSupportedOutputCapability接口获取,因此旧接口function createMetadataOutput(callback: AsyncCallback<MetadataOutput>): void;以及function createMetadataOutput(): Promise<MetadataOutput>;变更为createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>, callback: AsyncCallback<MetadataOutput>): void;和createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): Promise<MetadataOutput>;

   参考代码如下:

   ```
   let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes;
   cameraManager.createMetadataOutput(metadataObjectTypes, (err, metadataOutput) => {
       if (err) {
           console.error(`Failed to create metadataOutput. ${err.message}`);
           return;
       }
       console.log('Callback returned with metadataOutput created.');
   })
   ```

   ```
   let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes;
   cameraManager.createMetadataOutput(metadataObjectTypes).then((metadataOutput) => {
       console.log('Promise returned with metadataOutput created.');
   })
   ```
   
7. CameraManager中createCaptureSession不需要考虑context属性,因此旧接口createCaptureSession(context: Context, callback: AsyncCallback<CaptureSession>): void;以及createCaptureSession(context: Context): Promise<CaptureSession>;改为createCaptureSession(callback: AsyncCallback<CaptureSession>): void;和createCaptureSession(): Promise<CaptureSession>;
M
mali 已提交
619 620 621

   参考代码如下:

622 623 624 625 626 627 628 629
   ```typescript
   cameraManager.createCaptureSession((err, captureSession) => {
       if (err) {
           console.error(`Failed to create captureSession. ${err.message}`);
           return;
       }
       console.log('Callback returned with captureSession created.');
   })
M
mali 已提交
630
   ```
631 632 633 634 635

   ```
   cameraManager.createCaptureSession().then((captureSession) => {
       console.log('Promise returned with captureSession created.');
   })
M
mali 已提交
636 637
   ```

638 639 640
8. CameraStatusInfo接口下属性camera类型由Camera变更为CameraDevice

9. CameraInput中接口on(type: 'error')新增传递参数camera: CameraDevice,因此旧接口on(type: 'error', callback: ErrorCallback<CameraInputError>): void;变更为on(type: 'error', camera: CameraDevice, callback: ErrorCallback<CameraInputError>): void;
M
mali 已提交
641 642 643 644

   参考代码如下:

   ```
645 646 647
   let cameraDevice = cameras[0];
   cameraInput.on('error', cameraDevice, (cameraInputError) => {
       console.log(`Camera input error code: ${cameraInputError.code}`);
M
mali 已提交
648 649
   })
   ```
650 651
	
10. CameraInput中以下接口调整到CaptureSession中
M
mali 已提交
652

653
    hasFlash(callback: AsyncCallback<boolean>): void;<br/>hasFlash(): Promise<boolean>;<br/>
M
mali 已提交
654

655
    isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback<boolean>): void;<br/>isFlashModeSupported(flashMode: FlashMode): Promise<boolean>;<br/>
M
mali 已提交
656

657
    getFlashMode(callback: AsyncCallback<FlashMode>): void;<br/>getFlashMode(): Promise<FlashMode>;<br/>
M
mali 已提交
658

659
    setFlashMode(flashMode: FlashMode, callback: AsyncCallback<void>): void;<br/>setFlashMode(flashMode: FlashMode): Promise<void>;<br/>
M
mali 已提交
660

661
    isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback<boolean>): void;<br/>isExposureModeSupported(aeMode: ExposureMode): Promise<boolean>;<br/>
M
mali 已提交
662

663
    getExposureMode(callback: AsyncCallback<ExposureMode>): void;<br/>getExposureMode(): Promise<ExposureMode>;<br/>
M
mali 已提交
664

665
    setExposureMode(aeMode: ExposureMode, callback: AsyncCallback<void>): void;<br/>setExposureMode(aeMode: ExposureMode): Promise<void>;<br/>
M
mali 已提交
666

667
    getMeteringPoint(callback: AsyncCallback<Point>): void;<br/>getMeteringPoint(): Promise<Point>;<br/>
M
mali 已提交
668

669
    setMeteringPoint(point: Point, callback: AsyncCallback<void>): void;<br/>setMeteringPoint(point: Point): Promise<void>;<br/>
M
mali 已提交
670

671
    getExposureBiasRange(callback: AsyncCallback<Array<number>>): void;<br/>getExposureBiasRange(): Promise<Array<number>>;<br/>
M
mali 已提交
672

673
    setExposureBias(exposureBias: number, callback: AsyncCallback<void>): void;<br/>setExposureBias(exposureBias: number): Promise<void>;<br/>
M
mali 已提交
674

675
    getExposureValue(callback: AsyncCallback<number>): void;<br/>getExposureValue(): Promise<number>;<br/>
M
mali 已提交
676

677
    isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<boolean>): void;<br/>isFocusModeSupported(afMode: FocusMode): Promise<boolean>;<br/>
M
mali 已提交
678

679
    getFocusMode(callback: AsyncCallback<FocusMode>): void;<br/>getFocusMode(): Promise<FocusMode>;<br/>
M
mali 已提交
680

681
    setFocusMode(afMode: FocusMode, callback: AsyncCallback<void>): void;<br/>setFocusMode(afMode: FocusMode): Promise<void>;<br/>
M
mali 已提交
682

683
    setFocusPoint(point: Point, callback: AsyncCallback<void>): void;<br/>setFocusPoint(point: Point): Promise<void>;<br/>
M
mali 已提交
684

685
    getFocusPoint(callback: AsyncCallback<Point>): void;<br/>getFocusPoint(): Promise<Point>;<br/>
M
mali 已提交
686

687
    getFocalLength(callback: AsyncCallback<number>): void;<br/>getFocalLength(): Promise<number>;<br/>
M
mali 已提交
688

689
    getZoomRatioRange(callback: AsyncCallback<Array<number>>): void;<br/>getZoomRatioRange(): Promise<Array<number>>;<br/>
M
mali 已提交
690

691
    getZoomRatio(callback: AsyncCallback<number>): void;<br/>getZoomRatio(): Promise<number>;<br/>
M
mali 已提交
692

693 694 695
    setZoomRatio(zoomRatio: number, callback: AsyncCallback<void>): void;<br/>setZoomRatio(zoomRatio: number): Promise<void>;
	
11. CameraInput中接口on(type: 'focusStateChange', callback: AsyncCallback<FocusState>): void;调整到CaptureSession中,对应接口on(type: 'focusStateChange', callback: AsyncCallback<FocusState>): void;
M
mali 已提交
696 697 698 699

    参考代码如下:

    ```
700 701
    captureSession.on('focusStateChange', (focusState) => {
        console.log(`Focus state  : ${focusState}`);
M
mali 已提交
702 703 704
    })
    ```

705
12. 枚举ExposureMode中
M
mali 已提交
706

707
    枚举值名称:EXPOSURE_MODE_AUTO,初值由默认变更为1;
M
mali 已提交
708

709
    枚举值名称:EXPOSURE_MODE_CONTINUOUS_AUTO,初值由默认变更为2;
M
mali 已提交
710

711
13. 枚举VideoStabilizationMode中
M
mali 已提交
712

713
    枚举值名称:LOW,初值由默认变更为1;
M
mali 已提交
714

715
    枚举值名称:MIDDLE,初值由默认变更为2;
M
mali 已提交
716

717
    枚举值名称:HIGH,初值由默认变更为3;
M
mali 已提交
718

719
    枚举值名称:AUTO,初值由默认变更为4;
M
mali 已提交
720

721
14. CaptureSession中接口addOutput参数由原来子类类型(PreviewOutput,PhotoOutput,VideoOutput,MetadataOutput)统一修改为基类类型(CameraOutput),变更后由原来8个接口缩减为2个接口。
M
mali 已提交
722

723
    改变前接口为:
M
mali 已提交
724

725
    addOutput(previewOutput: PreviewOutput, callback: AsyncCallback<void>): void;<br/>addOutput(previewOutput: PreviewOutput): Promise<void>;<br/>addOutput(photoOutput: PhotoOutput, callback: AsyncCallback<void>): void;<br/>addOutput(photoOutput: PhotoOutput): Promise<void>;<br/>addOutput(videoOutput: VideoOutput, callback: AsyncCallback<void>): void;<br/>addOutput(videoOutput: VideoOutput): Promise<void>;<br/>addOutput(metadataOutput: MetadataOutput, callback: AsyncCallback<void>): void;<br/>addOutput(metadataOutput: MetadataOutput): Promise<void>;
M
mali 已提交
726

727
    改变后接口为:
M
mali 已提交
728

729
    addOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void;<br/>addOutput(cameraOutput: CameraOutput): Promise<void>;
M
mali 已提交
730

731
    参考代码如下:以PreviewOutput为例
M
mali 已提交
732 733

    ```
734
    captureSession.addOutput(previewOutput, (err) => {
M
mali 已提交
735
        if (err) {
736
            console.error(`Failed to add output. ${err.message}`);
M
mali 已提交
737 738
            return;
        }
739
        console.log('Callback returned with output added.');
M
mali 已提交
740 741 742 743
    })
    ```

    ```
744 745
    captureSession.addOutput(previewOutput).then(() => {
        console.log('Promise returned with cameraOutput added.');
M
mali 已提交
746 747 748
    })
    ```

749
15. CaptureSession中接口removeOutput参数由原来子类类型(PreviewOutput,PhotoOutput,VideoOutput,MetadataOutput)统一修改为基类类型(CameraOutput),变更后由原来8个接口缩减为2个接口。
M
mali 已提交
750

751
    改变前接口为:
M
mali 已提交
752

753
    removeOutput(previewOutput: PreviewOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(previewOutput: PreviewOutput): Promise<void>;<br/>removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(photoOutput: PhotoOutput): Promise<void>;<br/>removeOutput(videoOutput: VideoOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(videoOutput: VideoOutput): Promise<void>;<br/>removeOutput(metadataOutput: MetadataOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(metadataOutput: MetadataOutput): Promise<void>;
M
mali 已提交
754

755
    改变后接口为:
M
mali 已提交
756

757
    removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void;<br/>removeOutput(cameraOutput: CameraOutput): Promise<void>;
M
mali 已提交
758

759
    参考代码如下:以PreviewOutput为例
M
mali 已提交
760

761 762 763 764 765 766 767 768 769
    ```
    captureSession.removeOutput(previewOutput, (err) => {
        if (err) {
            console.error(`Failed to remove the CameraOutput instance. ${err.message}`);
            return;
        }
        console.log('Callback invoked to indicate that the CameraOutput instance is removed.');
    });
    ```
M
mali 已提交
770 771

    ```
772 773
    captureSession.removeOutput(previewOutput).then(() => {
        console.log('Promise returned to indicate that the CameraOutput instance is removed.');
M
mali 已提交
774 775 776
    })
    ```

777
16. 枚举MetadataObjectType中
M
mali 已提交
778

779
    枚举值名称由FACE变更为FACE_DETECTION;
M
mali 已提交
780

781
17. 接口Camera名称更改为CameraDevice