From a2ba5f830b4a168357355fa66a65743c87ed9ec1 Mon Sep 17 00:00:00 2001 From: ASheLock Date: Tue, 20 Jun 2023 21:16:28 +0800 Subject: [PATCH] =?UTF-8?q?setAudioDevice=20api=209=20doc=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ASheLock --- .../reference/apis/js-apis-call.md | 115 ++---------------- 1 file changed, 13 insertions(+), 102 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-call.md b/zh-cn/application-dev/reference/apis/js-apis-call.md index 4d993ff57b..9e10f42be1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-call.md +++ b/zh-cn/application-dev/reference/apis/js-apis-call.md @@ -3592,13 +3592,15 @@ setAudioDevice\(device: AudioDevice, callback: AsyncCallback\\): void **系统接口:** 此接口为系统接口。 +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + **系统能力**:SystemCapability.Telephony.CallManager **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------- | ---- | ---------- | -| device | [AudioDevice](#audiodevice10) | 是 | 音频设备。 | +| device | [AudioDevice](#audiodevice10)| 是 | 音频设备。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **错误码:** @@ -3607,6 +3609,7 @@ setAudioDevice\(device: AudioDevice, callback: AsyncCallback\\): void | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | +| 201 | Permission denied. | | 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | @@ -3641,103 +3644,13 @@ setAudioDevice\(device: AudioDevice): Promise\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------- | ---- | ---------- | -| device | [AudioDevice](#audiodevice10) | 是 | 音频设备。 | - -**错误码:** - -以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------------------------------------------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | -| 8300002 | Operation failed. Cannot connect to service. | -| 8300003 | System internal error. | -| 8300999 | Unknown error code. | - -**示例:** - -```js -let audioDevice={ - deviceType: 1 -} -call.setAudioDevice(audioDevice).then(() => { - console.log(`setAudioDevice success.`); -}).catch((err) => { - console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`); -}); -``` - -## call.setAudioDevice9+ - -setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback\\): void - -设置通话音频设备。使用callback异步回调。 - -**系统接口:** 此接口为系统接口。 - -**系统能力**:SystemCapability.Telephony.CallManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------ | ---- | -------------- | -| device | [AudioDevice](#audiodevice10) | 是 | 音频设备。 | -| options | [AudioDeviceOptions](#audiodeviceoptions9) | 是 | 音频设备参数。 | -| callback | AsyncCallback<void> | 是 | 回调函数。 | - -**错误码:** - -以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------------------------------------------- | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | -| 8300002 | Operation failed. Cannot connect to service. | -| 8300003 | System internal error. | -| 8300999 | Unknown error code. | - -**示例:** - -```js -let audioDevice={ - deviceType: 1 -} -let audioDeviceOptions={ - bluetoothAddress: "IEEE 802-2014" -} -call.setAudioDevice(audioDevice, audioDeviceOptions, (err) => { - console.log(`callback: err->${JSON.stringify(err)}`); -}); -``` - - -## call.setAudioDevice9+ - -setAudioDevice\(device: AudioDevice, options?: AudioDeviceOptions\): Promise\ - -设置通话音频设备。使用Promise异步回调。 - -**系统接口:** 此接口为系统接口。 - -**系统能力**:SystemCapability.Telephony.CallManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ------------------------------------------ | ---- | ------------------ | -| device | [AudioDevice](#audiodevice10) | 是 | 音频设备。 | -| options | [AudioDeviceOptions](#audiodeviceoptions9) | 否 | 音频设备参数参数。 | +| device | [AudioDevice](#audiodevice10)| 是 | 音频设备。 | **返回值:** -| 类型 | 说明 | -| ------------------- | ------------------------------- | -| Promise<void> | 以Promise形式异步返回设置结果。 | +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | **错误码:** @@ -3745,6 +3658,7 @@ setAudioDevice\(device: AudioDevice, options?: AudioDeviceOptions\): Promise\ { +call.setAudioDevice(audioDevice).then(() => { console.log(`setAudioDevice success.`); }).catch((err) => { console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`); @@ -4773,8 +4684,8 @@ IP多媒体系统调用模式。 | 名称 | 类型 | 必填 | 说明 | | --------------------------------- | ------------------------------------- | ---- | ---------------- | -| deviceType 10+ | [AudioDeviceType](#audiodevicetype10) | 是 | 音频设备类型。 | -| address 10+ | string | 否 | 音频设备地址。 | +| deviceType 10+ | [AudioDeviceType](#audiodevicetype10) | 是 | 音频设备类型。 | +| address 10+ | string | 否 | 音频设备地址。 | ## AudioDeviceType10+ @@ -4802,7 +4713,7 @@ IP多媒体系统调用模式。 | 名称 | 类型 | 必填 | 说明 | | --------------------------------- | ------------------------------------- | ---- | ---------------- | | audioDeviceList 10+ | [Array\](#audiodevice10) | 是 | 音频设备列表。 | -| currentAudioDevice 10+ | [AudioDevice](#audiodevice10) | 是 | 音频设备类型。 | +| currentAudioDevice 10+ | [AudioDevice](#audiodevice10) | 是 | 当前音频设备。 | | isMuted 10+ | boolean | 是 | 是否静音。 | -- GitLab