From b85276f9087a7058a956f776ac4164e48ec27109 Mon Sep 17 00:00:00 2001 From: mali Date: Thu, 8 Dec 2022 11:31:03 +0800 Subject: [PATCH] Document sample modification Signed-off-by: mali --- .../reference/apis/js-apis-camera.md | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-camera.md b/zh-cn/application-dev/reference/apis/js-apis-camera.md index 8c18b34b79..00e0068357 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-camera.md +++ b/zh-cn/application-dev/reference/apis/js-apis-camera.md @@ -194,13 +194,15 @@ getSupportedOutputCapability(camera:CameraDevice, callback: AsyncCallback { - if (err) { - console.error(`Failed to get the outputCapability. ${err.message}`); - return; - } - console.log('Callback returned with an array of supported outputCapability'); +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'); + }) }) ``` @@ -227,9 +229,11 @@ getSupportedOutputCapability(camera:CameraDevice): Promise { - console.log('Promise returned with an array of supported outputCapability'); +cameraManager.getSupportedCameras().then((cameras) => { + let cameraDevice = cameras[0]; + cameraManager.getSupportedOutputCapability(cameraDevice).then((cameraoutputcapability) => { + console.log('Promise returned with an array of supported outputCapability'); + }) }) ``` @@ -3254,9 +3258,16 @@ capture(setting: PhotoCaptureSetting, callback: AsyncCallback): void **示例:** ```js -let settings:PhotoCaptureSetting = { - quality = 1, - rotation = 0 +let captureLocation = { + latitude: 0, + longitude: 0, + altitude: 0, +} +let settings = { + quality: camera.QualityLevel.QUALITY_LEVEL_LOW, + rotation: camera.ImageRotation.ROTATION_0, + location: captureLocation, + mirror: false } photoOutput.capture(settings, (err) => { if (err) { -- GitLab