提交 37ae86d9 编写于 作者: M magekkkk

update js reference for audio manager

Signed-off-by: Nmagekkkk <lixin113@huawei.com>
上级 e65de216
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
- [AudioVolumeType](#section92261857172218) - [AudioVolumeType](#section92261857172218)
- [DeviceFlag](#section11285183164210) - [DeviceFlag](#section11285183164210)
- [DeviceRole](#section380038142619) - [DeviceRole](#section380038142619)
- [DeviceType](#section11727420122710) - [DeviceType](#devicetype)
- [ActiveDeviceType7+](#activedevicetype)
- [AudioRingMode7+](#section14948916131018) - [AudioRingMode7+](#section14948916131018)
- [AudioManager](#section8265143814015) - [AudioManager](#section8265143814015)
- [setVolume\(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback<void\>\): void](#section189141826104616) - [setVolume\(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback<void\>\): void](#section189141826104616)
...@@ -33,10 +34,10 @@ ...@@ -33,10 +34,10 @@
- [getAudioParameter\(key: string\): Promise<string\>7+](#section3185577485) - [getAudioParameter\(key: string\): Promise<string\>7+](#section3185577485)
- [getDevices\(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors\>\): void](#section11536182020523) - [getDevices\(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors\>\): void](#section11536182020523)
- [getDevices\(deviceFlag: DeviceFlag\): Promise<AudioDeviceDescriptors\>](#section181733125210) - [getDevices\(deviceFlag: DeviceFlag\): Promise<AudioDeviceDescriptors\>](#section181733125210)
- [setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback<void\>\): void7+](#section103558400222) - [setDeviceActive\(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback<void\>\): void7+](#section103558400222)
- [setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise<void\>7+](#section1235914401228) - [setDeviceActive\(deviceType: ActiveDeviceType, active: boolean\): Promise<void\>7+](#section1235914401228)
- [isDeviceActive\(deviceType: DeviceType, callback: AsyncCallback<boolean\>\): void7+](#section12363240122219) - [isDeviceActive\(deviceType: ActiveDeviceType, callback: AsyncCallback<boolean\>\): void7+](#section12363240122219)
- [isDeviceActive\(deviceType: DeviceType\): Promise<boolean\>7+](#section18366184012213) - [isDeviceActive\(deviceType: ActiveDeviceType\): Promise<boolean\>7+](#section18366184012213)
- [setMicrophoneMute\(mute: boolean, callback: AsyncCallback<void\>\): void7+](#section14703163618122) - [setMicrophoneMute\(mute: boolean, callback: AsyncCallback<void\>\): void7+](#section14703163618122)
- [setMicrophoneMute\(mute: boolean\): Promise<void\>7+](#section56287111791) - [setMicrophoneMute\(mute: boolean\): Promise<void\>7+](#section56287111791)
- [isMicrophoneMute\(callback: AsyncCallback<boolean\>\): void7+](#section6632141119912) - [isMicrophoneMute\(callback: AsyncCallback<boolean\>\): void7+](#section6632141119912)
...@@ -181,63 +182,29 @@ var audioManager = audio.getAudioManager(); ...@@ -181,63 +182,29 @@ var audioManager = audio.getAudioManager();
</tbody> </tbody>
</table> </table>
## DeviceType<a name="section11727420122710"></a> ## DeviceType<a name="devicetype"></a>
枚举,设备类型。 枚举,设备类型。
<a name="table67271020132718"></a> | 名称 | 默认值 | 描述 |
<table><thead align="left"><tr id="row4727122012711"><th class="cellrowborder" valign="top" width="30.380000000000003%" id="mcps1.1.4.1.1"><p id="p157271520152715"><a name="p157271520152715"></a><a name="p157271520152715"></a>名称</p> | -------------- | ------------- | ------------------------------------------------------- |
</th> | INVALID | 0 | 无效设备。 |
<th class="cellrowborder" valign="top" width="9.950000000000001%" id="mcps1.1.4.1.2"><p id="p187271620152719"><a name="p187271620152719"></a><a name="p187271620152719"></a>默认值</p> | EARPIECE | 1 | 听筒。 |
</th> | SPEAKER | 2 | 扬声器。 |
<th class="cellrowborder" valign="top" width="59.67%" id="mcps1.1.4.1.3"><p id="p772720201277"><a name="p772720201277"></a><a name="p772720201277"></a>描述</p> | WIRED_HEADSET | 3 | 有线耳机。 |
</th> | BLUETOOTH_SCO | 7 | 蓝牙设备SCO连接(Synchronous Connection Oriented)。 |
</tr> | BLUETOOTH_A2DP | 8 | 蓝牙设备A2DP连接(Advanced Audio Distribution Profile)。 |
</thead> | MIC | 15 | 麦克风。 |
<tbody><tr id="row572714205272"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p1895057192713"><a name="p1895057192713"></a><a name="p1895057192713"></a>INVALID</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p772892012273"><a name="p772892012273"></a><a name="p772892012273"></a>0</p> ## ActiveDeviceType<sup>7+</sup><a name="activedevicetype"></a>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p137281920172712"><a name="p137281920172712"></a><a name="p137281920172712"></a>无效设备。</p> Enumerates active device types.
</td>
</tr> | 名称 | 默认值 | 描述 |
<tr id="row16728520192714"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p4753161132815"><a name="p4753161132815"></a><a name="p4753161132815"></a>SPEAKER</p> | ------------- | ------------- | -------------------------------------------------------- |
</td> | SPEAKER | 2 | 扬声器。 |
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p3728920162713"><a name="p3728920162713"></a><a name="p3728920162713"></a>1</p> | BLUETOOTH_SCO | 7 | 蓝牙设备SCO连接(Synchronous Connection Oriented)。 |
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p17728112062715"><a name="p17728112062715"></a><a name="p17728112062715"></a>扬声器。</p>
</td>
</tr>
<tr id="row1758117472814"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p74802011112815"><a name="p74802011112815"></a><a name="p74802011112815"></a>WIRED_HEADSET</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p35820462819"><a name="p35820462819"></a><a name="p35820462819"></a>2</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p155821548285"><a name="p155821548285"></a><a name="p155821548285"></a>有线耳机。</p>
</td>
</tr>
<tr id="row1335108192818"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p107521514142811"><a name="p107521514142811"></a><a name="p107521514142811"></a>BLUETOOTH_SCO</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p18335108112819"><a name="p18335108112819"></a><a name="p18335108112819"></a>3</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p193351683289"><a name="p193351683289"></a><a name="p193351683289"></a>SCO(Synchronous Connection Oriented Link)蓝牙设备。</p>
</td>
</tr>
<tr id="row1649111617286"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p10784017102818"><a name="p10784017102818"></a><a name="p10784017102818"></a>BLUETOOTH_A2DP</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p849110610286"><a name="p849110610286"></a><a name="p849110610286"></a>4</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p549117620284"><a name="p549117620284"></a><a name="p549117620284"></a>A2DP(Advanced Audio Distribution Profile )蓝牙设备。</p>
</td>
</tr>
<tr id="row81701220112812"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="p168642028152812"><a name="p168642028152812"></a><a name="p168642028152812"></a>MIC</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="p517062012812"><a name="p517062012812"></a><a name="p517062012812"></a>5</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="p5170520112813"><a name="p5170520112813"></a><a name="p5170520112813"></a>麦克风。</p>
</td>
</tr>
</tbody>
</table>
## AudioRingMode<sup>7+</sup><a name="section14948916131018"></a> ## AudioRingMode<sup>7+</sup><a name="section14948916131018"></a>
...@@ -1596,7 +1563,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=> ...@@ -1596,7 +1563,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=>
) )
``` ```
### setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback<void\>\): void<sup>7+</sup><a name="section103558400222"></a> ### setDeviceActive\(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback<void\>\): void<sup>7+</sup><a name="section103558400222"></a>
设置设备激活状态,使用callback方式返回异步结果。 设置设备激活状态,使用callback方式返回异步结果。
...@@ -1615,7 +1582,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=> ...@@ -1615,7 +1582,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=>
</thead> </thead>
<tbody><tr id="row15356174052213"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="p6356240182212"><a name="p6356240182212"></a><a name="p6356240182212"></a>deviceType</p> <tbody><tr id="row15356174052213"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="p6356240182212"><a name="p6356240182212"></a><a name="p6356240182212"></a>deviceType</p>
</td> </td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="p1982716244344"><a name="p1982716244344"></a><a name="p1982716244344"></a><a href="#section11727420122710">DeviceType</a></p> <td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="p1982716244344"><a name="p1982716244344"></a><a name="p1982716244344"></a><a href="#section11727420122710">ActiveDeviceType</a></p>
</td> </td>
<td class="cellrowborder" valign="top" width="9.78%" headers="mcps1.1.5.1.3 "><p id="p035794062216"><a name="p035794062216"></a><a name="p035794062216"></a></p> <td class="cellrowborder" valign="top" width="9.78%" headers="mcps1.1.5.1.3 "><p id="p035794062216"><a name="p035794062216"></a><a name="p035794062216"></a></p>
</td> </td>
...@@ -1650,7 +1617,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=> ...@@ -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) { if (err) {
console.error('Failed to set the active status of the device. ${err.message}'); console.error('Failed to set the active status of the device. ${err.message}');
return; return;
...@@ -1659,7 +1626,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { ...@@ -1659,7 +1626,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> {
}) })
``` ```
### setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise<void\><sup>7+</sup><a name="section1235914401228"></a> ### setDeviceActive\(deviceType: ActiveDeviceType, active: boolean\): Promise<void\><sup>7+</sup><a name="section1235914401228"></a>
设置设备激活状态,使用promise方式返回异步结果。 设置设备激活状态,使用promise方式返回异步结果。
...@@ -1678,7 +1645,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { ...@@ -1678,7 +1645,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> {
</thead> </thead>
<tbody><tr id="row6360124010225"><td class="cellrowborder" valign="top" width="17.599999999999998%" headers="mcps1.1.5.1.1 "><p id="p21049584484"><a name="p21049584484"></a><a name="p21049584484"></a>deviceType</p> <tbody><tr id="row6360124010225"><td class="cellrowborder" valign="top" width="17.599999999999998%" headers="mcps1.1.5.1.1 "><p id="p21049584484"><a name="p21049584484"></a><a name="p21049584484"></a>deviceType</p>
</td> </td>
<td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.2 "><p id="p98241474910"><a name="p98241474910"></a><a name="p98241474910"></a><a href="#section11727420122710">DeviceType</a></p> <td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.2 "><p id="p98241474910"><a name="p98241474910"></a><a name="p98241474910"></a><a href="#section11727420122710">ActiveDeviceType</a></p>
</td> </td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="p103601240202216"><a name="p103601240202216"></a><a name="p103601240202216"></a></p> <td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="p103601240202216"><a name="p103601240202216"></a><a name="p103601240202216"></a></p>
</td> </td>
...@@ -1717,7 +1684,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> { ...@@ -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.'); 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(()=> ...@@ -1741,7 +1708,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=>
</thead> </thead>
<tbody><tr id="row1536417409223"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="p12364174016224"><a name="p12364174016224"></a><a name="p12364174016224"></a>deviceType</p> <tbody><tr id="row1536417409223"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="p12364174016224"><a name="p12364174016224"></a><a name="p12364174016224"></a>deviceType</p>
</td> </td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="p1779218497578"><a name="p1779218497578"></a><a name="p1779218497578"></a><a href="#section11727420122710">DeviceType</a></p> <td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="p1779218497578"><a name="p1779218497578"></a><a name="p1779218497578"></a><a href="#section11727420122710">ActiveDeviceType</a></p>
</td> </td>
<td class="cellrowborder" valign="top" width="9.25%" headers="mcps1.1.5.1.3 "><p id="p122111521127"><a name="p122111521127"></a><a name="p122111521127"></a></p> <td class="cellrowborder" valign="top" width="9.25%" headers="mcps1.1.5.1.3 "><p id="p122111521127"><a name="p122111521127"></a><a name="p122111521127"></a></p>
</td> </td>
...@@ -1767,7 +1734,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=> ...@@ -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) { if (err) {
console.error('Failed to obtain the active status of the device. ${err.message}'); console.error('Failed to obtain the active status of the device. ${err.message}');
return; return;
...@@ -1776,7 +1743,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { ...@@ -1776,7 +1743,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {
}) })
``` ```
### isDeviceActive\(deviceType: DeviceType\): Promise<boolean\><sup>7+</sup><a name="section18366184012213"></a> ### isDeviceActive\(deviceType: ActiveDeviceType\): Promise<boolean\><sup>7+</sup><a name="section18366184012213"></a>
获取指定设备激活状态,使用promise方式返回异步结果。 获取指定设备激活状态,使用promise方式返回异步结果。
...@@ -1795,7 +1762,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { ...@@ -1795,7 +1762,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {
</thead> </thead>
<tbody><tr id="row12367340122213"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="p11637137420"><a name="p11637137420"></a><a name="p11637137420"></a>deviceType</p> <tbody><tr id="row12367340122213"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="p11637137420"><a name="p11637137420"></a><a name="p11637137420"></a>deviceType</p>
</td> </td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="p1616311136412"><a name="p1616311136412"></a><a name="p1616311136412"></a><a href="#section11727420122710">DeviceType</a></p> <td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="p1616311136412"><a name="p1616311136412"></a><a name="p1616311136412"></a><a href="#section11727420122710">ActiveDeviceType</a></p>
</td> </td>
<td class="cellrowborder" valign="top" width="8.99%" headers="mcps1.1.5.1.3 "><p id="p201646138419"><a name="p201646138419"></a><a name="p201646138419"></a></p> <td class="cellrowborder" valign="top" width="8.99%" headers="mcps1.1.5.1.3 "><p id="p201646138419"><a name="p201646138419"></a><a name="p201646138419"></a></p>
</td> </td>
...@@ -1825,7 +1792,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => { ...@@ -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); console.log('Promise returned to indicate that the active status of the device is obtained.' + value);
) )
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册