From 192175edea097ef4c47f9ff395a63523e18ca60d Mon Sep 17 00:00:00 2001 From: zengyawen Date: Fri, 28 Jul 2023 18:01:22 +0800 Subject: [PATCH] update docs Signed-off-by: zengyawen --- .../media/camera-preformance-imporvement.md | 12 +++---- .../reference/apis/js-apis-camera.md | 34 +++++++++++++------ 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/zh-cn/application-dev/media/camera-preformance-imporvement.md b/zh-cn/application-dev/media/camera-preformance-imporvement.md index 35e7cd88bc..dd8310024d 100644 --- a/zh-cn/application-dev/media/camera-preformance-imporvement.md +++ b/zh-cn/application-dev/media/camera-preformance-imporvement.md @@ -125,9 +125,9 @@ if (isSupported) { | 接口 | 说明 | | ---- | ---- | -| isPreLaunchSupported(camera: CameraDevice) : boolean | 判断指定cameraDevice是否支持预热启动。 | -| setPreLaunchConfig(preLaunchConfig: PreLaunchConfig) : void | 配置相机预热参数。 | -| preLaunch() : void | 用户点击系统相机图标,拉起相机应用的同时调用,下发预热请求,使能相机预热启动。 | +| isPrelaunchSupported(camera: CameraDevice) : boolean | 判断指定cameraDevice是否支持预热启动。 | +| setPrelaunchConfig(prelaunchConfig: PrelaunchConfig) : void | 配置相机预热参数。 | +| prelaunch() : void | 用户点击系统相机图标,拉起相机应用的同时调用,下发预热请求,使能相机预热启动。 | ### 开发示例 @@ -142,7 +142,7 @@ if (isSupported) { this.cameraManager = camera.getCameraManager(globalThis.abilityContext); try { - this.cameraManager.preLaunch(); + this.cameraManager.prelaunch(); } catch (error) { console.error(`catch error: Code: ${error.code}, message: ${error.message}`) } @@ -159,9 +159,9 @@ if (isSupported) { this.cameraManager = camera.getCameraManager(globalThis.abilityContext); let cameras = this.cameraManager.getSupportedCameras() - if(this.cameraManager.isPreLaunchSupported(cameras[0])) { + if(this.cameraManager.isPrelaunchSupported(cameras[0])) { try { - this.cameraManager.setPreLaunchConfig({cameraDevice: cameras[0]}); + this.cameraManager.setPrelaunchConfig({cameraDevice: cameras[0]}); } catch (error) { console.error(`catch error: Code: ${error.code}, message: ${error.message}`) } 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 cc3d4f60fe..0e1e65c40a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-camera.md +++ b/zh-cn/application-dev/reference/apis/js-apis-camera.md @@ -582,11 +582,11 @@ cameraManager.on('cameraMute', (err, curMuetd) => { }) ``` -### isPreLaunchSupported +### isPrelaunchSupported -isPreLaunchSupported(camera: CameraDevice): boolean +isPrelaunchSupported(camera: CameraDevice): boolean -在setPreLaunchConfig接口使用前调用,用于判断指定cameraDevice是否支持预热启动。 +在setPrelaunchConfig接口使用前调用,用于判断指定cameraDevice是否支持预热启动。 **系统接口:** 此接口为系统接口。 @@ -617,14 +617,14 @@ isPreLaunchSupported(camera: CameraDevice): boolean ```js this.cameraManager = camera.getCameraManager(globalThis.abilityContext); let cameras = this.cameraManager.getSupportedCameras() -if(this.cameraManager.isPreLaunchSupported(cameras[0])) { - this.cameraManager.setPreLaunchConfig({cameraDevice: cameras[0]}); +if(this.cameraManager.isPrelaunchSupported(cameras[0])) { + this.cameraManager.setPrelaunchConfig({cameraDevice: cameras[0]}); } ``` -### setPreLaunchConfig +### setPrelaunchConfig -setPreLaunchConfig(preLaunchConfig: PreLaunchConfig): void +setPrelaunchConfig(prelaunchConfig: PrelaunchConfig): void **系统接口:** 此接口为系统接口。 @@ -636,7 +636,7 @@ setPreLaunchConfig(preLaunchConfig: PreLaunchConfig): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------- | ---- | --------- | -| preLaunchConfig | [PreLaunchConfig](#prelaunchconfig) | 是 | 预启动配置参数。| +| prelaunchConfig | [PrelaunchConfig](#prelaunchconfig) | 是 | 预启动配置参数。| **错误码:** @@ -652,11 +652,18 @@ setPreLaunchConfig(preLaunchConfig: PreLaunchConfig): void ```js this.cameraManager = camera.getCameraManager(globalThis.abilityContext); let cameras = this.cameraManager.getSupportedCameras() +if(this.cameraManager.isPrelaunchSupported(cameras[0])) { + try { + this.cameraManager.setPrelaunchConfig({cameraDevice: cameras[0]}); + } catch (error) { + console.error(`catch error: Code: ${error.code}, message: ${error.message}`); + } +} ``` -### preLaunch +### prelaunch -preLaunch(): void +prelaunch(): void 用户点击系统相机图标,拉起相机应用同时调用,下发预热请求,使能相机预热启动。 @@ -668,6 +675,11 @@ preLaunch(): void ```js this.cameraManager = camera.getCameraManager(globalThis.abilityContext); +try { + this.cameraManager.prelaunch(); +} catch (error) { + console.error(`catch error: Code: ${error.code}, message: ${error.message}`); +} ``` ### createDeferredPreviewOutput @@ -710,7 +722,7 @@ function getDeferredPreviewOutput(context: Context, previewProfile: camera.Profi } ``` -## PreLaunchConfig +## PrelaunchConfig 相机预启动配置参数。 -- GitLab