From 3b19cb0390f76c029da0922105b012e7fcb343b6 Mon Sep 17 00:00:00 2001 From: jiangminyang Date: Fri, 10 Jun 2022 09:45:46 +0800 Subject: [PATCH] fixed some other issue for pr5163. Signed-off-by: jiangminyang --- .../reference/apis/js-apis-camera.md | 162 +++++++++++++++++- 1 file changed, 154 insertions(+), 8 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md index 7229bf0f4c..5d05f72050 100644 --- a/en/application-dev/reference/apis/js-apis-camera.md +++ b/en/application-dev/reference/apis/js-apis-camera.md @@ -175,6 +175,17 @@ cameraManager.getCameras().then((cameraArray) => { }) ``` +### Size + +Size parameters. This interface used to get supported size for Preview + Photo + Video. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +| Name | Default Value | Mandatory| Description | +| -------- | ------------------------------------------- | ---- | ----------------------------------- | +| height | number | Yes | Desired height of the Preview + Photo + Video. | +| width | number | Yes | Desired width of the Preview + Photo + Video.| + ### createCameraInput createCameraInput(cameraId: string, callback: AsyncCallback): void @@ -249,7 +260,7 @@ Creates a **CameraInput** instance with the specified camera position and camera **Example** ``` -cameraManager.createCameraInput(cameraPosition, cameraType, (err, cameraInput) => { +cameraManager.createCameraInput(camera.CameraPosition.CAMERA_POSITION_BACK, camera.CameraType.CAMERA_TYPE_UNSPECIFIED, (err, cameraInput) => { if (err) { console.error('Failed to create the CameraInput instance. ${err.message}'); return; @@ -305,7 +316,11 @@ Listens for camera status changes. This API uses a callback to return the camera **Example** ``` -cameraManager.on('cameraStatus', (cameraStatusInfo) => { +cameraManager.on('cameraStatus', (err, cameraInput) => { + if (err) { + console.error('Failed to get cameraStatus callback. ${err.message}'); + return; + } console.log('camera : ' + cameraStatusInfo.camera.cameraId); console.log('status: ' + cameraStatusInfo.status); }) @@ -334,7 +349,7 @@ async function getCameraInfo() { var cameraId = cameraObj.cameraId; var cameraPosition = cameraObj.cameraPosition; var cameraType = cameraObj.cameraType; - var cameraId = cameraObj.connectionType; + var connectionType = cameraObj.connectionType; } ``` @@ -470,7 +485,7 @@ Checks whether a specified flash mode is supported. This API uses an asynchronou **Example** ``` -cameraInput.isFlashModeSupported(flashMode, (err, status) => { +cameraInput.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO, (err, status) => { if (err) { console.error('Failed to check whether the flash mode is supported. ${err.message}'); return; @@ -638,7 +653,7 @@ Checks whether a specified focus mode is supported. This API uses an asynchronou **Example** ``` -cameraInput.isFocusModeSupported(afMode, (err, status) => { +cameraInput.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO, (err, status) => { if (err) { console.error('Failed to check whether the focus mode is supported. ${err.message}'); return; @@ -848,7 +863,7 @@ Sets a zoom ratio. This API uses an asynchronous callback to return the result. **Example** ``` -cameraInput.setZoomRatio(zoomRatio, (err) => { +cameraInput.setZoomRatio(1, (err) => { if (err) { console.error('Failed to set the zoom ratio value ${err.message}'); return; @@ -950,7 +965,7 @@ Releases this **CameraInput** instance. This API uses an asynchronous callback t **Example** ``` -camera.release((err) => { +cameraInput.release((err) => { if (err) { console.error('Failed to release the CameraInput instance ${err.message}'); return; @@ -1027,6 +1042,27 @@ cameraInput.on('error', (cameraInputError) => { }) ``` +## CameraInputErrorCode + +Enumerates the CameraInput error code. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| ERROR_UNKNOWN | -1 | Unknown error.| + +## CameraInputError + +Camera input error object which extends **Error** interface. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +**Parameters** + +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| code | [CameraInputErrorCode](#camerainputerrorcode) | Used to get error code in CameraInput on('error') callback| ## FlashMode @@ -1836,6 +1872,28 @@ captureSession.on('error', (captureSessionError) => { }) ``` +## CaptureSessionErrorCode + +Enumerates the CaptureSession error code. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| ERROR_UNKNOWN | -1 | Unknown error.| + +## CaptureSessionError + +Capture session error object which extends **Error** interface. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +**Parameters** + +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| code | [CaptureSessionErrorCode](#capturesessionerrorcode) | Used to get error code in CaptureSession on('error') callback.| + ## camera.createPreviewOutput createPreviewOutput(surfaceId: string, callback: AsyncCallback): void @@ -1854,7 +1912,7 @@ Creates a **PreviewOutput** instance. This API uses an asynchronous callback to **Example** ``` -camera.createPreviewOutput((surfaceId), (err, previewOutput) => { +camera.createPreviewOutput(("surfaceId"), (err, previewOutput) => { if (err) { console.error('Failed to create the PreviewOutput instance. ${err.message}'); return; @@ -2013,6 +2071,28 @@ previewOutput.on('error', (previewOutputError) => { }) ``` +## PreviewOutputErrorCode + +Enumerates the PreviewOutput error code. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| ERROR_UNKNOWN | -1 | Unknown error.| + +## PreviewOutputError + +Preview output error object which extends **Error** interface. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +**Parameters** + +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| code | [PreviewOutputErrorCode](#previewoutputerrorcode) | Used to get error code in PreviewOutput on('error') callback.| + ## camera.createPhotoOutput createPhotoOutput(surfaceId: string, callback: AsyncCallback): void @@ -2336,6 +2416,50 @@ photoOutput.on('error', (photoOutputError) => { }) ``` +### FrameShutterInfo + +Frame shutter callback info which provides **captureId** & **timestamp** parameteres & indicates the frame shutter event. + +**Parameteres** + +| Name | Type | Mandatory| Description | +| :------- | :------------------------------- | :--- | :---------------------------------------- | +| captureId | number | Yes | Capture id.| +| timestamp | number | Yes | Timestamp for frame. + +### CaptureEndInfo + +Capture end info which provides **captureId** & **frameCount** parameteres & indicates the photo capture end event. + +**Parameteres** + +| Name | Type | Mandatory| Description | +| :------- | :------------------------------- | :--- | :---------------------------------------- | +| captureId | number | Yes | Capture id.| +| frameCount | number | Yes | Frame count. + +## PhotoOutputErrorCode + +Enumerates the PhotoOutput error code. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| ERROR_UNKNOWN | -1 | Unknown error.| + +## PhotoOutputError + +Photo output error object which extends **Error** interface. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +**Parameters** + +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| code | [PhotoOutputErrorCode](#photooutputerrorcode) | Used to get error code in PhotoOutput on('error') callback.| + ## camera.createVideoOutput createVideoOutput(surfaceId: string, callback: AsyncCallback): void @@ -2609,3 +2733,25 @@ videoOutput.on('error', (VideoOutputError) => { console.log('Video output error code: ' + VideoOutputError.code); }) ``` + +## VideoOutputErrorCode + +Enumerates the VideoOutput error code. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| ERROR_UNKNOWN | -1 | Unknown error.| + +## VideoOutputError + +Photo output error object which extends **Error** interface. + +**System capability**: SystemCapability.Multimedia.Camera.Core + +**Parameters** + +| Name | Default Value| Description | +| ---------------------- | ------ | ------------ | +| code | [VideoOutputErrorCode](#videooutputerrorcode) | Used to get error code in VideoOutput on('error') callback.| \ No newline at end of file -- GitLab