audio-management.md 68.6 KB
Newer Older
M
mamingshuai 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
# Audio Management<a name="EN-US_TOPIC_0000001162414649"></a>

-   [Modules to Import](#en-us_topic_0000001149807881_s56d19203690d4782bfc74069abb6bd71)
-   [Required Permissions](#en-us_topic_0000001149807881_section11257113618419)
-   [Functions](#en-us_topic_0000001149807881_section1580114415416)
-   [getAudioManager\(\)](#en-us_topic_0000001149807881_section84581011418)
-   [Enums](#en-us_topic_0000001149807881_section115029181495)
-   [AudioVolumeType](#en-us_topic_0000001149807881_section92261857172218)
-   [DeviceFlag](#en-us_topic_0000001149807881_section11285183164210)
-   [DeviceRole](#en-us_topic_0000001149807881_section380038142619)
-   [DeviceType](#en-us_topic_0000001149807881_section11727420122710)
-   [Appendixes](#en-us_topic_0000001149807881_section1933416317165)
-   [AudioManager](#en-us_topic_0000001149807881_section8265143814015)
    -   [setVolume\(AudioVolumeType, number, AsyncCallback<void\>\)](#en-us_topic_0000001149807881_section189141826104616)
    -   [setVolume\(AudioVolumeType, number\)](#en-us_topic_0000001149807881_section102021249114612)
    -   [getVolume\(AudioVolumeType, AsyncCallback<number\>\)](#en-us_topic_0000001149807881_section4387320194714)
    -   [getVolume\(AudioVolumeType\)](#en-us_topic_0000001149807881_section04121965119)
    -   [getMinVolume\(AudioVolumeType, AsyncCallback<number\>\)](#en-us_topic_0000001149807881_section188714283511)
    -   [getMinVolume\(AudioVolumeType\)](#en-us_topic_0000001149807881_section41556389511)
    -   [getMaxVolume\(AudioVolumeType, AsyncCallback<number\>\)](#en-us_topic_0000001149807881_section690395418516)
    -   [getMaxVolume\(AudioVolumeType\)](#en-us_topic_0000001149807881_section155151345217)
    -   [getDevices\(DeviceFlag, AsyncCallback<AudioDeviceDescriptors\>\)](#en-us_topic_0000001149807881_section11536182020523)
    -   [getDevices\(DeviceFlag\)](#en-us_topic_0000001149807881_section181733125210)

-   [AudioDeviceDescriptor](#en-us_topic_0000001149807881_section17427121913310)
-   [AudioDeviceDescriptors](#en-us_topic_0000001149807881_section5181155710523)

N
NEEN 已提交
28 29 30
>![](public_sys-resources/icon-note.gif) **NOTE:** 
>Due to permission issues, these feature are temporarily unavailable for the standard system.

M
mamingshuai 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823
## Modules to Import<a name="en-us_topic_0000001149807881_s56d19203690d4782bfc74069abb6bd71"></a>

```
import audio from '@ohos.multimedia.audio';
```

## Required Permissions<a name="en-us_topic_0000001149807881_section11257113618419"></a>

None

## Functions<a name="en-us_topic_0000001149807881_section1580114415416"></a>

## getAudioManager\(\)<a name="en-us_topic_0000001149807881_section84581011418"></a>

Obtains an  **AudioManager**  instance.

**Return Values**

<a name="en-us_topic_0000001149807881_table16391145317913"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row2391145319910"><th class="cellrowborder" valign="top" width="17.01%" id="mcps1.1.3.1.1"><p id="en-us_topic_0000001149807881_p13911353991"><a name="en-us_topic_0000001149807881_p13911353991"></a><a name="en-us_topic_0000001149807881_p13911353991"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="82.99%" id="mcps1.1.3.1.2"><p id="en-us_topic_0000001149807881_p193911531395"><a name="en-us_topic_0000001149807881_p193911531395"></a><a name="en-us_topic_0000001149807881_p193911531395"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row1339114531391"><td class="cellrowborder" valign="top" width="17.01%" headers="mcps1.1.3.1.1 "><p id="en-us_topic_0000001149807881_p1338931454713"><a name="en-us_topic_0000001149807881_p1338931454713"></a><a name="en-us_topic_0000001149807881_p1338931454713"></a><a href="#en-us_topic_0000001149807881_section8265143814015">AudioManager</a></p>
</td>
<td class="cellrowborder" valign="top" width="82.99%" headers="mcps1.1.3.1.2 "><p id="en-us_topic_0000001149807881_p1039217531898"><a name="en-us_topic_0000001149807881_p1039217531898"></a><a name="en-us_topic_0000001149807881_p1039217531898"></a>Audio manager</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
var audioManager = audio.getAudioManager();
```

## Enums<a name="en-us_topic_0000001149807881_section115029181495"></a>

## AudioVolumeType<a name="en-us_topic_0000001149807881_section92261857172218"></a>

Enumerates audio stream types.

<a name="en-us_topic_0000001149807881_table689215633911"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row19892165613399"><th class="cellrowborder" valign="top" width="30.380000000000003%" id="mcps1.1.4.1.1"><p id="en-us_topic_0000001149807881_p148924564394"><a name="en-us_topic_0000001149807881_p148924564394"></a><a name="en-us_topic_0000001149807881_p148924564394"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="9.950000000000001%" id="mcps1.1.4.1.2"><p id="en-us_topic_0000001149807881_aace9cae4ba0d4939bfa048460f61c3c7"><a name="en-us_topic_0000001149807881_aace9cae4ba0d4939bfa048460f61c3c7"></a><a name="en-us_topic_0000001149807881_aace9cae4ba0d4939bfa048460f61c3c7"></a>Default Value</p>
</th>
<th class="cellrowborder" valign="top" width="59.67%" id="mcps1.1.4.1.3"><p id="en-us_topic_0000001149807881_p19892145616392"><a name="en-us_topic_0000001149807881_p19892145616392"></a><a name="en-us_topic_0000001149807881_p19892145616392"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row1389215612395"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p52851329122117"><a name="en-us_topic_0000001149807881_p52851329122117"></a><a name="en-us_topic_0000001149807881_p52851329122117"></a>MEDIA</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p2282152962115"><a name="en-us_topic_0000001149807881_p2282152962115"></a><a name="en-us_topic_0000001149807881_p2282152962115"></a>1</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p328012293211"><a name="en-us_topic_0000001149807881_p328012293211"></a><a name="en-us_topic_0000001149807881_p328012293211"></a>Audio streams for media purpose</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row6892145616397"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p027662952110"><a name="en-us_topic_0000001149807881_p027662952110"></a><a name="en-us_topic_0000001149807881_p027662952110"></a>RINGTONE</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p17273229192113"><a name="en-us_topic_0000001149807881_p17273229192113"></a><a name="en-us_topic_0000001149807881_p17273229192113"></a>2</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p182452299212"><a name="en-us_topic_0000001149807881_p182452299212"></a><a name="en-us_topic_0000001149807881_p182452299212"></a>Audio streams for ring tones</p>
</td>
</tr>
</tbody>
</table>

## DeviceFlag<a name="en-us_topic_0000001149807881_section11285183164210"></a>

Enumerates audio device flags.

<a name="en-us_topic_0000001149807881_table162856320422"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row928593124213"><th class="cellrowborder" valign="top" width="30.380000000000003%" id="mcps1.1.4.1.1"><p id="en-us_topic_0000001149807881_p628553124216"><a name="en-us_topic_0000001149807881_p628553124216"></a><a name="en-us_topic_0000001149807881_p628553124216"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="9.950000000000001%" id="mcps1.1.4.1.2"><p id="en-us_topic_0000001149807881_p1828512314213"><a name="en-us_topic_0000001149807881_p1828512314213"></a><a name="en-us_topic_0000001149807881_p1828512314213"></a>Default Value</p>
</th>
<th class="cellrowborder" valign="top" width="59.67%" id="mcps1.1.4.1.3"><p id="en-us_topic_0000001149807881_p1228612334216"><a name="en-us_topic_0000001149807881_p1228612334216"></a><a name="en-us_topic_0000001149807881_p1228612334216"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row2286435427"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p19184101242511"><a name="en-us_topic_0000001149807881_p19184101242511"></a><a name="en-us_topic_0000001149807881_p19184101242511"></a>OUTPUT_DEVICES_FLAG</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p172861314213"><a name="en-us_topic_0000001149807881_p172861314213"></a><a name="en-us_topic_0000001149807881_p172861314213"></a>1</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p5286133134212"><a name="en-us_topic_0000001149807881_p5286133134212"></a><a name="en-us_topic_0000001149807881_p5286133134212"></a>Output devices</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row2286163194220"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p5514162412251"><a name="en-us_topic_0000001149807881_p5514162412251"></a><a name="en-us_topic_0000001149807881_p5514162412251"></a>INPUT_DEVICES_FLAG</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p112863354219"><a name="en-us_topic_0000001149807881_p112863354219"></a><a name="en-us_topic_0000001149807881_p112863354219"></a>2</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p1328617334214"><a name="en-us_topic_0000001149807881_p1328617334214"></a><a name="en-us_topic_0000001149807881_p1328617334214"></a>Input devices</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row10631228192520"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p1731716317259"><a name="en-us_topic_0000001149807881_p1731716317259"></a><a name="en-us_topic_0000001149807881_p1731716317259"></a>ALL_DEVICES_FLAG</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p1364628102517"><a name="en-us_topic_0000001149807881_p1364628102517"></a><a name="en-us_topic_0000001149807881_p1364628102517"></a>3</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p1864182814256"><a name="en-us_topic_0000001149807881_p1864182814256"></a><a name="en-us_topic_0000001149807881_p1864182814256"></a>All devices</p>
</td>
</tr>
</tbody>
</table>

## DeviceRole<a name="en-us_topic_0000001149807881_section380038142619"></a>

Enumerates device roles.

<a name="en-us_topic_0000001149807881_table48001786268"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row138007814267"><th class="cellrowborder" valign="top" width="30.380000000000003%" id="mcps1.1.4.1.1"><p id="en-us_topic_0000001149807881_p1980068112616"><a name="en-us_topic_0000001149807881_p1980068112616"></a><a name="en-us_topic_0000001149807881_p1980068112616"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="9.950000000000001%" id="mcps1.1.4.1.2"><p id="en-us_topic_0000001149807881_p28003819263"><a name="en-us_topic_0000001149807881_p28003819263"></a><a name="en-us_topic_0000001149807881_p28003819263"></a>Default Value</p>
</th>
<th class="cellrowborder" valign="top" width="59.67%" id="mcps1.1.4.1.3"><p id="en-us_topic_0000001149807881_p3800118112615"><a name="en-us_topic_0000001149807881_p3800118112615"></a><a name="en-us_topic_0000001149807881_p3800118112615"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row98008816264"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p1542334211265"><a name="en-us_topic_0000001149807881_p1542334211265"></a><a name="en-us_topic_0000001149807881_p1542334211265"></a>INPUT_DEVICE</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p98008852610"><a name="en-us_topic_0000001149807881_p98008852610"></a><a name="en-us_topic_0000001149807881_p98008852610"></a>1</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p118009817260"><a name="en-us_topic_0000001149807881_p118009817260"></a><a name="en-us_topic_0000001149807881_p118009817260"></a>Input role</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row680018802618"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p2011710479267"><a name="en-us_topic_0000001149807881_p2011710479267"></a><a name="en-us_topic_0000001149807881_p2011710479267"></a>OUTPUT_DEVICE</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p08009812613"><a name="en-us_topic_0000001149807881_p08009812613"></a><a name="en-us_topic_0000001149807881_p08009812613"></a>2</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p380020842611"><a name="en-us_topic_0000001149807881_p380020842611"></a><a name="en-us_topic_0000001149807881_p380020842611"></a>Output role</p>
</td>
</tr>
</tbody>
</table>

## DeviceType<a name="en-us_topic_0000001149807881_section11727420122710"></a>

Enumerates device types.

<a name="en-us_topic_0000001149807881_table67271020132718"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row4727122012711"><th class="cellrowborder" valign="top" width="30.380000000000003%" id="mcps1.1.4.1.1"><p id="en-us_topic_0000001149807881_p157271520152715"><a name="en-us_topic_0000001149807881_p157271520152715"></a><a name="en-us_topic_0000001149807881_p157271520152715"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="9.950000000000001%" id="mcps1.1.4.1.2"><p id="en-us_topic_0000001149807881_p187271620152719"><a name="en-us_topic_0000001149807881_p187271620152719"></a><a name="en-us_topic_0000001149807881_p187271620152719"></a>Default Value</p>
</th>
<th class="cellrowborder" valign="top" width="59.67%" id="mcps1.1.4.1.3"><p id="en-us_topic_0000001149807881_p772720201277"><a name="en-us_topic_0000001149807881_p772720201277"></a><a name="en-us_topic_0000001149807881_p772720201277"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row572714205272"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p1895057192713"><a name="en-us_topic_0000001149807881_p1895057192713"></a><a name="en-us_topic_0000001149807881_p1895057192713"></a>INVALID</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p772892012273"><a name="en-us_topic_0000001149807881_p772892012273"></a><a name="en-us_topic_0000001149807881_p772892012273"></a>0</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p137281920172712"><a name="en-us_topic_0000001149807881_p137281920172712"></a><a name="en-us_topic_0000001149807881_p137281920172712"></a>Invalid device</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row16728520192714"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p4753161132815"><a name="en-us_topic_0000001149807881_p4753161132815"></a><a name="en-us_topic_0000001149807881_p4753161132815"></a>SPEAKER</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p3728920162713"><a name="en-us_topic_0000001149807881_p3728920162713"></a><a name="en-us_topic_0000001149807881_p3728920162713"></a>1</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p17728112062715"><a name="en-us_topic_0000001149807881_p17728112062715"></a><a name="en-us_topic_0000001149807881_p17728112062715"></a>Speaker</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row1758117472814"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p74802011112815"><a name="en-us_topic_0000001149807881_p74802011112815"></a><a name="en-us_topic_0000001149807881_p74802011112815"></a>WIRED_HEADSET</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p35820462819"><a name="en-us_topic_0000001149807881_p35820462819"></a><a name="en-us_topic_0000001149807881_p35820462819"></a>2</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p155821548285"><a name="en-us_topic_0000001149807881_p155821548285"></a><a name="en-us_topic_0000001149807881_p155821548285"></a>Wired headset</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row1335108192818"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p107521514142811"><a name="en-us_topic_0000001149807881_p107521514142811"></a><a name="en-us_topic_0000001149807881_p107521514142811"></a>BLUETOOTH_SCO</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p18335108112819"><a name="en-us_topic_0000001149807881_p18335108112819"></a><a name="en-us_topic_0000001149807881_p18335108112819"></a>3</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p193351683289"><a name="en-us_topic_0000001149807881_p193351683289"></a><a name="en-us_topic_0000001149807881_p193351683289"></a>Bluetooth device using the synchronous connection oriented link (SCO)</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row1649111617286"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p10784017102818"><a name="en-us_topic_0000001149807881_p10784017102818"></a><a name="en-us_topic_0000001149807881_p10784017102818"></a>BLUETOOTH_A2DP</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p849110610286"><a name="en-us_topic_0000001149807881_p849110610286"></a><a name="en-us_topic_0000001149807881_p849110610286"></a>4</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p549117620284"><a name="en-us_topic_0000001149807881_p549117620284"></a><a name="en-us_topic_0000001149807881_p549117620284"></a>Bluetooth device using advanced audio distribution profile (A2DP)</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row81701220112812"><td class="cellrowborder" valign="top" width="30.380000000000003%" headers="mcps1.1.4.1.1 "><p id="en-us_topic_0000001149807881_p168642028152812"><a name="en-us_topic_0000001149807881_p168642028152812"></a><a name="en-us_topic_0000001149807881_p168642028152812"></a>MIC</p>
</td>
<td class="cellrowborder" valign="top" width="9.950000000000001%" headers="mcps1.1.4.1.2 "><p id="en-us_topic_0000001149807881_p517062012812"><a name="en-us_topic_0000001149807881_p517062012812"></a><a name="en-us_topic_0000001149807881_p517062012812"></a>5</p>
</td>
<td class="cellrowborder" valign="top" width="59.67%" headers="mcps1.1.4.1.3 "><p id="en-us_topic_0000001149807881_p5170520112813"><a name="en-us_topic_0000001149807881_p5170520112813"></a><a name="en-us_topic_0000001149807881_p5170520112813"></a>Microphone</p>
</td>
</tr>
</tbody>
</table>

## Appendixes<a name="en-us_topic_0000001149807881_section1933416317165"></a>

## AudioManager<a name="en-us_topic_0000001149807881_section8265143814015"></a>

Manages audio volume and audio device information.

### setVolume\(AudioVolumeType, number, AsyncCallback<void\>\)<a name="en-us_topic_0000001149807881_section189141826104616"></a>

Sets volume for a stream. This method uses an asynchronous callback to return the execution result.

**Parameters**

<a name="en-us_topic_0000001149807881_table11004831415"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row1510164861414"><th class="cellrowborder" valign="top" width="17.57%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p171154819142"><a name="en-us_topic_0000001149807881_p171154819142"></a><a name="en-us_topic_0000001149807881_p171154819142"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="19.52%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p121164815148"><a name="en-us_topic_0000001149807881_p121164815148"></a><a name="en-us_topic_0000001149807881_p121164815148"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p1351547105313"><a name="en-us_topic_0000001149807881_p1351547105313"></a><a name="en-us_topic_0000001149807881_p1351547105313"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="55.38999999999999%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p131114812144"><a name="en-us_topic_0000001149807881_p131114812144"></a><a name="en-us_topic_0000001149807881_p131114812144"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row911124881410"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p11184811420"><a name="en-us_topic_0000001149807881_p11184811420"></a><a name="en-us_topic_0000001149807881_p11184811420"></a>audioType</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p91134810142"><a name="en-us_topic_0000001149807881_p91134810142"></a><a name="en-us_topic_0000001149807881_p91134810142"></a><a href="#en-us_topic_0000001149807881_section92261857172218">AudioVolumeType</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p1751247115312"><a name="en-us_topic_0000001149807881_p1751247115312"></a><a name="en-us_topic_0000001149807881_p1751247115312"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p151134811149"><a name="en-us_topic_0000001149807881_p151134811149"></a><a name="en-us_topic_0000001149807881_p151134811149"></a>Audio stream type</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row1811164871417"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p141114817144"><a name="en-us_topic_0000001149807881_p141114817144"></a><a name="en-us_topic_0000001149807881_p141114817144"></a>volume</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p1511648151417"><a name="en-us_topic_0000001149807881_p1511648151417"></a><a name="en-us_topic_0000001149807881_p1511648151417"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p151947175314"><a name="en-us_topic_0000001149807881_p151947175314"></a><a name="en-us_topic_0000001149807881_p151947175314"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p16111548121411"><a name="en-us_topic_0000001149807881_p16111548121411"></a><a name="en-us_topic_0000001149807881_p16111548121411"></a>Volume to set</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row85121563158"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p175121965154"><a name="en-us_topic_0000001149807881_p175121965154"></a><a name="en-us_topic_0000001149807881_p175121965154"></a>callback</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p1851220691518"><a name="en-us_topic_0000001149807881_p1851220691518"></a><a name="en-us_topic_0000001149807881_p1851220691518"></a>AsyncCallback&lt;void&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p15134711532"><a name="en-us_topic_0000001149807881_p15134711532"></a><a name="en-us_topic_0000001149807881_p15134711532"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p751211651512"><a name="en-us_topic_0000001149807881_p751211651512"></a><a name="en-us_topic_0000001149807881_p751211651512"></a>Callback used to return whether the setting is successful</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
audioManager.setVolume(audio.AudioVolumeType.MEDIA, 30, (err)=>{
   if (err) {
	   console.error(`failed to set volume ${err.message}`);
	   return;
   }
   console.log(`Media setVolume successful callback`);
})
```

### setVolume\(AudioVolumeType, number\)<a name="en-us_topic_0000001149807881_section102021249114612"></a>

Sets volume for a stream. This method uses a promise to return the execution result.

**Parameters**

<a name="en-us_topic_0000001149807881_table20688181818176"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row1368810188176"><th class="cellrowborder" valign="top" width="17.599999999999998%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p5688818171712"><a name="en-us_topic_0000001149807881_p5688818171712"></a><a name="en-us_topic_0000001149807881_p5688818171712"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="19.49%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p8688118111719"><a name="en-us_topic_0000001149807881_p8688118111719"></a><a name="en-us_topic_0000001149807881_p8688118111719"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p1994792215711"><a name="en-us_topic_0000001149807881_p1994792215711"></a><a name="en-us_topic_0000001149807881_p1994792215711"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="55.38999999999999%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p12688151816173"><a name="en-us_topic_0000001149807881_p12688151816173"></a><a name="en-us_topic_0000001149807881_p12688151816173"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row0688518171714"><td class="cellrowborder" valign="top" width="17.599999999999998%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p1368820182174"><a name="en-us_topic_0000001149807881_p1368820182174"></a><a name="en-us_topic_0000001149807881_p1368820182174"></a>audioType</p>
</td>
<td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p116881518111712"><a name="en-us_topic_0000001149807881_p116881518111712"></a><a name="en-us_topic_0000001149807881_p116881518111712"></a><a href="#en-us_topic_0000001149807881_section92261857172218">AudioVolumeType</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p2094702218579"><a name="en-us_topic_0000001149807881_p2094702218579"></a><a name="en-us_topic_0000001149807881_p2094702218579"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p1688131812176"><a name="en-us_topic_0000001149807881_p1688131812176"></a><a name="en-us_topic_0000001149807881_p1688131812176"></a>Audio stream type</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row5688218131711"><td class="cellrowborder" valign="top" width="17.599999999999998%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p176881618181715"><a name="en-us_topic_0000001149807881_p176881618181715"></a><a name="en-us_topic_0000001149807881_p176881618181715"></a>volume</p>
</td>
<td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p5688201811720"><a name="en-us_topic_0000001149807881_p5688201811720"></a><a name="en-us_topic_0000001149807881_p5688201811720"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p79472226579"><a name="en-us_topic_0000001149807881_p79472226579"></a><a name="en-us_topic_0000001149807881_p79472226579"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p2688718171716"><a name="en-us_topic_0000001149807881_p2688718171716"></a><a name="en-us_topic_0000001149807881_p2688718171716"></a>Volume to set</p>
</td>
</tr>
</tbody>
</table>

**Return Values**

<a name="en-us_topic_0000001149807881_table106721328171713"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row9672122817176"><th class="cellrowborder" valign="top" width="26.06%" id="mcps1.1.3.1.1"><p id="en-us_topic_0000001149807881_p106728288171"><a name="en-us_topic_0000001149807881_p106728288171"></a><a name="en-us_topic_0000001149807881_p106728288171"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="73.94%" id="mcps1.1.3.1.2"><p id="en-us_topic_0000001149807881_p5672112817178"><a name="en-us_topic_0000001149807881_p5672112817178"></a><a name="en-us_topic_0000001149807881_p5672112817178"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row06721528191711"><td class="cellrowborder" valign="top" width="26.06%" headers="mcps1.1.3.1.1 "><p id="en-us_topic_0000001149807881_p107821612171919"><a name="en-us_topic_0000001149807881_p107821612171919"></a><a name="en-us_topic_0000001149807881_p107821612171919"></a>Promise&lt;void&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="73.94%" headers="mcps1.1.3.1.2 "><p id="en-us_topic_0000001149807881_p4672828141718"><a name="en-us_topic_0000001149807881_p4672828141718"></a><a name="en-us_topic_0000001149807881_p4672828141718"></a>Promise used to return whether the setting is successful</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
audioManager.setVolume(audio.AudioVolumeType.MEDIA, 30).then(()=>
    console.log(`Media setVolume successful callback`);
)
```

### getVolume\(AudioVolumeType, AsyncCallback<number\>\)<a name="en-us_topic_0000001149807881_section4387320194714"></a>

Obtains volume of a stream. This method uses an asynchronous callback to return the execution result.

**Parameters**

<a name="en-us_topic_0000001149807881_table44323134204"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row16433171322017"><th class="cellrowborder" valign="top" width="17.57%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p1943319132201"><a name="en-us_topic_0000001149807881_p1943319132201"></a><a name="en-us_topic_0000001149807881_p1943319132201"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="19.52%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p143314139203"><a name="en-us_topic_0000001149807881_p143314139203"></a><a name="en-us_topic_0000001149807881_p143314139203"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p1540765014581"><a name="en-us_topic_0000001149807881_p1540765014581"></a><a name="en-us_topic_0000001149807881_p1540765014581"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="55.38999999999999%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p10433181362011"><a name="en-us_topic_0000001149807881_p10433181362011"></a><a name="en-us_topic_0000001149807881_p10433181362011"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row4433913122010"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p54331513192018"><a name="en-us_topic_0000001149807881_p54331513192018"></a><a name="en-us_topic_0000001149807881_p54331513192018"></a>audioType</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p182075544714"><a name="en-us_topic_0000001149807881_p182075544714"></a><a name="en-us_topic_0000001149807881_p182075544714"></a><a href="#en-us_topic_0000001149807881_section92261857172218">AudioVolumeType</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p3407185013588"><a name="en-us_topic_0000001149807881_p3407185013588"></a><a name="en-us_topic_0000001149807881_p3407185013588"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p44331613142018"><a name="en-us_topic_0000001149807881_p44331613142018"></a><a name="en-us_topic_0000001149807881_p44331613142018"></a>Audio stream type</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row743331372014"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p143341319205"><a name="en-us_topic_0000001149807881_p143341319205"></a><a name="en-us_topic_0000001149807881_p143341319205"></a>callback</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p1043316137200"><a name="en-us_topic_0000001149807881_p1043316137200"></a><a name="en-us_topic_0000001149807881_p1043316137200"></a>AsyncCallback&lt;number&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p12659352195818"><a name="en-us_topic_0000001149807881_p12659352195818"></a><a name="en-us_topic_0000001149807881_p12659352195818"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p3433161313204"><a name="en-us_topic_0000001149807881_p3433161313204"></a><a name="en-us_topic_0000001149807881_p3433161313204"></a>Callback used to return the volume</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value)=>{
   if (err) {
	   console.error(`failed to get volume ${err.message}`);
	   return;
   }
   console.log(`Media getVolume successful callback`);
})
```

### getVolume\(AudioVolumeType\)<a name="en-us_topic_0000001149807881_section04121965119"></a>

Obtains the volume of a stream. This method uses a promise to return the execution result.

**Parameters**

<a name="en-us_topic_0000001149807881_table174341113202016"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row843416136203"><th class="cellrowborder" valign="top" width="17.57%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p143410134207"><a name="en-us_topic_0000001149807881_p143410134207"></a><a name="en-us_topic_0000001149807881_p143410134207"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="19.52%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p6434813182016"><a name="en-us_topic_0000001149807881_p6434813182016"></a><a name="en-us_topic_0000001149807881_p6434813182016"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p418721165918"><a name="en-us_topic_0000001149807881_p418721165918"></a><a name="en-us_topic_0000001149807881_p418721165918"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="55.38999999999999%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p943491320207"><a name="en-us_topic_0000001149807881_p943491320207"></a><a name="en-us_topic_0000001149807881_p943491320207"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row5434181312207"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p144343134206"><a name="en-us_topic_0000001149807881_p144343134206"></a><a name="en-us_topic_0000001149807881_p144343134206"></a>audioType</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p121741711487"><a name="en-us_topic_0000001149807881_p121741711487"></a><a name="en-us_topic_0000001149807881_p121741711487"></a><a href="#en-us_topic_0000001149807881_section92261857172218">AudioVolumeType</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p118791205914"><a name="en-us_topic_0000001149807881_p118791205914"></a><a name="en-us_topic_0000001149807881_p118791205914"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p6434613122010"><a name="en-us_topic_0000001149807881_p6434613122010"></a><a name="en-us_topic_0000001149807881_p6434613122010"></a>Audio stream type</p>
</td>
</tr>
</tbody>
</table>

**Return Values**

<a name="en-us_topic_0000001149807881_table11435101313201"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row9435191332013"><th class="cellrowborder" valign="top" width="25.97%" id="mcps1.1.3.1.1"><p id="en-us_topic_0000001149807881_p7435131352019"><a name="en-us_topic_0000001149807881_p7435131352019"></a><a name="en-us_topic_0000001149807881_p7435131352019"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="74.03%" id="mcps1.1.3.1.2"><p id="en-us_topic_0000001149807881_p343521362017"><a name="en-us_topic_0000001149807881_p343521362017"></a><a name="en-us_topic_0000001149807881_p343521362017"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row1143515137209"><td class="cellrowborder" valign="top" width="25.97%" headers="mcps1.1.3.1.1 "><p id="en-us_topic_0000001149807881_p3435171318201"><a name="en-us_topic_0000001149807881_p3435171318201"></a><a name="en-us_topic_0000001149807881_p3435171318201"></a>Promise&lt;number&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="74.03%" headers="mcps1.1.3.1.2 "><p id="en-us_topic_0000001149807881_p17435513102016"><a name="en-us_topic_0000001149807881_p17435513102016"></a><a name="en-us_topic_0000001149807881_p17435513102016"></a>Promise used to return stream volume</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
audioManager.getVolume(audio.AudioVolumeType.MEDIA).then((data)=>
    console.log(`Media getVolume successful callback`);
)
```

### getMinVolume\(AudioVolumeType, AsyncCallback<number\>\)<a name="en-us_topic_0000001149807881_section188714283511"></a>

Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the execution result.

**Parameters**

<a name="en-us_topic_0000001149807881_table9585157122219"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row95857713228"><th class="cellrowborder" valign="top" width="17.57%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p1358510710223"><a name="en-us_topic_0000001149807881_p1358510710223"></a><a name="en-us_topic_0000001149807881_p1358510710223"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="19.52%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p958577152214"><a name="en-us_topic_0000001149807881_p958577152214"></a><a name="en-us_topic_0000001149807881_p958577152214"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p12979171810590"><a name="en-us_topic_0000001149807881_p12979171810590"></a><a name="en-us_topic_0000001149807881_p12979171810590"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="55.38999999999999%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p85851579221"><a name="en-us_topic_0000001149807881_p85851579221"></a><a name="en-us_topic_0000001149807881_p85851579221"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row7585373227"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p105852712216"><a name="en-us_topic_0000001149807881_p105852712216"></a><a name="en-us_topic_0000001149807881_p105852712216"></a>audioType</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p1862714319487"><a name="en-us_topic_0000001149807881_p1862714319487"></a><a name="en-us_topic_0000001149807881_p1862714319487"></a><a href="#en-us_topic_0000001149807881_section92261857172218">AudioVolumeType</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p59791018125916"><a name="en-us_topic_0000001149807881_p59791018125916"></a><a name="en-us_topic_0000001149807881_p59791018125916"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p758517710222"><a name="en-us_topic_0000001149807881_p758517710222"></a><a name="en-us_topic_0000001149807881_p758517710222"></a>Audio stream type</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row165851718222"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p115866772214"><a name="en-us_topic_0000001149807881_p115866772214"></a><a name="en-us_topic_0000001149807881_p115866772214"></a>callback</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p558614719222"><a name="en-us_topic_0000001149807881_p558614719222"></a><a name="en-us_topic_0000001149807881_p558614719222"></a>AsyncCallback&lt;number&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p89791518185916"><a name="en-us_topic_0000001149807881_p89791518185916"></a><a name="en-us_topic_0000001149807881_p89791518185916"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p1958614711221"><a name="en-us_topic_0000001149807881_p1958614711221"></a><a name="en-us_topic_0000001149807881_p1958614711221"></a>Callback used to return the minimum volume</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
audioManager.getMinVolume(audio.AudioVolumeType.MEDIA, (err, value)=>{
   if (err) {
	   console.error(`failed to get minvolume ${err.message}`);
	   return;
   }
   console.log(`Media getMinVolume successful callback`);
})
```

### getMinVolume\(AudioVolumeType\)<a name="en-us_topic_0000001149807881_section41556389511"></a>

Obtains the minimum volume allowed for a stream. This method uses a promise to return the execution result.

**Parameters**

<a name="en-us_topic_0000001149807881_table558627102215"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row175868714227"><th class="cellrowborder" valign="top" width="17.57%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p1758619712217"><a name="en-us_topic_0000001149807881_p1758619712217"></a><a name="en-us_topic_0000001149807881_p1758619712217"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="19.52%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p12586776227"><a name="en-us_topic_0000001149807881_p12586776227"></a><a name="en-us_topic_0000001149807881_p12586776227"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p94861627165914"><a name="en-us_topic_0000001149807881_p94861627165914"></a><a name="en-us_topic_0000001149807881_p94861627165914"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="55.38999999999999%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p85862711223"><a name="en-us_topic_0000001149807881_p85862711223"></a><a name="en-us_topic_0000001149807881_p85862711223"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row65861477221"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p5586167172217"><a name="en-us_topic_0000001149807881_p5586167172217"></a><a name="en-us_topic_0000001149807881_p5586167172217"></a>audioType</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p592519511485"><a name="en-us_topic_0000001149807881_p592519511485"></a><a name="en-us_topic_0000001149807881_p592519511485"></a><a href="#en-us_topic_0000001149807881_section92261857172218">AudioVolumeType</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p2048622713593"><a name="en-us_topic_0000001149807881_p2048622713593"></a><a name="en-us_topic_0000001149807881_p2048622713593"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p135871079226"><a name="en-us_topic_0000001149807881_p135871079226"></a><a name="en-us_topic_0000001149807881_p135871079226"></a>Audio stream type</p>
</td>
</tr>
</tbody>
</table>

**Return Values**

<a name="en-us_topic_0000001149807881_table35874718223"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row1558718715227"><th class="cellrowborder" valign="top" width="26.02%" id="mcps1.1.3.1.1"><p id="en-us_topic_0000001149807881_p75871715226"><a name="en-us_topic_0000001149807881_p75871715226"></a><a name="en-us_topic_0000001149807881_p75871715226"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="73.98%" id="mcps1.1.3.1.2"><p id="en-us_topic_0000001149807881_p85871720225"><a name="en-us_topic_0000001149807881_p85871720225"></a><a name="en-us_topic_0000001149807881_p85871720225"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row1458710714221"><td class="cellrowborder" valign="top" width="26.02%" headers="mcps1.1.3.1.1 "><p id="en-us_topic_0000001149807881_p558737142218"><a name="en-us_topic_0000001149807881_p558737142218"></a><a name="en-us_topic_0000001149807881_p558737142218"></a>Promise&lt;number&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="73.98%" headers="mcps1.1.3.1.2 "><p id="en-us_topic_0000001149807881_p05878717229"><a name="en-us_topic_0000001149807881_p05878717229"></a><a name="en-us_topic_0000001149807881_p05878717229"></a>Promise used to return the minimum volume</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
audioManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((data)=>
    console.log(`Media getMinVolume successful callback`);
)
```

### getMaxVolume\(AudioVolumeType, AsyncCallback<number\>\)<a name="en-us_topic_0000001149807881_section690395418516"></a>

Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the execution result.

**Parameters**

<a name="en-us_topic_0000001149807881_table7210144262214"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row7210104242215"><th class="cellrowborder" valign="top" width="17.57%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p521018428221"><a name="en-us_topic_0000001149807881_p521018428221"></a><a name="en-us_topic_0000001149807881_p521018428221"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="19.52%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p102107424223"><a name="en-us_topic_0000001149807881_p102107424223"></a><a name="en-us_topic_0000001149807881_p102107424223"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p167531439593"><a name="en-us_topic_0000001149807881_p167531439593"></a><a name="en-us_topic_0000001149807881_p167531439593"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="55.38999999999999%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p1521054292218"><a name="en-us_topic_0000001149807881_p1521054292218"></a><a name="en-us_topic_0000001149807881_p1521054292218"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row321010428228"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p5210642132212"><a name="en-us_topic_0000001149807881_p5210642132212"></a><a name="en-us_topic_0000001149807881_p5210642132212"></a>audioType</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p35691288487"><a name="en-us_topic_0000001149807881_p35691288487"></a><a name="en-us_topic_0000001149807881_p35691288487"></a><a href="#en-us_topic_0000001149807881_section92261857172218">AudioVolumeType</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p14753114317590"><a name="en-us_topic_0000001149807881_p14753114317590"></a><a name="en-us_topic_0000001149807881_p14753114317590"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p8210242112217"><a name="en-us_topic_0000001149807881_p8210242112217"></a><a name="en-us_topic_0000001149807881_p8210242112217"></a>Audio stream type</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row82115429227"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p4211842132218"><a name="en-us_topic_0000001149807881_p4211842132218"></a><a name="en-us_topic_0000001149807881_p4211842132218"></a>callback</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p8211114232217"><a name="en-us_topic_0000001149807881_p8211114232217"></a><a name="en-us_topic_0000001149807881_p8211114232217"></a>AsyncCallback&lt;number&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p1275384315910"><a name="en-us_topic_0000001149807881_p1275384315910"></a><a name="en-us_topic_0000001149807881_p1275384315910"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p1621114282212"><a name="en-us_topic_0000001149807881_p1621114282212"></a><a name="en-us_topic_0000001149807881_p1621114282212"></a>Callback used to return the maximum volume</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA, (err, value)=>{
   if (err) {
	   console.error(`failed to get maxvolume ${err.message}`);
	   return;
   }
   console.log(`Media getMaxVolume successful callback`);
})
```

### getMaxVolume\(AudioVolumeType\)<a name="en-us_topic_0000001149807881_section155151345217"></a>

Obtains the maximum volume allowed for a stream. This method uses a promise to return the execution result.

**Parameters**

<a name="en-us_topic_0000001149807881_table11211104210226"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row42111424228"><th class="cellrowborder" valign="top" width="17.57%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p14211842162217"><a name="en-us_topic_0000001149807881_p14211842162217"></a><a name="en-us_topic_0000001149807881_p14211842162217"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="19.52%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p7211184211223"><a name="en-us_topic_0000001149807881_p7211184211223"></a><a name="en-us_topic_0000001149807881_p7211184211223"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p165812523592"><a name="en-us_topic_0000001149807881_p165812523592"></a><a name="en-us_topic_0000001149807881_p165812523592"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="55.38999999999999%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p821164232217"><a name="en-us_topic_0000001149807881_p821164232217"></a><a name="en-us_topic_0000001149807881_p821164232217"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row22111742112216"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p152121542152218"><a name="en-us_topic_0000001149807881_p152121542152218"></a><a name="en-us_topic_0000001149807881_p152121542152218"></a>audioType</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p9479411164814"><a name="en-us_topic_0000001149807881_p9479411164814"></a><a name="en-us_topic_0000001149807881_p9479411164814"></a><a href="#en-us_topic_0000001149807881_section92261857172218">AudioVolumeType</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p45811752165910"><a name="en-us_topic_0000001149807881_p45811752165910"></a><a name="en-us_topic_0000001149807881_p45811752165910"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p1021294292216"><a name="en-us_topic_0000001149807881_p1021294292216"></a><a name="en-us_topic_0000001149807881_p1021294292216"></a>Audio stream type</p>
</td>
</tr>
</tbody>
</table>

**Return Values**

<a name="en-us_topic_0000001149807881_table621215425220"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row3212842112215"><th class="cellrowborder" valign="top" width="26.02%" id="mcps1.1.3.1.1"><p id="en-us_topic_0000001149807881_p521274272216"><a name="en-us_topic_0000001149807881_p521274272216"></a><a name="en-us_topic_0000001149807881_p521274272216"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="73.98%" id="mcps1.1.3.1.2"><p id="en-us_topic_0000001149807881_p1121214215221"><a name="en-us_topic_0000001149807881_p1121214215221"></a><a name="en-us_topic_0000001149807881_p1121214215221"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row12121442192216"><td class="cellrowborder" valign="top" width="26.02%" headers="mcps1.1.3.1.1 "><p id="en-us_topic_0000001149807881_p72128426221"><a name="en-us_topic_0000001149807881_p72128426221"></a><a name="en-us_topic_0000001149807881_p72128426221"></a>Promise&lt;number&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="73.98%" headers="mcps1.1.3.1.2 "><p id="en-us_topic_0000001149807881_p4212114210226"><a name="en-us_topic_0000001149807881_p4212114210226"></a><a name="en-us_topic_0000001149807881_p4212114210226"></a>Promise used to return the maximum volume</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data)=>
    console.log(`Media getMaxVolume successful callback`);
)
```

### getDevices\(DeviceFlag, AsyncCallback<AudioDeviceDescriptors\>\)<a name="en-us_topic_0000001149807881_section11536182020523"></a>

Obtains the audio devices of a specified flag. This method uses an asynchronous callback to return the execution result.

**Parameters**

<a name="en-us_topic_0000001149807881_table8653191616249"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row165412169245"><th class="cellrowborder" valign="top" width="17.57%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p1665412161243"><a name="en-us_topic_0000001149807881_p1665412161243"></a><a name="en-us_topic_0000001149807881_p1665412161243"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="26.26%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p1765491672417"><a name="en-us_topic_0000001149807881_p1765491672417"></a><a name="en-us_topic_0000001149807881_p1765491672417"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p113067111209"><a name="en-us_topic_0000001149807881_p113067111209"></a><a name="en-us_topic_0000001149807881_p113067111209"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="48.65%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p765431682419"><a name="en-us_topic_0000001149807881_p765431682419"></a><a name="en-us_topic_0000001149807881_p765431682419"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row1654191652419"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p126549165241"><a name="en-us_topic_0000001149807881_p126549165241"></a><a name="en-us_topic_0000001149807881_p126549165241"></a>deviceFlag</p>
</td>
<td class="cellrowborder" valign="top" width="26.26%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p8654141622416"><a name="en-us_topic_0000001149807881_p8654141622416"></a><a name="en-us_topic_0000001149807881_p8654141622416"></a><a href="#en-us_topic_0000001149807881_section11285183164210">DeviceFlag</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p830651111019"><a name="en-us_topic_0000001149807881_p830651111019"></a><a name="en-us_topic_0000001149807881_p830651111019"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="48.65%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p10654131616248"><a name="en-us_topic_0000001149807881_p10654131616248"></a><a name="en-us_topic_0000001149807881_p10654131616248"></a>Audio device flag</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row16544162243"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p176541316122412"><a name="en-us_topic_0000001149807881_p176541316122412"></a><a name="en-us_topic_0000001149807881_p176541316122412"></a>callback</p>
</td>
<td class="cellrowborder" valign="top" width="26.26%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p1565461620244"><a name="en-us_topic_0000001149807881_p1565461620244"></a><a name="en-us_topic_0000001149807881_p1565461620244"></a>AsyncCallback&lt;<a href="#en-us_topic_0000001149807881_section5181155710523">AudioDeviceDescriptors</a>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p2307711908"><a name="en-us_topic_0000001149807881_p2307711908"></a><a name="en-us_topic_0000001149807881_p2307711908"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="48.65%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p19654141672416"><a name="en-us_topic_0000001149807881_p19654141672416"></a><a name="en-us_topic_0000001149807881_p19654141672416"></a>Callback used to return the device list</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value)=>{
   if (err) {
	   console.error(`failed to get getdevices ${err.message}`);
	   return;
   }
   console.log(`Media getDevices successful callback`);
})
```

### getDevices\(DeviceFlag\)<a name="en-us_topic_0000001149807881_section181733125210"></a>

Obtains the audio devices with a specified flag. This method uses a promise to return the execution result.

**Parameters**

<a name="en-us_topic_0000001149807881_table17655516132411"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row4655616192414"><th class="cellrowborder" valign="top" width="17.57%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p1465518164247"><a name="en-us_topic_0000001149807881_p1465518164247"></a><a name="en-us_topic_0000001149807881_p1465518164247"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="19.52%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p196551316172415"><a name="en-us_topic_0000001149807881_p196551316172415"></a><a name="en-us_topic_0000001149807881_p196551316172415"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p13161629902"><a name="en-us_topic_0000001149807881_p13161629902"></a><a name="en-us_topic_0000001149807881_p13161629902"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="55.38999999999999%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p17655616102417"><a name="en-us_topic_0000001149807881_p17655616102417"></a><a name="en-us_topic_0000001149807881_p17655616102417"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row13656111662415"><td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p2092935211270"><a name="en-us_topic_0000001149807881_p2092935211270"></a><a name="en-us_topic_0000001149807881_p2092935211270"></a>deviceFlag</p>
</td>
<td class="cellrowborder" valign="top" width="19.52%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p88719299489"><a name="en-us_topic_0000001149807881_p88719299489"></a><a name="en-us_topic_0000001149807881_p88719299489"></a><a href="#en-us_topic_0000001149807881_section11285183164210">DeviceFlag</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p12161129209"><a name="en-us_topic_0000001149807881_p12161129209"></a><a name="en-us_topic_0000001149807881_p12161129209"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.38999999999999%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p1692985222710"><a name="en-us_topic_0000001149807881_p1692985222710"></a><a name="en-us_topic_0000001149807881_p1692985222710"></a>Audio device flag</p>
</td>
</tr>
</tbody>
</table>

**Return Values**

<a name="en-us_topic_0000001149807881_table565618166249"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row19656151662410"><th class="cellrowborder" valign="top" width="26.02%" id="mcps1.1.3.1.1"><p id="en-us_topic_0000001149807881_p15656916152415"><a name="en-us_topic_0000001149807881_p15656916152415"></a><a name="en-us_topic_0000001149807881_p15656916152415"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="73.98%" id="mcps1.1.3.1.2"><p id="en-us_topic_0000001149807881_p365641616247"><a name="en-us_topic_0000001149807881_p365641616247"></a><a name="en-us_topic_0000001149807881_p365641616247"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row665681617243"><td class="cellrowborder" valign="top" width="26.02%" headers="mcps1.1.3.1.1 "><p id="en-us_topic_0000001149807881_p5673192162816"><a name="en-us_topic_0000001149807881_p5673192162816"></a><a name="en-us_topic_0000001149807881_p5673192162816"></a>Promise&lt;<a href="#en-us_topic_0000001149807881_section5181155710523">AudioDeviceDescriptors</a>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="73.98%" headers="mcps1.1.3.1.2 "><p id="en-us_topic_0000001149807881_p765751610249"><a name="en-us_topic_0000001149807881_p765751610249"></a><a name="en-us_topic_0000001149807881_p765751610249"></a>Promise used to return the obtained device list</p>
</td>
</tr>
</tbody>
</table>

**Example**

```
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=>
    console.log(`Media getDevices successful callback`);
)
```

## AudioDeviceDescriptor<a name="en-us_topic_0000001149807881_section17427121913310"></a>

Describes audio devices.

<a name="en-us_topic_0000001149807881_table5702164473415"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row97021944203413"><th class="cellrowborder" valign="top" width="17.378262173782623%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001149807881_p1610322561817"><a name="en-us_topic_0000001149807881_p1610322561817"></a><a name="en-us_topic_0000001149807881_p1610322561817"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="21.547845215478453%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001149807881_p177024446340"><a name="en-us_topic_0000001149807881_p177024446340"></a><a name="en-us_topic_0000001149807881_p177024446340"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.519248075192481%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001149807881_p1103172518188"><a name="en-us_topic_0000001149807881_p1103172518188"></a><a name="en-us_topic_0000001149807881_p1103172518188"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="53.554644535546444%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001149807881_p570274410345"><a name="en-us_topic_0000001149807881_p570274410345"></a><a name="en-us_topic_0000001149807881_p570274410345"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row1770204412344"><td class="cellrowborder" valign="top" width="17.378262173782623%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p116764916367"><a name="en-us_topic_0000001149807881_p116764916367"></a><a name="en-us_topic_0000001149807881_p116764916367"></a>deviceRole</p>
</td>
<td class="cellrowborder" valign="top" width="21.547845215478453%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p1710432543618"><a name="en-us_topic_0000001149807881_p1710432543618"></a><a name="en-us_topic_0000001149807881_p1710432543618"></a><a href="#en-us_topic_0000001149807881_section380038142619">DeviceRole</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.519248075192481%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p14435512251"><a name="en-us_topic_0000001149807881_p14435512251"></a><a name="en-us_topic_0000001149807881_p14435512251"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="53.554644535546444%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p8703114411348"><a name="en-us_topic_0000001149807881_p8703114411348"></a><a name="en-us_topic_0000001149807881_p8703114411348"></a>Audio device role</p>
</td>
</tr>
<tr id="en-us_topic_0000001149807881_row370314447340"><td class="cellrowborder" valign="top" width="17.378262173782623%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001149807881_p32441814173618"><a name="en-us_topic_0000001149807881_p32441814173618"></a><a name="en-us_topic_0000001149807881_p32441814173618"></a>deviceType</p>
</td>
<td class="cellrowborder" valign="top" width="21.547845215478453%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001149807881_p654132923620"><a name="en-us_topic_0000001149807881_p654132923620"></a><a name="en-us_topic_0000001149807881_p654132923620"></a><a href="#en-us_topic_0000001149807881_section11727420122710">DeviceType</a></p>
</td>
<td class="cellrowborder" valign="top" width="7.519248075192481%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001149807881_p44475515256"><a name="en-us_topic_0000001149807881_p44475515256"></a><a name="en-us_topic_0000001149807881_p44475515256"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="53.554644535546444%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001149807881_p207031344133411"><a name="en-us_topic_0000001149807881_p207031344133411"></a><a name="en-us_topic_0000001149807881_p207031344133411"></a>Audio device type</p>
</td>
</tr>
</tbody>
</table>

## AudioDeviceDescriptors<a name="en-us_topic_0000001149807881_section5181155710523"></a>

<a name="en-us_topic_0000001149807881_table169751229266"></a>
<table><thead align="left"><tr id="en-us_topic_0000001149807881_row169757224268"><th class="cellrowborder" valign="top" width="19.7%" id="mcps1.1.3.1.1"><p id="en-us_topic_0000001149807881_p19975182202612"><a name="en-us_topic_0000001149807881_p19975182202612"></a><a name="en-us_topic_0000001149807881_p19975182202612"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="80.30000000000001%" id="mcps1.1.3.1.2"><p id="en-us_topic_0000001149807881_p109751622132611"><a name="en-us_topic_0000001149807881_p109751622132611"></a><a name="en-us_topic_0000001149807881_p109751622132611"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001149807881_row169751322182613"><td class="cellrowborder" valign="top" width="19.7%" headers="mcps1.1.3.1.1 "><p id="en-us_topic_0000001149807881_p139751522182616"><a name="en-us_topic_0000001149807881_p139751522182616"></a><a name="en-us_topic_0000001149807881_p139751522182616"></a>Device property queue</p>
</td>
<td class="cellrowborder" valign="top" width="80.30000000000001%" headers="mcps1.1.3.1.2 "><p id="en-us_topic_0000001149807881_p597532272616"><a name="en-us_topic_0000001149807881_p597532272616"></a><a name="en-us_topic_0000001149807881_p597532272616"></a>A queue of <strong id="en-us_topic_0000001149807881_b12615715612"><a name="en-us_topic_0000001149807881_b12615715612"></a><a name="en-us_topic_0000001149807881_b12615715612"></a>AudioDeviceDescriptor</strong>, which is read-only.</p>
</td>
</tr>
</tbody>
</table>