From e40c2b53765d47175f547e42491c3323ccc865c0 Mon Sep 17 00:00:00 2001 From: jiangminyang Date: Tue, 2 Aug 2022 17:26:18 +0800 Subject: [PATCH] fixed new apis for 3.2 Signed-off-by: jiangminyang --- .../reference/apis/js-apis-camera.md | 193 +++++++++++++++++- 1 file changed, 187 insertions(+), 6 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 1872b5698a..dc47924cca 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-camera.md +++ b/zh-cn/application-dev/reference/apis/js-apis-camera.md @@ -108,7 +108,7 @@ camera.getCameraManager(context).then((cameraManager) => { | 名称 | 类型 | 只读 | 说明 | | ------------------------- | --------------------- | --- |------------ | -| frameRateRanges | Array | 是 | 帧率。 | +| frameRateRanges | Array<[FrameRateRange](#frameraterange)> | 是 | 帧率。 | ## CameraOutputCapability @@ -129,7 +129,7 @@ camera.getCameraManager(context).then((cameraManager) => { ### getSupportedCameras -getSupportedCameras(callback: AsyncCallback\>): void +getSupportedCameras(callback: AsyncCallback\>): void 获取支持指定模式的相机设备对象,通过注册回调函数获取结果。 @@ -139,7 +139,7 @@ getSupportedCameras(callback: AsyncCallback\>): void | 名称 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------- | ---- | ------------------------------------ | -| callback | AsyncCallback\> | 是 | 使用callback方式获取支持的相机列表。 | +| callback | AsyncCallback\> | 是 | 使用callback方式获取支持的相机列表。 | **示例:** @@ -155,7 +155,7 @@ cameraManager.getSupportedCameras((err, cameras) => { ### getSupportedCameras -getSupportedCameras(): Promise\> +getSupportedCameras(): Promise\> 获取支持指定模式的相机设备对象,通过Promise获取结果。 @@ -165,7 +165,7 @@ getSupportedCameras(): Promise\> | 类型 | 说明 | | ----------------------------------- | ----------------------------- | -| Promise\> | 使用promise获取支持相机列表。 | +| Promise\> | 使用promise获取支持相机列表。 | **示例:** @@ -232,6 +232,160 @@ cameraManager.getSupportedOutputCapability(cameraDevice).then((cameraoutputcapab }) ``` +### isCameraMuted + +isCameraMuted(callback: AsyncCallback): void + +查询相机是否禁用,通过注册回调函数获取结果。 + +**系统能力:** SystemCapability.Multimedia.Camera.Core + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------------------------ | +| callback | AsyncCallback | 是 | 使用callback方式获取相机是否禁用的结果。 | + +**示例:** + +```js +cameraManager.isCameraMuted((err, status) => { + if (err) { + console.error('Failed to get the cameraMuted status. ${err.message}'); + return; + } + console.log('Callback returned with cameraMuted status'); +}) +``` + +### isCameraMuted + +isCameraMuted(): Promise + +查询相机是否禁用,通过Promise获取结果。 + +**系统能力:** SystemCapability.Multimedia.Camera.Core + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------ | --------------------------------------------- | +| Promise | 使用Promise的方式获取结果,返回相机是否禁用的结果。 | + + +**示例:** + +```js +cameraManager.isCameraMuted().then((status) => { + console.log('Promise returned with the status whether camera is muted.'); +}) +``` + +### isCameraMuteSupported + +isCameraMuteSupported(callback: AsyncCallback): void + +查询是否支持相机禁用,通过注册回调函数获取结果。 + +**系统能力:** SystemCapability.Multimedia.Camera.Core + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ------------------------------------ | +| callback | AsyncCallback | 是 | 使用callback方式获取是否支持相机禁用的结果。 | + +**示例:** + +```js +cameraManager.isCameraMuteSupported((err, status) => { + if (err) { + console.error('Failed to get the cameraMuteSupported. ${err.message}'); + return; + } + console.log('Callback returned with the status whether cameraMuteSupported.'); +}) +``` + +### isCameraMuteSupported + +isCameraMuteSupported(): Promise + +查询是否支持相机禁用,通过Promise获取结果。 + +**系统能力:** SystemCapability.Multimedia.Camera.Core + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ----------------------------- | +| Promise | 使用Promise的方式获取结果,返回是否支持相机禁用的结果。 | + + +**示例:** + +```js +cameraManager.isCameraMuteSupported().then((status) => { + console.log('Promise returned with the status whether cameraMuteSupported.'); +}) +``` + +### muteCamera + +muteCamera(mute:boolean, callback: AsyncCallback): void + +禁用相机,通过注册回调函数获取结果。 + +**系统能力:** SystemCapability.Multimedia.Camera.Core + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------- | ---- | ------------------------------------ | +| mute | boolean | 是 | 是否禁用相机。 | +| callback | AsyncCallback | 是 | 使用callback方式获取相机禁用的结果。 | + +**示例:** + +```js +cameraManager.muteCamera(isMuted, (err) => { + if (err) { + console.error('Failed to mute the camera. ${err.message}'); + return; + } + console.log('Callback returned with the muteCamera.'); +}) +``` + +### muteCamera + +muteCamera(mute:boolean): Promise + +禁用相机,通过Promise获取结果。 + +**系统能力:** SystemCapability.Multimedia.Camera.Core + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------- | ---- | ------------ | +| mute | boolean | 是 | 是否禁用相机。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------------- | ----------------------------- | +| Promise | 使用Promise的方式获取结果,返回是否禁用相机的结果。 | + + +**示例:** + +```js +cameraManager.muteCamera(isMuted).then(() => { + console.log('Promise returned muteCamera.'); +}) +``` + ### createCameraInput createCameraInput(camera: CameraDevice, callback: AsyncCallback): void @@ -711,6 +865,33 @@ cameraManager.on('cameraStatus', (err, cameraStatusInfo) => { }) ``` +### on('cameraMute') + +on(type: 'cameraMute', callback: AsyncCallback): void + +监听相机禁用的状态变化,通过注册回调函数获取相机的状态变化。 + +**系统能力:** SystemCapability.Multimedia.Camera.Core + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| :------- | :---------------------------------------------------- | :--- | :--------------------------------------------------- | +| type | string | 是 | 监听事件,固定为'cameraMute',即相机状态变化事件。 | +| callback | AsyncCallback | 是 | 回调函数,用于获取相机状态变化信息。 | + +**示例:** + +```js +cameraManager.on('cameraMute', (err, status) => { + if (err) { + console.error('Failed to get cameraMute callback. ${err.message}'); + return; + } + console.log('status: ' + status); +}) +``` + ## CameraStatusInfo 相机管理器回调返回的接口实例,表示相机状态信息。 @@ -724,7 +905,7 @@ cameraManager.on('cameraStatus', (err, cameraStatusInfo) => { ## CameraPosition -枚举,相机方向。 +枚举,相机位置。 **系统能力:** SystemCapability.Multimedia.Camera.Core -- GitLab