From 37ae86d9fc16c7d90674647fabfce9039296085b Mon Sep 17 00:00:00 2001 From: magekkkk Date: Wed, 29 Sep 2021 03:00:10 +0000 Subject: [PATCH] update js reference for audio manager Signed-off-by: magekkkk --- ...63\351\242\221\347\256\241\347\220\206.md" | 107 ++++++------------ 1 file changed, 37 insertions(+), 70 deletions(-) diff --git "a/zh-cn/application-dev/js-reference/\351\237\263\351\242\221\347\256\241\347\220\206.md" "b/zh-cn/application-dev/js-reference/\351\237\263\351\242\221\347\256\241\347\220\206.md" index d84cf90dfae..8fa663e5f71 100644 --- "a/zh-cn/application-dev/js-reference/\351\237\263\351\242\221\347\256\241\347\220\206.md" +++ "b/zh-cn/application-dev/js-reference/\351\237\263\351\242\221\347\256\241\347\220\206.md" @@ -6,7 +6,8 @@ - [AudioVolumeType](#section92261857172218) - [DeviceFlag](#section11285183164210) - [DeviceRole](#section380038142619) -- [DeviceType](#section11727420122710) +- [DeviceType](#devicetype) + - [ActiveDeviceType7+](#activedevicetype) - [AudioRingMode7+](#section14948916131018) - [AudioManager](#section8265143814015) - [setVolume\(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\): void](#section189141826104616) @@ -33,10 +34,10 @@ - [getAudioParameter\(key: string\): Promise7+](#section3185577485) - [getDevices\(deviceFlag: DeviceFlag, callback: AsyncCallback\): void](#section11536182020523) - [getDevices\(deviceFlag: DeviceFlag\): Promise](#section181733125210) - - [setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback\): void7+](#section103558400222) - - [setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise7+](#section1235914401228) - - [isDeviceActive\(deviceType: DeviceType, callback: AsyncCallback\): void7+](#section12363240122219) - - [isDeviceActive\(deviceType: DeviceType\): Promise7+](#section18366184012213) + - [setDeviceActive\(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback\): void7+](#section103558400222) + - [setDeviceActive\(deviceType: ActiveDeviceType, active: boolean\): Promise7+](#section1235914401228) + - [isDeviceActive\(deviceType: ActiveDeviceType, callback: AsyncCallback\): void7+](#section12363240122219) + - [isDeviceActive\(deviceType: ActiveDeviceType\): Promise7+](#section18366184012213) - [setMicrophoneMute\(mute: boolean, callback: AsyncCallback\): void7+](#section14703163618122) - [setMicrophoneMute\(mute: boolean\): Promise7+](#section56287111791) - [isMicrophoneMute\(callback: AsyncCallback\): void7+](#section6632141119912) @@ -181,63 +182,29 @@ var audioManager = audio.getAudioManager(); -## DeviceType +## DeviceType 枚举,设备类型。 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

名称

-

默认值

-

描述

-

INVALID

-

0

-

无效设备。

-

SPEAKER

-

1

-

扬声器。

-

WIRED_HEADSET

-

2

-

有线耳机。

-

BLUETOOTH_SCO

-

3

-

SCO(Synchronous Connection Oriented Link)蓝牙设备。

-

BLUETOOTH_A2DP

-

4

-

A2DP(Advanced Audio Distribution Profile )蓝牙设备。

-

MIC

-

5

-

麦克风。

-
+| 名称 | 默认值 | 描述 | +| -------------- | ------------- | ------------------------------------------------------- | +| INVALID | 0 | 无效设备。 | +| EARPIECE | 1 | 听筒。 | +| SPEAKER | 2 | 扬声器。 | +| WIRED_HEADSET | 3 | 有线耳机。 | +| BLUETOOTH_SCO | 7 | 蓝牙设备SCO连接(Synchronous Connection Oriented)。 | +| BLUETOOTH_A2DP | 8 | 蓝牙设备A2DP连接(Advanced Audio Distribution Profile)。 | +| MIC | 15 | 麦克风。 | + + +## ActiveDeviceType7+ + +Enumerates active device types. + +| 名称 | 默认值 | 描述 | +| ------------- | ------------- | -------------------------------------------------------- | +| SPEAKER | 2 | 扬声器。 | +| BLUETOOTH_SCO | 7 | 蓝牙设备SCO连接(Synchronous Connection Oriented)。 | ## AudioRingMode7+ @@ -1596,7 +1563,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=> ) ``` -### setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback\): void7+ +### setDeviceActive\(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback\): void7+ 设置设备激活状态,使用callback方式返回异步结果。 @@ -1615,7 +1582,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=>

deviceType

-

DeviceType

+

ActiveDeviceType

@@ -1650,7 +1617,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=> **示例:** ``` -audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { +audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true, (err)=> { if (err) { console.error('Failed to set the active status of the device. ${err.message}'); return; @@ -1659,7 +1626,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { }) ``` -### setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise7+ +### setDeviceActive\(deviceType: ActiveDeviceType, active: boolean\): Promise7+ 设置设备激活状态,使用promise方式返回异步结果。 @@ -1678,7 +1645,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> {

deviceType

-

DeviceType

+

ActiveDeviceType

@@ -1717,7 +1684,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { **示例:** ``` -audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=> +audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true).then(()=> console.log('Promise returned to indicate that the device is set to the active status.'); ) ``` @@ -1741,7 +1708,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=>

deviceType

-

DeviceType

+

ActiveDeviceType

@@ -1767,7 +1734,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=> **示例:** ``` -audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { +audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER, (err, value) => { if (err) { console.error('Failed to obtain the active status of the device. ${err.message}'); return; @@ -1776,7 +1743,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { }) ``` -### isDeviceActive\(deviceType: DeviceType\): Promise7+ +### isDeviceActive\(deviceType: ActiveDeviceType\): Promise7+ 获取指定设备激活状态,使用promise方式返回异步结果。 @@ -1795,7 +1762,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {

deviceType

-

DeviceType

+

ActiveDeviceType

@@ -1825,7 +1792,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { **示例:** ``` -audioManager.isDeviceActive(audio.DeviceType.SPEAKER).then((value) => +audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then((value) => console.log('Promise returned to indicate that the active status of the device is obtained.' + value); ) ``` -- Gitee