1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit AudioKit 19 */ 20 21import { ErrorCallback, AsyncCallback, Callback } from './@ohos.base'; 22 23/** 24 * @namespace audio 25 * @since 7 26 */ 27/** 28 * @namespace audio 29 * @syscap SystemCapability.Multimedia.Audio.Core 30 * @crossplatform 31 * @atomicservice 32 * @since 12 33 */ 34declare namespace audio { 35 /** 36 * Enumerates audio errors. 37 * @enum { number } 38 * @syscap SystemCapability.Multimedia.Audio.Core 39 * @since 9 40 */ 41 /** 42 * Enumerates audio errors. 43 * @enum { number } 44 * @syscap SystemCapability.Multimedia.Audio.Core 45 * @crossplatform 46 * @since 12 47 */ 48 enum AudioErrors { 49 /** 50 * Invalid parameter. 51 * @syscap SystemCapability.Multimedia.Audio.Core 52 * @since 9 53 */ 54 /** 55 * Invalid parameter. 56 * @syscap SystemCapability.Multimedia.Audio.Core 57 * @crossplatform 58 * @since 12 59 */ 60 ERROR_INVALID_PARAM = 6800101, 61 /** 62 * Allocate memory failed. 63 * @syscap SystemCapability.Multimedia.Audio.Core 64 * @since 9 65 */ 66 /** 67 * Allocate memory failed. 68 * @syscap SystemCapability.Multimedia.Audio.Core 69 * @crossplatform 70 * @since 12 71 */ 72 ERROR_NO_MEMORY = 6800102, 73 /** 74 * Operation not permit at current state. 75 * @syscap SystemCapability.Multimedia.Audio.Core 76 * @since 9 77 */ 78 /** 79 * Operation not permit at current state. 80 * @syscap SystemCapability.Multimedia.Audio.Core 81 * @crossplatform 82 * @since 12 83 */ 84 ERROR_ILLEGAL_STATE = 6800103, 85 /** 86 * Unsupported option. 87 * @syscap SystemCapability.Multimedia.Audio.Core 88 * @since 9 89 */ 90 /** 91 * Unsupported option. 92 * @syscap SystemCapability.Multimedia.Audio.Core 93 * @crossplatform 94 * @since 12 95 */ 96 ERROR_UNSUPPORTED = 6800104, 97 /** 98 * Time out. 99 * @syscap SystemCapability.Multimedia.Audio.Core 100 * @since 9 101 */ 102 ERROR_TIMEOUT = 6800105, 103 /** 104 * Audio specific errors. 105 * @syscap SystemCapability.Multimedia.Audio.Core 106 * @since 9 107 */ 108 ERROR_STREAM_LIMIT = 6800201, 109 /** 110 * Default error. 111 * @syscap SystemCapability.Multimedia.Audio.Core 112 * @since 9 113 */ 114 /** 115 * Default error. 116 * @syscap SystemCapability.Multimedia.Audio.Core 117 * @crossplatform 118 * @since 12 119 */ 120 ERROR_SYSTEM = 6800301 121 } 122 123 /** 124 * Define local device network id for audio 125 * @syscap SystemCapability.Multimedia.Audio.Device 126 * @systemapi 127 * @since 9 128 */ 129 const LOCAL_NETWORK_ID: string; 130 131 /** 132 * Define default volume group id for audio 133 * @syscap SystemCapability.Multimedia.Audio.Volume 134 * @since 9 135 */ 136 /** 137 * Define default volume group id for audio 138 * @syscap SystemCapability.Multimedia.Audio.Volume 139 * @crossplatform 140 * @since 12 141 */ 142 const DEFAULT_VOLUME_GROUP_ID: number; 143 144 /** 145 * Define default interrupt group id for audio 146 * @syscap SystemCapability.Multimedia.Audio.Interrupt 147 * @since 9 148 */ 149 const DEFAULT_INTERRUPT_GROUP_ID: number; 150 151 /** 152 * Obtains an {@link AudioManager} instance. 153 * @returns { AudioManager } this {@link AudioManager} object. 154 * @syscap SystemCapability.Multimedia.Audio.Core 155 * @since 7 156 */ 157 /** 158 * Obtains an {@link AudioManager} instance. 159 * @returns { AudioManager } this {@link AudioManager} object. 160 * @syscap SystemCapability.Multimedia.Audio.Core 161 * @crossplatform 162 * @since 12 163 */ 164 function getAudioManager(): AudioManager; 165 166 /** 167 * Obtains an {@link AudioCapturer} instance. 168 * Success: This method uses an asynchronous callback to return the capturer instance. 169 * Failure: This method uses an asynchronous callback to return the error instance. Possible causes: 170 * 6800301: Parameter verification failed, Permission denied, System error; 171 * 6800101: Mandatory parameters are left unspecified, Incorrect parameter types. 172 * @param { AudioCapturerOptions } options - Capturer configurations. 173 * @param { AsyncCallback<AudioCapturer> } callback - Callback used to return the audio capturer instance. 174 * @syscap SystemCapability.Multimedia.Audio.Capturer 175 * @since 8 176 */ 177 /** 178 * Obtains an {@link AudioCapturer} instance. This method uses an asynchronous callback to return the capturer instance. 179 * @param { AudioCapturerOptions } options - Capturer configurations. 180 * @param { AsyncCallback<AudioCapturer> } callback - Callback used to return the audio capturer instance. 181 * @syscap SystemCapability.Multimedia.Audio.Capturer 182 * @crossplatform 183 * @since 12 184 */ 185 function createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback<AudioCapturer>): void; 186 187 /** 188 * Obtains an {@link AudioCapturer} instance. 189 * Success: This method uses a promise to return the capturer instance. 190 * Failure: This method uses a promise to return the error instance. Possible causes: 191 * 6800301: Parameter verification failed, Permission denied, System error; 192 * 6800101: Mandatory parameters are left unspecified, Incorrect parameter types. 193 * @param { AudioCapturerOptions } options - Capturer configurations. 194 * @returns { Promise<AudioCapturer> } Promise used to return the audio capturer instance. 195 * @syscap SystemCapability.Multimedia.Audio.Capturer 196 * @since 8 197 */ 198 /** 199 * Obtains an {@link AudioCapturer} instance. This method uses a promise to return the capturer instance. 200 * @param { AudioCapturerOptions } options - Capturer configurations. 201 * @returns { Promise<AudioCapturer> } Promise used to return the audio capturer instance. 202 * @syscap SystemCapability.Multimedia.Audio.Capturer 203 * @crossplatform 204 * @since 12 205 */ 206 function createAudioCapturer(options: AudioCapturerOptions): Promise<AudioCapturer>; 207 208 /** 209 * Obtains an {@link AudioRenderer} instance. This method uses an asynchronous callback to return the renderer instance. 210 * @param { AudioRendererOptions } options - Renderer configurations. 211 * @param { AsyncCallback<AudioRenderer> } callback - Callback used to return the audio renderer instance. 212 * @syscap SystemCapability.Multimedia.Audio.Renderer 213 * @since 8 214 */ 215 /** 216 * Obtains an {@link AudioRenderer} instance. This method uses an asynchronous callback to return the renderer instance. 217 * @param { AudioRendererOptions } options - Renderer configurations. 218 * @param { AsyncCallback<AudioRenderer> } callback - Callback used to return the audio renderer instance. 219 * @syscap SystemCapability.Multimedia.Audio.Renderer 220 * @crossplatform 221 * @since 12 222 */ 223 function createAudioRenderer(options: AudioRendererOptions, callback: AsyncCallback<AudioRenderer>): void; 224 225 /** 226 * Obtains an {@link AudioRenderer} instance. This method uses a promise to return the renderer instance. 227 * @param { AudioRendererOptions } options - Renderer configurations. 228 * @returns { Promise<AudioRenderer> } Promise used to return the audio renderer instance. 229 * @syscap SystemCapability.Multimedia.Audio.Renderer 230 * @since 8 231 */ 232 /** 233 * Obtains an {@link AudioRenderer} instance. This method uses a promise to return the renderer instance. 234 * @param { AudioRendererOptions } options - Renderer configurations. 235 * @returns { Promise<AudioRenderer> } Promise used to return the audio renderer instance. 236 * @syscap SystemCapability.Multimedia.Audio.Renderer 237 * @crossplatform 238 * @since 12 239 */ 240 function createAudioRenderer(options: AudioRendererOptions): Promise<AudioRenderer>; 241 242 /** 243 * Obtains a {@link TonePlayer} instance. This method uses an asynchronous callback to return the renderer instance. 244 * @param { AudioRendererInfo } options - Tone playing attribute. 245 * @param { AsyncCallback<TonePlayer> } callback - Callback used to return the tonePlayer instance. 246 * @syscap SystemCapability.Multimedia.Audio.Tone 247 * @systemapi 248 * @since 9 249 */ 250 function createTonePlayer(options: AudioRendererInfo, callback: AsyncCallback<TonePlayer>): void; 251 252 /** 253 * Obtains a {@link TonePlayer} instance. This method uses a promise to return the renderer instance. 254 * @param { AudioRendererInfo } options - Tone playing attribute. 255 * @returns { Promise<TonePlayer> } Promise used to return the tonePlayer instance. 256 * @syscap SystemCapability.Multimedia.Audio.Tone 257 * @systemapi 258 * @since 9 259 */ 260 function createTonePlayer(options: AudioRendererInfo): Promise<TonePlayer>; 261 262 /** 263 * Enumerates the audio states. 264 * @enum { number } 265 * @syscap SystemCapability.Multimedia.Audio.Core 266 * @since 8 267 */ 268 /** 269 * Enumerates the audio states. 270 * @enum { number } 271 * @syscap SystemCapability.Multimedia.Audio.Core 272 * @crossplatform 273 * @since 12 274 */ 275 enum AudioState { 276 /** 277 * Invalid state. 278 * @syscap SystemCapability.Multimedia.Audio.Core 279 * @since 8 280 */ 281 /** 282 * Invalid state. 283 * @syscap SystemCapability.Multimedia.Audio.Core 284 * @crossplatform 285 * @since 12 286 */ 287 STATE_INVALID = -1, 288 /** 289 * Create new instance state. 290 * @syscap SystemCapability.Multimedia.Audio.Core 291 * @since 8 292 */ 293 /** 294 * Create new instance state. 295 * @syscap SystemCapability.Multimedia.Audio.Core 296 * @crossplatform 297 * @since 12 298 */ 299 STATE_NEW = 0, 300 /** 301 * Prepared state. 302 * @syscap SystemCapability.Multimedia.Audio.Core 303 * @since 8 304 */ 305 /** 306 * Prepared state. 307 * @syscap SystemCapability.Multimedia.Audio.Core 308 * @crossplatform 309 * @since 12 310 */ 311 STATE_PREPARED = 1, 312 /** 313 * Running state. 314 * @syscap SystemCapability.Multimedia.Audio.Core 315 * @since 8 316 */ 317 /** 318 * Running state. 319 * @syscap SystemCapability.Multimedia.Audio.Core 320 * @crossplatform 321 * @since 12 322 */ 323 STATE_RUNNING = 2, 324 /** 325 * Stopped state. 326 * @syscap SystemCapability.Multimedia.Audio.Core 327 * @since 8 328 */ 329 /** 330 * Stopped state. 331 * @syscap SystemCapability.Multimedia.Audio.Core 332 * @crossplatform 333 * @since 12 334 */ 335 STATE_STOPPED = 3, 336 /** 337 * Released state. 338 * @syscap SystemCapability.Multimedia.Audio.Core 339 * @since 8 340 */ 341 /** 342 * Released state. 343 * @syscap SystemCapability.Multimedia.Audio.Core 344 * @crossplatform 345 * @since 12 346 */ 347 STATE_RELEASED = 4, 348 /** 349 * Paused state. 350 * @syscap SystemCapability.Multimedia.Audio.Core 351 * @since 8 352 */ 353 /** 354 * Paused state. 355 * @syscap SystemCapability.Multimedia.Audio.Core 356 * @crossplatform 357 * @since 12 358 */ 359 STATE_PAUSED = 5 360 } 361 362 /** 363 * Enumerates audio stream types. 364 * @enum { number } 365 * @syscap SystemCapability.Multimedia.Audio.Volume 366 * @since 7 367 */ 368 /** 369 * Enumerates audio stream types. 370 * @enum { number } 371 * @syscap SystemCapability.Multimedia.Audio.Volume 372 * @crossplatform 373 * @since 12 374 */ 375 enum AudioVolumeType { 376 /** 377 * Audio streams for voice calls. 378 * @syscap SystemCapability.Multimedia.Audio.Volume 379 * @since 8 380 */ 381 /** 382 * Audio streams for voice calls. 383 * @syscap SystemCapability.Multimedia.Audio.Volume 384 * @crossplatform 385 * @since 12 386 */ 387 VOICE_CALL = 0, 388 /** 389 * Audio streams for ringtones. 390 * @syscap SystemCapability.Multimedia.Audio.Volume 391 * @since 7 392 */ 393 /** 394 * Audio streams for ringtones. 395 * @syscap SystemCapability.Multimedia.Audio.Volume 396 * @crossplatform 397 * @since 12 398 */ 399 RINGTONE = 2, 400 /** 401 * Audio streams for media purpose. 402 * @syscap SystemCapability.Multimedia.Audio.Volume 403 * @since 7 404 */ 405 /** 406 * Audio streams for media purpose. 407 * @syscap SystemCapability.Multimedia.Audio.Volume 408 * @crossplatform 409 * @since 12 410 */ 411 MEDIA = 3, 412 /** 413 * Audio volume for alarm purpose. 414 * @syscap SystemCapability.Multimedia.Audio.Volume 415 * @since 10 416 */ 417 /** 418 * Audio volume for alarm purpose. 419 * @syscap SystemCapability.Multimedia.Audio.Volume 420 * @crossplatform 421 * @since 12 422 */ 423 ALARM = 4, 424 /** 425 * Audio volume for accessibility purpose. 426 * @syscap SystemCapability.Multimedia.Audio.Volume 427 * @since 10 428 */ 429 /** 430 * Audio volume for accessibility purpose. 431 * @syscap SystemCapability.Multimedia.Audio.Volume 432 * @crossplatform 433 * @since 12 434 */ 435 ACCESSIBILITY = 5, 436 /** 437 * Audio stream for voice assistant. 438 * @syscap SystemCapability.Multimedia.Audio.Volume 439 * @since 8 440 */ 441 VOICE_ASSISTANT = 9, 442 /** 443 * Audio volume for ultrasonic. 444 * @syscap SystemCapability.Multimedia.Audio.Volume 445 * @systemapi 446 * @since 10 447 */ 448 ULTRASONIC = 10, 449 /** 450 * Audio stream for all common. 451 * @syscap SystemCapability.Multimedia.Audio.Volume 452 * @systemapi 453 * @since 9 454 */ 455 ALL = 100, 456 } 457 458 /** 459 * Enumerates audio device flags. 460 * @enum { number } 461 * @syscap SystemCapability.Multimedia.Audio.Device 462 * @since 7 463 */ 464 /** 465 * Enumerates audio device flags. 466 * @enum { number } 467 * @syscap SystemCapability.Multimedia.Audio.Device 468 * @crossplatform 469 * @since 12 470 */ 471 enum DeviceFlag { 472 /** 473 * None devices. 474 * @syscap SystemCapability.Multimedia.Audio.Device 475 * @systemapi 476 * @since 9 477 */ 478 NONE_DEVICES_FLAG = 0, 479 /** 480 * Output devices. 481 * @syscap SystemCapability.Multimedia.Audio.Device 482 * @since 7 483 */ 484 /** 485 * Output devices. 486 * @syscap SystemCapability.Multimedia.Audio.Device 487 * @crossplatform 488 * @since 12 489 */ 490 OUTPUT_DEVICES_FLAG = 1, 491 /** 492 * Input devices. 493 * @syscap SystemCapability.Multimedia.Audio.Device 494 * @since 7 495 */ 496 /** 497 * Input devices. 498 * @syscap SystemCapability.Multimedia.Audio.Device 499 * @crossplatform 500 * @since 12 501 */ 502 INPUT_DEVICES_FLAG = 2, 503 /** 504 * All devices. 505 * @syscap SystemCapability.Multimedia.Audio.Device 506 * @since 7 507 */ 508 /** 509 * All devices. 510 * @syscap SystemCapability.Multimedia.Audio.Device 511 * @crossplatform 512 * @since 12 513 */ 514 ALL_DEVICES_FLAG = 3, 515 /** 516 * Distributed output devices. 517 * @syscap SystemCapability.Multimedia.Audio.Device 518 * @systemapi 519 * @since 9 520 */ 521 DISTRIBUTED_OUTPUT_DEVICES_FLAG = 4, 522 /** 523 * Distributed input devices. 524 * @syscap SystemCapability.Multimedia.Audio.Device 525 * @systemapi 526 * @since 9 527 */ 528 DISTRIBUTED_INPUT_DEVICES_FLAG = 8, 529 /** 530 * All Distributed devices. 531 * @syscap SystemCapability.Multimedia.Audio.Device 532 * @systemapi 533 * @since 9 534 */ 535 ALL_DISTRIBUTED_DEVICES_FLAG = 12, 536 } 537 538 /** 539 * Enumerates audio device for usage. 540 * @enum { number } 541 * @syscap SystemCapability.Multimedia.Audio.Device 542 * @since 12 543 */ 544 enum DeviceUsage { 545 /** 546 * Media output devices. 547 * @syscap SystemCapability.Multimedia.Audio.Device 548 * @since 12 549 */ 550 MEDIA_OUTPUT_DEVICES = 1, 551 /** 552 * Media input devices. 553 * @syscap SystemCapability.Multimedia.Audio.Device 554 * @since 12 555 */ 556 MEDIA_INPUT_DEVICES = 2, 557 /** 558 * All media devices. 559 * @syscap SystemCapability.Multimedia.Audio.Device 560 * @since 12 561 */ 562 ALL_MEDIA_DEVICES = 3, 563 /** 564 * Call output devices. 565 * @syscap SystemCapability.Multimedia.Audio.Device 566 * @since 12 567 */ 568 CALL_OUTPUT_DEVICES = 4, 569 /** 570 * Call input devices. 571 * @syscap SystemCapability.Multimedia.Audio.Device 572 * @since 12 573 */ 574 CALL_INPUT_DEVICES = 8, 575 /** 576 * All call devices. 577 * @syscap SystemCapability.Multimedia.Audio.Device 578 * @since 12 579 */ 580 ALL_CALL_DEVICES = 12, 581 } 582 583 /** 584 * Enumerates device roles. 585 * @enum { number } 586 * @syscap SystemCapability.Multimedia.Audio.Device 587 * @since 7 588 */ 589 /** 590 * Enumerates device roles. 591 * @enum { number } 592 * @syscap SystemCapability.Multimedia.Audio.Device 593 * @crossplatform 594 * @atomicservice 595 * @since 12 596 */ 597 enum DeviceRole { 598 /** 599 * Input role. 600 * @syscap SystemCapability.Multimedia.Audio.Device 601 * @since 7 602 */ 603 /** 604 * Input role. 605 * @syscap SystemCapability.Multimedia.Audio.Device 606 * @crossplatform 607 * @atomicservice 608 * @since 12 609 */ 610 INPUT_DEVICE = 1, 611 /** 612 * Output role. 613 * @syscap SystemCapability.Multimedia.Audio.Device 614 * @since 7 615 */ 616 /** 617 * Output role. 618 * @syscap SystemCapability.Multimedia.Audio.Device 619 * @crossplatform 620 * @atomicservice 621 * @since 12 622 */ 623 OUTPUT_DEVICE = 2, 624 } 625 626 /** 627 * Enumerates device types. 628 * @enum { number } 629 * @syscap SystemCapability.Multimedia.Audio.Device 630 * @since 7 631 */ 632 /** 633 * Enumerates device types. 634 * @enum { number } 635 * @syscap SystemCapability.Multimedia.Audio.Device 636 * @crossplatform 637 * @atomicservice 638 * @since 12 639 */ 640 enum DeviceType { 641 /** 642 * Invalid device. 643 * @syscap SystemCapability.Multimedia.Audio.Device 644 * @since 7 645 */ 646 /** 647 * Invalid device. 648 * @syscap SystemCapability.Multimedia.Audio.Device 649 * @crossplatform 650 * @atomicservice 651 * @since 12 652 */ 653 INVALID = 0, 654 /** 655 * Built-in earpiece. 656 * @syscap SystemCapability.Multimedia.Audio.Device 657 * @since 7 658 */ 659 /** 660 * Built-in earpiece. 661 * @syscap SystemCapability.Multimedia.Audio.Device 662 * @crossplatform 663 * @atomicservice 664 * @since 12 665 */ 666 EARPIECE = 1, 667 /** 668 * Built-in speaker. 669 * @syscap SystemCapability.Multimedia.Audio.Device 670 * @since 7 671 */ 672 /** 673 * Built-in speaker. 674 * @syscap SystemCapability.Multimedia.Audio.Device 675 * @crossplatform 676 * @atomicservice 677 * @since 12 678 */ 679 SPEAKER = 2, 680 /** 681 * Wired headset, which is a combination of a pair of earpieces and a microphone. 682 * @syscap SystemCapability.Multimedia.Audio.Device 683 * @since 7 684 */ 685 /** 686 * Wired headset, which is a combination of a pair of earpieces and a microphone. 687 * @syscap SystemCapability.Multimedia.Audio.Device 688 * @crossplatform 689 * @atomicservice 690 * @since 12 691 */ 692 WIRED_HEADSET = 3, 693 /** 694 * A pair of wired headphones. 695 * @syscap SystemCapability.Multimedia.Audio.Device 696 * @since 7 697 */ 698 /** 699 * A pair of wired headphones. 700 * @syscap SystemCapability.Multimedia.Audio.Device 701 * @crossplatform 702 * @atomicservice 703 * @since 12 704 */ 705 WIRED_HEADPHONES = 4, 706 /** 707 * Bluetooth device using the synchronous connection oriented link (SCO). 708 * @syscap SystemCapability.Multimedia.Audio.Device 709 * @since 7 710 */ 711 /** 712 * Bluetooth device using the synchronous connection oriented link (SCO). 713 * @syscap SystemCapability.Multimedia.Audio.Device 714 * @crossplatform 715 * @atomicservice 716 * @since 12 717 */ 718 BLUETOOTH_SCO = 7, 719 /** 720 * Bluetooth device using advanced audio distribution profile (A2DP). 721 * @syscap SystemCapability.Multimedia.Audio.Device 722 * @since 7 723 */ 724 /** 725 * Bluetooth device using advanced audio distribution profile (A2DP). 726 * @syscap SystemCapability.Multimedia.Audio.Device 727 * @crossplatform 728 * @atomicservice 729 * @since 12 730 */ 731 BLUETOOTH_A2DP = 8, 732 /** 733 * Built-in microphone. 734 * @syscap SystemCapability.Multimedia.Audio.Device 735 * @since 7 736 */ 737 /** 738 * Built-in microphone. 739 * @syscap SystemCapability.Multimedia.Audio.Device 740 * @crossplatform 741 * @atomicservice 742 * @since 12 743 */ 744 MIC = 15, 745 /** 746 * USB audio headset. 747 * @syscap SystemCapability.Multimedia.Audio.Device 748 * @since 7 749 */ 750 /** 751 * USB audio headset. 752 * @syscap SystemCapability.Multimedia.Audio.Device 753 * @crossplatform 754 * @atomicservice 755 * @since 12 756 */ 757 USB_HEADSET = 22, 758 /** 759 * Display port device. 760 * @syscap SystemCapability.Multimedia.Audio.Device 761 * @atomicservice 762 * @since 12 763 */ 764 DISPLAY_PORT = 23, 765 /** 766 * Device type for rerouting audio to other remote devices by system application 767 * @syscap SystemCapability.Multimedia.Audio.Device 768 * @atomicservice 769 * @since 12 770 */ 771 REMOTE_CAST = 24, 772 /** 773 * USB audio device. 774 * @syscap SystemCapability.Multimedia.Audio.Device 775 * @since 18 776 */ 777 USB_DEVICE = 25, 778 /** 779 * Distributed virtualization audio device. 780 * @syscap SystemCapability.Multimedia.Audio.Device 781 * @atomicservice 782 * @since 18 783 */ 784 REMOTE_DAUDIO = 29, 785 /** 786 * Default device type. 787 * @syscap SystemCapability.Multimedia.Audio.Device 788 * @since 9 789 */ 790 /** 791 * Default device type. 792 * @syscap SystemCapability.Multimedia.Audio.Device 793 * @crossplatform 794 * @atomicservice 795 * @since 12 796 */ 797 DEFAULT = 1000, 798 } 799 800 /** 801 * Enumerates the active device types. 802 * @enum { number } 803 * @syscap SystemCapability.Multimedia.Audio.Device 804 * @since 7 805 * @deprecated since 9 806 * @useinstead ohos.multimedia.audio.CommunicationDeviceType 807 */ 808 enum ActiveDeviceType { 809 /** 810 * Speaker. 811 * @syscap SystemCapability.Multimedia.Audio.Device 812 * @since 7 813 * @deprecated since 9 814 * @useinstead ohos.multimedia.audio.CommunicationDeviceType.SPEAKER 815 */ 816 SPEAKER = 2, 817 /** 818 * Bluetooth device using the SCO link. 819 * @syscap SystemCapability.Multimedia.Audio.Device 820 * @since 7 821 * @deprecated since 9 822 */ 823 BLUETOOTH_SCO = 7, 824 } 825 826 /** 827 * Enumerates the available device types for communication. 828 * @enum { number } 829 * @syscap SystemCapability.Multimedia.Audio.Communication 830 * @since 9 831 */ 832 /** 833 * Enumerates the available device types for communication. 834 * @enum { number } 835 * @syscap SystemCapability.Multimedia.Audio.Communication 836 * @crossplatform 837 * @since 12 838 */ 839 enum CommunicationDeviceType { 840 /** 841 * Speaker. 842 * @syscap SystemCapability.Multimedia.Audio.Communication 843 * @since 9 844 */ 845 /** 846 * Speaker. 847 * @syscap SystemCapability.Multimedia.Audio.Communication 848 * @crossplatform 849 * @since 12 850 */ 851 SPEAKER = 2 852 } 853 854 /** 855 * Enumerates ringer modes. 856 * @enum { number } 857 * @syscap SystemCapability.Multimedia.Audio.Communication 858 * @since 7 859 */ 860 /** 861 * Enumerates ringer modes. 862 * @enum { number } 863 * @syscap SystemCapability.Multimedia.Audio.Communication 864 * @crossplatform 865 * @since 12 866 */ 867 enum AudioRingMode { 868 /** 869 * Silent mode. 870 * @syscap SystemCapability.Multimedia.Audio.Communication 871 * @since 7 872 */ 873 /** 874 * Silent mode. 875 * @syscap SystemCapability.Multimedia.Audio.Communication 876 * @crossplatform 877 * @since 12 878 */ 879 RINGER_MODE_SILENT = 0, 880 /** 881 * Vibration mode. 882 * @syscap SystemCapability.Multimedia.Audio.Communication 883 * @since 7 884 */ 885 /** 886 * Vibration mode. 887 * @syscap SystemCapability.Multimedia.Audio.Communication 888 * @crossplatform 889 * @since 12 890 */ 891 RINGER_MODE_VIBRATE = 1, 892 /** 893 * Normal mode. 894 * @syscap SystemCapability.Multimedia.Audio.Communication 895 * @since 7 896 */ 897 /** 898 * Normal mode. 899 * @syscap SystemCapability.Multimedia.Audio.Communication 900 * @crossplatform 901 * @since 12 902 */ 903 RINGER_MODE_NORMAL = 2, 904 } 905 906 /** 907 * Enumerates type. 908 * @enum { number } 909 * @syscap SystemCapability.Multimedia.Audio.Volume 910 * @systemapi 911 * @since 12 912 */ 913 enum PolicyType { 914 /** 915 * EDM type. 916 * @syscap SystemCapability.Multimedia.Audio.Volume 917 * @systemapi 918 * @since 12 919 */ 920 EDM = 0, 921 /** 922 * PRIVACY type. 923 * @syscap SystemCapability.Multimedia.Audio.Volume 924 * @systemapi 925 * @since 12 926 */ 927 PRIVACY = 1, 928 } 929 930 /** 931 * Enumerates the audio sample formats. 932 * @enum { number } 933 * @syscap SystemCapability.Multimedia.Audio.Core 934 * @since 8 935 */ 936 /** 937 * Enumerates the audio sample formats. 938 * @enum { number } 939 * @syscap SystemCapability.Multimedia.Audio.Core 940 * @crossplatform 941 * @since 12 942 */ 943 enum AudioSampleFormat { 944 /** 945 * Invalid format. 946 * @syscap SystemCapability.Multimedia.Audio.Core 947 * @since 8 948 */ 949 /** 950 * Invalid format. 951 * @syscap SystemCapability.Multimedia.Audio.Core 952 * @crossplatform 953 * @since 12 954 */ 955 SAMPLE_FORMAT_INVALID = -1, 956 /** 957 * Unsigned 8 format. 958 * @syscap SystemCapability.Multimedia.Audio.Core 959 * @since 8 960 */ 961 /** 962 * Unsigned 8 format. 963 * @syscap SystemCapability.Multimedia.Audio.Core 964 * @crossplatform 965 * @since 12 966 */ 967 SAMPLE_FORMAT_U8 = 0, 968 /** 969 * Signed 16 bit integer, little endian. 970 * @syscap SystemCapability.Multimedia.Audio.Core 971 * @since 8 972 */ 973 /** 974 * Signed 16 bit integer, little endian. 975 * @syscap SystemCapability.Multimedia.Audio.Core 976 * @crossplatform 977 * @since 12 978 */ 979 SAMPLE_FORMAT_S16LE = 1, 980 /** 981 * Signed 24 bit integer, little endian. 982 * @syscap SystemCapability.Multimedia.Audio.Core 983 * @since 8 984 */ 985 /** 986 * Signed 24 bit integer, little endian. 987 * @syscap SystemCapability.Multimedia.Audio.Core 988 * @crossplatform 989 * @since 12 990 */ 991 SAMPLE_FORMAT_S24LE = 2, 992 /** 993 * Signed 32 bit integer, little endian. 994 * @syscap SystemCapability.Multimedia.Audio.Core 995 * @since 8 996 */ 997 /** 998 * Signed 32 bit integer, little endian. 999 * @syscap SystemCapability.Multimedia.Audio.Core 1000 * @crossplatform 1001 * @since 12 1002 */ 1003 SAMPLE_FORMAT_S32LE = 3, 1004 /** 1005 * Signed 32 bit float, little endian. 1006 * @syscap SystemCapability.Multimedia.Audio.Core 1007 * @since 9 1008 */ 1009 /** 1010 * Signed 32 bit float, little endian. 1011 * @syscap SystemCapability.Multimedia.Audio.Core 1012 * @crossplatform 1013 * @since 12 1014 */ 1015 SAMPLE_FORMAT_F32LE = 4, 1016 } 1017 1018 /** 1019 * Enumerates the audio channel. 1020 * @enum { number } 1021 * @syscap SystemCapability.Multimedia.Audio.Core 1022 * @since 8 1023 */ 1024 /** 1025 * Enumerates the audio channel. 1026 * @enum { number } 1027 * @syscap SystemCapability.Multimedia.Audio.Core 1028 * @crossplatform 1029 * @since 12 1030 */ 1031 enum AudioChannel { 1032 /** 1033 * Channel 1. 1034 * @syscap SystemCapability.Multimedia.Audio.Core 1035 * @since 8 1036 */ 1037 /** 1038 * Channel 1. 1039 * @syscap SystemCapability.Multimedia.Audio.Core 1040 * @crossplatform 1041 * @since 12 1042 */ 1043 CHANNEL_1 = 1, 1044 /** 1045 * Channel 2. 1046 * @syscap SystemCapability.Multimedia.Audio.Core 1047 * @since 8 1048 */ 1049 /** 1050 * Channel 2. 1051 * @syscap SystemCapability.Multimedia.Audio.Core 1052 * @crossplatform 1053 * @since 12 1054 */ 1055 CHANNEL_2 = 2, 1056 /** 1057 * Channel 3. 1058 * @syscap SystemCapability.Multimedia.Audio.Core 1059 * @since 11 1060 */ 1061 /** 1062 * Channel 3. 1063 * @syscap SystemCapability.Multimedia.Audio.Core 1064 * @crossplatform 1065 * @since 12 1066 */ 1067 CHANNEL_3 = 3, 1068 /** 1069 * Channel 4. 1070 * @syscap SystemCapability.Multimedia.Audio.Core 1071 * @since 11 1072 */ 1073 /** 1074 * Channel 4. 1075 * @syscap SystemCapability.Multimedia.Audio.Core 1076 * @crossplatform 1077 * @since 12 1078 */ 1079 CHANNEL_4 = 4, 1080 /** 1081 * Channel 5. 1082 * @syscap SystemCapability.Multimedia.Audio.Core 1083 * @since 11 1084 */ 1085 /** 1086 * Channel 5. 1087 * @syscap SystemCapability.Multimedia.Audio.Core 1088 * @crossplatform 1089 * @since 12 1090 */ 1091 CHANNEL_5 = 5, 1092 /** 1093 * Channel 6. 1094 * @syscap SystemCapability.Multimedia.Audio.Core 1095 * @since 11 1096 */ 1097 /** 1098 * Channel 6. 1099 * @syscap SystemCapability.Multimedia.Audio.Core 1100 * @crossplatform 1101 * @since 12 1102 */ 1103 CHANNEL_6 = 6, 1104 /** 1105 * Channel 7. 1106 * @syscap SystemCapability.Multimedia.Audio.Core 1107 * @since 11 1108 */ 1109 /** 1110 * Channel 7. 1111 * @syscap SystemCapability.Multimedia.Audio.Core 1112 * @crossplatform 1113 * @since 12 1114 */ 1115 CHANNEL_7 = 7, 1116 /** 1117 * Channel 8. 1118 * @syscap SystemCapability.Multimedia.Audio.Core 1119 * @since 11 1120 */ 1121 /** 1122 * Channel 8. 1123 * @syscap SystemCapability.Multimedia.Audio.Core 1124 * @crossplatform 1125 * @since 12 1126 */ 1127 CHANNEL_8 = 8, 1128 /** 1129 * Channel 9. 1130 * @syscap SystemCapability.Multimedia.Audio.Core 1131 * @since 11 1132 */ 1133 /** 1134 * Channel 9. 1135 * @syscap SystemCapability.Multimedia.Audio.Core 1136 * @crossplatform 1137 * @since 12 1138 */ 1139 CHANNEL_9 = 9, 1140 /** 1141 * Channel 10. 1142 * @syscap SystemCapability.Multimedia.Audio.Core 1143 * @since 11 1144 */ 1145 /** 1146 * Channel 10. 1147 * @syscap SystemCapability.Multimedia.Audio.Core 1148 * @crossplatform 1149 * @since 12 1150 */ 1151 CHANNEL_10 = 10, 1152 /** 1153 * Channel 12. 1154 * @syscap SystemCapability.Multimedia.Audio.Core 1155 * @since 11 1156 */ 1157 /** 1158 * Channel 12. 1159 * @syscap SystemCapability.Multimedia.Audio.Core 1160 * @crossplatform 1161 * @since 12 1162 */ 1163 CHANNEL_12 = 12, 1164 /** 1165 * Channel 14. 1166 * @syscap SystemCapability.Multimedia.Audio.Core 1167 * @since 11 1168 */ 1169 /** 1170 * Channel 14. 1171 * @syscap SystemCapability.Multimedia.Audio.Core 1172 * @crossplatform 1173 * @since 12 1174 */ 1175 CHANNEL_14 = 14, 1176 /** 1177 * Channel 16. 1178 * @syscap SystemCapability.Multimedia.Audio.Core 1179 * @since 11 1180 */ 1181 /** 1182 * Channel 16. 1183 * @syscap SystemCapability.Multimedia.Audio.Core 1184 * @crossplatform 1185 * @since 12 1186 */ 1187 CHANNEL_16 = 16 1188 } 1189 1190 /** 1191 * Enumerates the audio sampling rate. 1192 * @enum { number } 1193 * @syscap SystemCapability.Multimedia.Audio.Core 1194 * @since 8 1195 */ 1196 /** 1197 * Enumerates the audio sampling rate. 1198 * @enum { number } 1199 * @syscap SystemCapability.Multimedia.Audio.Core 1200 * @crossplatform 1201 * @since 12 1202 */ 1203 enum AudioSamplingRate { 1204 /** 1205 * 8kHz sample rate. 1206 * @syscap SystemCapability.Multimedia.Audio.Core 1207 * @since 8 1208 */ 1209 /** 1210 * 8kHz sample rate. 1211 * @syscap SystemCapability.Multimedia.Audio.Core 1212 * @crossplatform 1213 * @since 12 1214 */ 1215 SAMPLE_RATE_8000 = 8000, 1216 /** 1217 * 11.025kHz sample rate. 1218 * @syscap SystemCapability.Multimedia.Audio.Core 1219 * @since 8 1220 */ 1221 /** 1222 * 11.025kHz sample rate. 1223 * @syscap SystemCapability.Multimedia.Audio.Core 1224 * @crossplatform 1225 * @since 12 1226 */ 1227 SAMPLE_RATE_11025 = 11025, 1228 /** 1229 * 12kHz sample rate. 1230 * @syscap SystemCapability.Multimedia.Audio.Core 1231 * @since 8 1232 */ 1233 /** 1234 * 12kHz sample rate. 1235 * @syscap SystemCapability.Multimedia.Audio.Core 1236 * @crossplatform 1237 * @since 12 1238 */ 1239 SAMPLE_RATE_12000 = 12000, 1240 /** 1241 * 16kHz sample rate. 1242 * @syscap SystemCapability.Multimedia.Audio.Core 1243 * @since 8 1244 */ 1245 /** 1246 * 16kHz sample rate. 1247 * @syscap SystemCapability.Multimedia.Audio.Core 1248 * @crossplatform 1249 * @since 12 1250 */ 1251 SAMPLE_RATE_16000 = 16000, 1252 /** 1253 * 22.05kHz sample rate. 1254 * @syscap SystemCapability.Multimedia.Audio.Core 1255 * @since 8 1256 */ 1257 /** 1258 * 22.05kHz sample rate. 1259 * @syscap SystemCapability.Multimedia.Audio.Core 1260 * @crossplatform 1261 * @since 12 1262 */ 1263 SAMPLE_RATE_22050 = 22050, 1264 /** 1265 * 24kHz sample rate. 1266 * @syscap SystemCapability.Multimedia.Audio.Core 1267 * @since 8 1268 */ 1269 /** 1270 * 24kHz sample rate. 1271 * @syscap SystemCapability.Multimedia.Audio.Core 1272 * @crossplatform 1273 * @since 12 1274 */ 1275 SAMPLE_RATE_24000 = 24000, 1276 /** 1277 * 32kHz sample rate. 1278 * @syscap SystemCapability.Multimedia.Audio.Core 1279 * @since 8 1280 */ 1281 /** 1282 * 32kHz sample rate. 1283 * @syscap SystemCapability.Multimedia.Audio.Core 1284 * @crossplatform 1285 * @since 12 1286 */ 1287 SAMPLE_RATE_32000 = 32000, 1288 /** 1289 * 44.1kHz sample rate. 1290 * @syscap SystemCapability.Multimedia.Audio.Core 1291 * @since 8 1292 */ 1293 /** 1294 * 44.1kHz sample rate. 1295 * @syscap SystemCapability.Multimedia.Audio.Core 1296 * @crossplatform 1297 * @since 12 1298 */ 1299 SAMPLE_RATE_44100 = 44100, 1300 /** 1301 * 48kHz sample rate. 1302 * @syscap SystemCapability.Multimedia.Audio.Core 1303 * @since 8 1304 */ 1305 /** 1306 * 48kHz sample rate. 1307 * @syscap SystemCapability.Multimedia.Audio.Core 1308 * @crossplatform 1309 * @since 12 1310 */ 1311 SAMPLE_RATE_48000 = 48000, 1312 /** 1313 * 64kHz sample rate. 1314 * @syscap SystemCapability.Multimedia.Audio.Core 1315 * @since 8 1316 */ 1317 /** 1318 * 64kHz sample rate. 1319 * @syscap SystemCapability.Multimedia.Audio.Core 1320 * @crossplatform 1321 * @since 12 1322 */ 1323 SAMPLE_RATE_64000 = 64000, 1324 /** 1325 * 88.2kHz sample rate. 1326 * @syscap SystemCapability.Multimedia.Audio.Core 1327 * @since 12 1328 */ 1329 SAMPLE_RATE_88200 = 88200, 1330 /** 1331 * 96kHz sample rate. 1332 * @syscap SystemCapability.Multimedia.Audio.Core 1333 * @since 8 1334 */ 1335 /** 1336 * 96kHz sample rate. 1337 * @syscap SystemCapability.Multimedia.Audio.Core 1338 * @crossplatform 1339 * @since 12 1340 */ 1341 SAMPLE_RATE_96000 = 96000, 1342 /** 1343 * 176.4kHz sample rate. 1344 * @syscap SystemCapability.Multimedia.Audio.Core 1345 * @since 12 1346 */ 1347 SAMPLE_RATE_176400 = 176400, 1348 /** 1349 * 192kHz sample rate. 1350 * @syscap SystemCapability.Multimedia.Audio.Core 1351 * @since 12 1352 */ 1353 SAMPLE_RATE_192000 = 192000 1354 } 1355 1356 /** 1357 * Enumerates the audio encoding type. 1358 * @enum { number } 1359 * @syscap SystemCapability.Multimedia.Audio.Core 1360 * @since 8 1361 */ 1362 /** 1363 * Enumerates the audio encoding type. 1364 * @enum { number } 1365 * @syscap SystemCapability.Multimedia.Audio.Core 1366 * @crossplatform 1367 * @atomicservice 1368 * @since 12 1369 */ 1370 enum AudioEncodingType { 1371 /** 1372 * Invalid type. 1373 * @syscap SystemCapability.Multimedia.Audio.Core 1374 * @since 8 1375 */ 1376 /** 1377 * Invalid type. 1378 * @syscap SystemCapability.Multimedia.Audio.Core 1379 * @crossplatform 1380 * @atomicservice 1381 * @since 12 1382 */ 1383 ENCODING_TYPE_INVALID = -1, 1384 /** 1385 * PCM encoding. 1386 * @syscap SystemCapability.Multimedia.Audio.Core 1387 * @since 8 1388 */ 1389 /** 1390 * PCM encoding. 1391 * @syscap SystemCapability.Multimedia.Audio.Core 1392 * @crossplatform 1393 * @atomicservice 1394 * @since 12 1395 */ 1396 ENCODING_TYPE_RAW = 0 1397 } 1398 1399 /** 1400 * Enumerates the audio content type. 1401 * @enum { number } 1402 * @syscap SystemCapability.Multimedia.Audio.Core 1403 * @since 7 1404 * @deprecated since 10 1405 * @useinstead ohos.multimedia.audio.StreamUsage 1406 */ 1407 enum ContentType { 1408 /** 1409 * Unknown content. 1410 * @syscap SystemCapability.Multimedia.Audio.Core 1411 * @since 7 1412 * @deprecated since 10 1413 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_UNKNOWN 1414 */ 1415 CONTENT_TYPE_UNKNOWN = 0, 1416 /** 1417 * Speech content. 1418 * @syscap SystemCapability.Multimedia.Audio.Core 1419 * @since 7 1420 * @deprecated since 10 1421 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION 1422 */ 1423 CONTENT_TYPE_SPEECH = 1, 1424 /** 1425 * Music content. 1426 * @syscap SystemCapability.Multimedia.Audio.Core 1427 * @since 7 1428 * @deprecated since 10 1429 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MUSIC 1430 */ 1431 CONTENT_TYPE_MUSIC = 2, 1432 /** 1433 * Movie content. 1434 * @syscap SystemCapability.Multimedia.Audio.Core 1435 * @since 7 1436 * @deprecated since 10 1437 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MOVIE 1438 */ 1439 CONTENT_TYPE_MOVIE = 3, 1440 /** 1441 * Notification content. 1442 * @syscap SystemCapability.Multimedia.Audio.Core 1443 * @since 7 1444 * @deprecated since 10 1445 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_NOTIFICATION 1446 */ 1447 CONTENT_TYPE_SONIFICATION = 4, 1448 /** 1449 * Ringtone content. 1450 * @syscap SystemCapability.Multimedia.Audio.Core 1451 * @since 8 1452 * @deprecated since 10 1453 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_RINGTONE 1454 */ 1455 CONTENT_TYPE_RINGTONE = 5, 1456 } 1457 1458 /** 1459 * Enumerates the stream usage. 1460 * @enum { number } 1461 * @syscap SystemCapability.Multimedia.Audio.Core 1462 * @since 7 1463 */ 1464 /** 1465 * Enumerates the stream usage. 1466 * @enum { number } 1467 * @syscap SystemCapability.Multimedia.Audio.Core 1468 * @crossplatform 1469 * @atomicservice 1470 * @since 12 1471 */ 1472 enum StreamUsage { 1473 /** 1474 * Unknown usage. 1475 * @syscap SystemCapability.Multimedia.Audio.Core 1476 * @since 7 1477 */ 1478 /** 1479 * Unknown usage. 1480 * @syscap SystemCapability.Multimedia.Audio.Core 1481 * @crossplatform 1482 * @atomicservice 1483 * @since 12 1484 */ 1485 STREAM_USAGE_UNKNOWN = 0, 1486 /** 1487 * Media usage. 1488 * @syscap SystemCapability.Multimedia.Audio.Core 1489 * @since 7 1490 * @deprecated since 10 1491 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MUSIC or 1492 * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MOVIE or 1493 * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_GAME or 1494 * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_AUDIOBOOK 1495 */ 1496 STREAM_USAGE_MEDIA = 1, 1497 /** 1498 * Music usage. 1499 * @syscap SystemCapability.Multimedia.Audio.Core 1500 * @since 10 1501 */ 1502 /** 1503 * Music usage. 1504 * @syscap SystemCapability.Multimedia.Audio.Core 1505 * @crossplatform 1506 * @atomicservice 1507 * @since 12 1508 */ 1509 STREAM_USAGE_MUSIC = 1, 1510 /** 1511 * Voice communication usage. 1512 * @syscap SystemCapability.Multimedia.Audio.Core 1513 * @since 7 1514 */ 1515 /** 1516 * Voice communication usage. 1517 * @syscap SystemCapability.Multimedia.Audio.Core 1518 * @crossplatform 1519 * @atomicservice 1520 * @since 12 1521 */ 1522 STREAM_USAGE_VOICE_COMMUNICATION = 2, 1523 /** 1524 * Voice assistant broadcast usage. 1525 * @syscap SystemCapability.Multimedia.Audio.Core 1526 * @since 9 1527 */ 1528 /** 1529 * Voice assistant broadcast usage. 1530 * @syscap SystemCapability.Multimedia.Audio.Core 1531 * @crossplatform 1532 * @atomicservice 1533 * @since 12 1534 */ 1535 STREAM_USAGE_VOICE_ASSISTANT = 3, 1536 /** 1537 * Alarm usage. 1538 * @syscap SystemCapability.Multimedia.Audio.Core 1539 * @since 10 1540 */ 1541 /** 1542 * Alarm usage. 1543 * @syscap SystemCapability.Multimedia.Audio.Core 1544 * @crossplatform 1545 * @atomicservice 1546 * @since 12 1547 */ 1548 STREAM_USAGE_ALARM = 4, 1549 /** 1550 * Voice message usage. 1551 * @syscap SystemCapability.Multimedia.Audio.Core 1552 * @since 10 1553 */ 1554 /** 1555 * Voice message usage. 1556 * @syscap SystemCapability.Multimedia.Audio.Core 1557 * @atomicservice 1558 * @since 12 1559 */ 1560 STREAM_USAGE_VOICE_MESSAGE = 5, 1561 /** 1562 * Notification or ringtone usage. 1563 * @syscap SystemCapability.Multimedia.Audio.Core 1564 * @since 7 1565 * @deprecated since 10 1566 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_RINGTONE 1567 */ 1568 STREAM_USAGE_NOTIFICATION_RINGTONE = 6, 1569 /** 1570 * Ringtone usage. 1571 * @syscap SystemCapability.Multimedia.Audio.Core 1572 * @since 10 1573 */ 1574 /** 1575 * Ringtone usage. 1576 * @syscap SystemCapability.Multimedia.Audio.Core 1577 * @crossplatform 1578 * @atomicservice 1579 * @since 12 1580 */ 1581 STREAM_USAGE_RINGTONE = 6, 1582 /** 1583 * Notification usage. 1584 * @syscap SystemCapability.Multimedia.Audio.Core 1585 * @since 10 1586 */ 1587 /** 1588 * Notification usage. 1589 * @syscap SystemCapability.Multimedia.Audio.Core 1590 * @crossplatform 1591 * @atomicservice 1592 * @since 12 1593 */ 1594 STREAM_USAGE_NOTIFICATION = 7, 1595 /** 1596 * Accessibility usage, such as screen reader. 1597 * @syscap SystemCapability.Multimedia.Audio.Core 1598 * @since 10 1599 */ 1600 /** 1601 * Accessibility usage, such as screen reader. 1602 * @syscap SystemCapability.Multimedia.Audio.Core 1603 * @crossplatform 1604 * @atomicservice 1605 * @since 12 1606 */ 1607 STREAM_USAGE_ACCESSIBILITY = 8, 1608 /** 1609 * System usage, such as screen lock or key click. 1610 * @syscap SystemCapability.Multimedia.Audio.Core 1611 * @systemapi 1612 * @since 10 1613 */ 1614 STREAM_USAGE_SYSTEM = 9, 1615 /** 1616 * Movie or video usage. 1617 * @syscap SystemCapability.Multimedia.Audio.Core 1618 * @since 10 1619 */ 1620 /** 1621 * Movie or video usage. 1622 * @syscap SystemCapability.Multimedia.Audio.Core 1623 * @crossplatform 1624 * @atomicservice 1625 * @since 12 1626 */ 1627 STREAM_USAGE_MOVIE = 10, 1628 /** 1629 * Game sound effect usage. 1630 * @syscap SystemCapability.Multimedia.Audio.Core 1631 * @since 10 1632 */ 1633 /** 1634 * Game sound effect usage. 1635 * @syscap SystemCapability.Multimedia.Audio.Core 1636 * @crossplatform 1637 * @atomicservice 1638 * @since 12 1639 */ 1640 STREAM_USAGE_GAME = 11, 1641 /** 1642 * Audiobook usage. 1643 * @syscap SystemCapability.Multimedia.Audio.Core 1644 * @since 10 1645 */ 1646 /** 1647 * Audiobook usage. 1648 * @syscap SystemCapability.Multimedia.Audio.Core 1649 * @crossplatform 1650 * @atomicservice 1651 * @since 12 1652 */ 1653 STREAM_USAGE_AUDIOBOOK = 12, 1654 /** 1655 * Navigation usage. 1656 * @syscap SystemCapability.Multimedia.Audio.Core 1657 * @since 10 1658 */ 1659 /** 1660 * Navigation usage. 1661 * @syscap SystemCapability.Multimedia.Audio.Core 1662 * @crossplatform 1663 * @atomicservice 1664 * @since 12 1665 */ 1666 STREAM_USAGE_NAVIGATION = 13, 1667 /** 1668 * DTMF dial tone usage. 1669 * @syscap SystemCapability.Multimedia.Audio.Core 1670 * @systemapi 1671 * @since 10 1672 */ 1673 STREAM_USAGE_DTMF = 14, 1674 /** 1675 * Enforced tone usage, such as camera shutter. 1676 * @syscap SystemCapability.Multimedia.Audio.Core 1677 * @systemapi 1678 * @since 10 1679 */ 1680 STREAM_USAGE_ENFORCED_TONE = 15, 1681 /** 1682 * Ultrasonic playing usage. This type is only used for msdp condition. 1683 * @syscap SystemCapability.Multimedia.Audio.Core 1684 * @systemapi 1685 * @since 10 1686 */ 1687 STREAM_USAGE_ULTRASONIC = 16, 1688 /** 1689 * Video call usage. 1690 * @syscap SystemCapability.Multimedia.Audio.Core 1691 * @atomicservice 1692 * @since 12 1693 */ 1694 STREAM_USAGE_VIDEO_COMMUNICATION = 17, 1695 /** 1696 * Voice call assistant type. This type is only used for call assistant functionalities. 1697 * @syscap SystemCapability.Multimedia.Audio.Core 1698 * @systemapi 1699 * @since 12 1700 */ 1701 STREAM_USAGE_VOICE_CALL_ASSISTANT = 21, 1702 } 1703 1704 /** 1705 * Enumerates the audio interrupt request type. 1706 * @enum { number } 1707 * @syscap SystemCapability.Multimedia.Audio.Interrupt 1708 * @systemapi 1709 * @since 9 1710 */ 1711 enum InterruptRequestType { 1712 /** 1713 * Default type to request audio interrupt. 1714 * @syscap SystemCapability.Multimedia.Audio.Interrupt 1715 * @systemapi 1716 * @since 9 1717 */ 1718 INTERRUPT_REQUEST_TYPE_DEFAULT = 0, 1719 } 1720 1721 /** 1722 * Enumerates volume related operations. 1723 * Flags should be powers of 2! 1724 * @enum { number } 1725 * @syscap SystemCapability.Multimedia.Audio.Volume 1726 * @systemapi 1727 * @since 12 1728 */ 1729 enum VolumeFlag { 1730 /** 1731 * Show system volume bar. 1732 * @syscap SystemCapability.Multimedia.Audio.Volume 1733 * @systemapi 1734 * @since 12 1735 */ 1736 FLAG_SHOW_SYSTEM_UI = 1, 1737 } 1738 1739 /** 1740 * Describes audio stream information. 1741 * @typedef AudioStreamInfo 1742 * @syscap SystemCapability.Multimedia.Audio.Core 1743 * @since 8 1744 */ 1745 /** 1746 * Describes audio stream information. 1747 * @typedef AudioStreamInfo 1748 * @syscap SystemCapability.Multimedia.Audio.Core 1749 * @crossplatform 1750 * @since 12 1751 */ 1752 interface AudioStreamInfo { 1753 /** 1754 * Sampling rate. 1755 * @type { AudioSamplingRate } 1756 * @syscap SystemCapability.Multimedia.Audio.Core 1757 * @since 8 1758 */ 1759 /** 1760 * Sampling rate. 1761 * @type { AudioSamplingRate } 1762 * @syscap SystemCapability.Multimedia.Audio.Core 1763 * @crossplatform 1764 * @since 12 1765 */ 1766 samplingRate: AudioSamplingRate; 1767 /** 1768 * Audio channels. 1769 * @type { AudioChannel } 1770 * @syscap SystemCapability.Multimedia.Audio.Core 1771 * @since 8 1772 */ 1773 /** 1774 * Audio channels. 1775 * @type { AudioChannel } 1776 * @syscap SystemCapability.Multimedia.Audio.Core 1777 * @crossplatform 1778 * @since 12 1779 */ 1780 channels: AudioChannel; 1781 /** 1782 * Audio sample format. 1783 * @type { AudioSampleFormat } 1784 * @syscap SystemCapability.Multimedia.Audio.Core 1785 * @since 8 1786 */ 1787 /** 1788 * Audio sample format. 1789 * @type { AudioSampleFormat } 1790 * @syscap SystemCapability.Multimedia.Audio.Core 1791 * @crossplatform 1792 * @since 12 1793 */ 1794 sampleFormat: AudioSampleFormat; 1795 /** 1796 * Audio encoding type. 1797 * @type { AudioEncodingType } 1798 * @syscap SystemCapability.Multimedia.Audio.Core 1799 * @since 8 1800 */ 1801 /** 1802 * Audio encoding type. 1803 * @type { AudioEncodingType } 1804 * @syscap SystemCapability.Multimedia.Audio.Core 1805 * @crossplatform 1806 * @since 12 1807 */ 1808 encodingType: AudioEncodingType; 1809 /** 1810 * Audio channel layout. 1811 * @type { ?AudioChannelLayout } 1812 * @syscap SystemCapability.Multimedia.Audio.Core 1813 * @since 11 1814 */ 1815 /** 1816 * Audio channel layout. 1817 * @type { ?AudioChannelLayout } 1818 * @syscap SystemCapability.Multimedia.Audio.Core 1819 * @crossplatform 1820 * @since 12 1821 */ 1822 channelLayout?: AudioChannelLayout; 1823 } 1824 1825 /** 1826 * Describes audio renderer information. 1827 * @typedef AudioRendererInfo 1828 * @syscap SystemCapability.Multimedia.Audio.Core 1829 * @since 8 1830 */ 1831 /** 1832 * Describes audio renderer information. 1833 * @typedef AudioRendererInfo 1834 * @syscap SystemCapability.Multimedia.Audio.Core 1835 * @crossplatform 1836 * @atomicservice 1837 * @since 12 1838 */ 1839 interface AudioRendererInfo { 1840 /** 1841 * Content type. 1842 * @type { ContentType } 1843 * @syscap SystemCapability.Multimedia.Audio.Core 1844 * @since 8 1845 * @deprecated since 10 1846 * @useinstead ohos.multimedia.audio.AudioRendererInfo#usage 1847 */ 1848 /** 1849 * Content type. 1850 * @type { ?ContentType } 1851 * @syscap SystemCapability.Multimedia.Audio.Core 1852 * @since 10 1853 */ 1854 content?: ContentType; 1855 /** 1856 * Stream usage. 1857 * @type { StreamUsage } 1858 * @syscap SystemCapability.Multimedia.Audio.Core 1859 * @since 8 1860 */ 1861 /** 1862 * Stream usage. 1863 * @type { StreamUsage } 1864 * @syscap SystemCapability.Multimedia.Audio.Core 1865 * @crossplatform 1866 * @atomicservice 1867 * @since 12 1868 */ 1869 usage: StreamUsage; 1870 /** 1871 * Audio renderer flags. 1872 * @type { number } 1873 * @syscap SystemCapability.Multimedia.Audio.Core 1874 * @since 8 1875 */ 1876 /** 1877 * Audio renderer flags. 1878 * @type { number } 1879 * @syscap SystemCapability.Multimedia.Audio.Core 1880 * @crossplatform 1881 * @atomicservice 1882 * @since 12 1883 */ 1884 rendererFlags: number; 1885 } 1886 1887 /** 1888 * Describes audio renderer filter. 1889 * @typedef AudioRendererFilter 1890 * @syscap SystemCapability.Multimedia.Audio.Core 1891 * @systemapi 1892 * @since 9 1893 */ 1894 interface AudioRendererFilter { 1895 /** 1896 * Application uid. 1897 * @type { ?number } 1898 * @syscap SystemCapability.Multimedia.Audio.Core 1899 * @systemapi 1900 * @since 9 1901 */ 1902 uid?: number; 1903 /** 1904 * Renderer information. 1905 * @type { ?AudioRendererInfo } 1906 * @syscap SystemCapability.Multimedia.Audio.Renderer 1907 * @systemapi 1908 * @since 9 1909 */ 1910 rendererInfo?: AudioRendererInfo; 1911 /** 1912 * AudioRenderer id. 1913 * @type { ?number } 1914 * @syscap SystemCapability.Multimedia.Audio.Renderer 1915 * @systemapi 1916 * @since 9 1917 */ 1918 rendererId?: number; 1919 } 1920 1921 /** 1922 * Describe audio capturer filter. 1923 * @typedef AudioCapturerFilter 1924 * @syscap SystemCapability.Multimedia.Audio.Core 1925 * @systemapi 1926 * @since 18 1927 */ 1928 interface AudioCapturerFilter { 1929 /** 1930 * Application uid. 1931 * @type { ?number } 1932 * @syscap SystemCapability.Multimedia.Audio.Core 1933 * @systemapi 1934 * @since 18 1935 */ 1936 uid?: number; 1937 /** 1938 * Capturer information. 1939 * @type { ?AudioCapturerInfo } 1940 * @syscap SystemCapability.Multimedia.Audio.Capturer 1941 * @systemapi 1942 * @since 18 1943 */ 1944 capturerInfo?: AudioCapturerInfo; 1945 } 1946 1947 /** 1948 * Describes audio renderer configuration options. 1949 * @typedef AudioRendererOptions 1950 * @syscap SystemCapability.Multimedia.Audio.Renderer 1951 * @since 8 1952 */ 1953 /** 1954 * Describes audio renderer configuration options. 1955 * @typedef AudioRendererOptions 1956 * @syscap SystemCapability.Multimedia.Audio.Renderer 1957 * @crossplatform 1958 * @since 12 1959 */ 1960 interface AudioRendererOptions { 1961 /** 1962 * Stream information. 1963 * @type { AudioStreamInfo } 1964 * @syscap SystemCapability.Multimedia.Audio.Renderer 1965 * @since 8 1966 */ 1967 /** 1968 * Stream information. 1969 * @type { AudioStreamInfo } 1970 * @syscap SystemCapability.Multimedia.Audio.Renderer 1971 * @crossplatform 1972 * @since 12 1973 */ 1974 streamInfo: AudioStreamInfo; 1975 /** 1976 * Renderer information. 1977 * @type { AudioRendererInfo } 1978 * @syscap SystemCapability.Multimedia.Audio.Renderer 1979 * @since 8 1980 */ 1981 /** 1982 * Renderer information. 1983 * @type { AudioRendererInfo } 1984 * @syscap SystemCapability.Multimedia.Audio.Renderer 1985 * @crossplatform 1986 * @since 12 1987 */ 1988 rendererInfo: AudioRendererInfo; 1989 /** 1990 * Privacy configuration. 1991 * @type { ?AudioPrivacyType } 1992 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 1993 * @since 10 1994 */ 1995 /** 1996 * Privacy configuration. 1997 * @type { ?AudioPrivacyType } 1998 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 1999 * @crossplatform 2000 * @since 12 2001 */ 2002 privacyType?: AudioPrivacyType; 2003 } 2004 2005 /** 2006 * Enumerates audio stream privacy type for playback capture. 2007 * @enum { number } 2008 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 2009 * @since 10 2010 */ 2011 /** 2012 * Enumerates audio stream privacy type for playback capture. 2013 * @enum { number } 2014 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 2015 * @crossplatform 2016 * @since 12 2017 */ 2018 enum AudioPrivacyType { 2019 /** 2020 * Privacy type that stream can be captured by third party applications. 2021 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 2022 * @since 10 2023 */ 2024 /** 2025 * Privacy type that stream can be captured by third party applications. 2026 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 2027 * @crossplatform 2028 * @since 12 2029 */ 2030 PRIVACY_TYPE_PUBLIC = 0, 2031 2032 /** 2033 * Privacy type that stream can not be captured. 2034 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 2035 * @since 10 2036 */ 2037 /** 2038 * Privacy type that stream can not be captured. 2039 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 2040 * @crossplatform 2041 * @since 12 2042 */ 2043 PRIVACY_TYPE_PRIVATE = 1, 2044 } 2045 2046 /** 2047 * Enumerates the interrupt modes. 2048 * @enum { number } 2049 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2050 * @since 9 2051 */ 2052 /** 2053 * Enumerates the interrupt modes. 2054 * @enum { number } 2055 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2056 * @crossplatform 2057 * @atomicservice 2058 * @since 12 2059 */ 2060 enum InterruptMode { 2061 /** 2062 * Mode that different stream share one interrupt unit. 2063 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2064 * @since 9 2065 */ 2066 /** 2067 * Mode that different stream share one interrupt unit. 2068 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2069 * @crossplatform 2070 * @atomicservice 2071 * @since 12 2072 */ 2073 SHARE_MODE = 0, 2074 /** 2075 * Mode that each stream has independent interrupt unit. 2076 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2077 * @since 9 2078 */ 2079 /** 2080 * Mode that each stream has independent interrupt unit. 2081 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2082 * @crossplatform 2083 * @atomicservice 2084 * @since 12 2085 */ 2086 INDEPENDENT_MODE = 1 2087 } 2088 2089 /** 2090 * Enumerates the audio renderer rates. 2091 * @enum { number } 2092 * @syscap SystemCapability.Multimedia.Audio.Renderer 2093 * @since 8 2094 */ 2095 enum AudioRendererRate { 2096 /** 2097 * Normal rate. 2098 * @syscap SystemCapability.Multimedia.Audio.Renderer 2099 * @since 8 2100 */ 2101 RENDER_RATE_NORMAL = 0, 2102 /** 2103 * Double rate. 2104 * @syscap SystemCapability.Multimedia.Audio.Renderer 2105 * @since 8 2106 */ 2107 RENDER_RATE_DOUBLE = 1, 2108 /** 2109 * Half rate. 2110 * @syscap SystemCapability.Multimedia.Audio.Renderer 2111 * @since 8 2112 */ 2113 RENDER_RATE_HALF = 2 2114 } 2115 2116 /** 2117 * Enumerates the interrupt types. 2118 * @enum { number } 2119 * @syscap SystemCapability.Multimedia.Audio.Renderer 2120 * @since 7 2121 */ 2122 /** 2123 * Enumerates the interrupt types. 2124 * @enum { number } 2125 * @syscap SystemCapability.Multimedia.Audio.Renderer 2126 * @crossplatform 2127 * @atomicservice 2128 * @since 12 2129 */ 2130 enum InterruptType { 2131 /** 2132 * Audio playback interruption started. 2133 * @syscap SystemCapability.Multimedia.Audio.Renderer 2134 * @since 7 2135 */ 2136 /** 2137 * Audio playback interruption started. 2138 * @syscap SystemCapability.Multimedia.Audio.Renderer 2139 * @crossplatform 2140 * @atomicservice 2141 * @since 12 2142 */ 2143 INTERRUPT_TYPE_BEGIN = 1, 2144 2145 /** 2146 * Audio playback interruption ended. 2147 * @syscap SystemCapability.Multimedia.Audio.Renderer 2148 * @since 7 2149 */ 2150 /** 2151 * Audio playback interruption ended. 2152 * @syscap SystemCapability.Multimedia.Audio.Renderer 2153 * @crossplatform 2154 * @atomicservice 2155 * @since 12 2156 */ 2157 INTERRUPT_TYPE_END = 2 2158 } 2159 2160 /** 2161 * Enumerates the interrupt hints. 2162 * @enum { number } 2163 * @syscap SystemCapability.Multimedia.Audio.Renderer 2164 * @since 7 2165 */ 2166 /** 2167 * Enumerates the interrupt hints. 2168 * @enum { number } 2169 * @syscap SystemCapability.Multimedia.Audio.Renderer 2170 * @crossplatform 2171 * @atomicservice 2172 * @since 12 2173 */ 2174 enum InterruptHint { 2175 /** 2176 * None. 2177 * @syscap SystemCapability.Multimedia.Audio.Renderer 2178 * @since 8 2179 */ 2180 /** 2181 * None. 2182 * @syscap SystemCapability.Multimedia.Audio.Renderer 2183 * @atomicservice 2184 * @since 12 2185 */ 2186 INTERRUPT_HINT_NONE = 0, 2187 /** 2188 * Resume the playback. 2189 * @syscap SystemCapability.Multimedia.Audio.Renderer 2190 * @since 7 2191 */ 2192 /** 2193 * Resume the playback. 2194 * @syscap SystemCapability.Multimedia.Audio.Renderer 2195 * @crossplatform 2196 * @atomicservice 2197 * @since 12 2198 */ 2199 INTERRUPT_HINT_RESUME = 1, 2200 2201 /** 2202 * Paused/Pause the playback. 2203 * @syscap SystemCapability.Multimedia.Audio.Renderer 2204 * @since 7 2205 */ 2206 /** 2207 * Paused/Pause the playback. 2208 * @syscap SystemCapability.Multimedia.Audio.Renderer 2209 * @atomicservice 2210 * @since 12 2211 */ 2212 INTERRUPT_HINT_PAUSE = 2, 2213 2214 /** 2215 * Stopped/Stop the playback. 2216 * @syscap SystemCapability.Multimedia.Audio.Renderer 2217 * @since 7 2218 */ 2219 /** 2220 * Stopped/Stop the playback. 2221 * @syscap SystemCapability.Multimedia.Audio.Renderer 2222 * @atomicservice 2223 * @since 12 2224 */ 2225 INTERRUPT_HINT_STOP = 3, 2226 2227 /** 2228 * Ducked the playback. (In ducking, the audio volume is reduced, but not silenced.) 2229 * @syscap SystemCapability.Multimedia.Audio.Renderer 2230 * @since 7 2231 */ 2232 /** 2233 * Ducked the playback. (In ducking, the audio volume is reduced, but not silenced.) 2234 * @syscap SystemCapability.Multimedia.Audio.Renderer 2235 * @atomicservice 2236 * @since 12 2237 */ 2238 INTERRUPT_HINT_DUCK = 4, 2239 2240 /** 2241 * Unducked the playback. 2242 * @syscap SystemCapability.Multimedia.Audio.Renderer 2243 * @since 8 2244 */ 2245 /** 2246 * Unducked the playback. 2247 * @syscap SystemCapability.Multimedia.Audio.Renderer 2248 * @atomicservice 2249 * @since 12 2250 */ 2251 INTERRUPT_HINT_UNDUCK = 5, 2252 } 2253 2254 /** 2255 * Enumerates the interrupt force types. 2256 * @enum { number } 2257 * @syscap SystemCapability.Multimedia.Audio.Renderer 2258 * @since 9 2259 */ 2260 /** 2261 * Enumerates the interrupt force types. 2262 * @enum { number } 2263 * @syscap SystemCapability.Multimedia.Audio.Renderer 2264 * @crossplatform 2265 * @atomicservice 2266 * @since 12 2267 */ 2268 enum InterruptForceType { 2269 /** 2270 * Forced action taken by system. 2271 * @syscap SystemCapability.Multimedia.Audio.Renderer 2272 * @since 9 2273 */ 2274 /** 2275 * Forced action taken by system. 2276 * @syscap SystemCapability.Multimedia.Audio.Renderer 2277 * @crossplatform 2278 * @atomicservice 2279 * @since 12 2280 */ 2281 INTERRUPT_FORCE = 0, 2282 /** 2283 * Share type, application can choose to take action or ignore. 2284 * @syscap SystemCapability.Multimedia.Audio.Renderer 2285 * @since 9 2286 */ 2287 /** 2288 * Share type, application can choose to take action or ignore. 2289 * @syscap SystemCapability.Multimedia.Audio.Renderer 2290 * @atomicservice 2291 * @since 12 2292 */ 2293 INTERRUPT_SHARE = 1 2294 } 2295 2296 /** 2297 * Describes the interrupt event received by the app when playback is interrupted. 2298 * @typedef InterruptEvent 2299 * @syscap SystemCapability.Multimedia.Audio.Renderer 2300 * @since 9 2301 */ 2302 /** 2303 * Describes the interrupt event received by the app when playback is interrupted. 2304 * @typedef InterruptEvent 2305 * @syscap SystemCapability.Multimedia.Audio.Renderer 2306 * @crossplatform 2307 * @atomicservice 2308 * @since 12 2309 */ 2310 interface InterruptEvent { 2311 /** 2312 * Indicates whether the interruption has started or finished. 2313 * @type { InterruptType } 2314 * @syscap SystemCapability.Multimedia.Audio.Renderer 2315 * @since 9 2316 */ 2317 /** 2318 * Indicates whether the interruption has started or finished. 2319 * @type { InterruptType } 2320 * @syscap SystemCapability.Multimedia.Audio.Renderer 2321 * @crossplatform 2322 * @atomicservice 2323 * @since 12 2324 */ 2325 eventType: InterruptType; 2326 2327 /** 2328 * Indicates whether the action is taken by system or to be taken by the app. 2329 * @type { InterruptForceType } 2330 * @syscap SystemCapability.Multimedia.Audio.Renderer 2331 * @since 9 2332 */ 2333 /** 2334 * Indicates whether the action is taken by system or to be taken by the app. 2335 * @type { InterruptForceType } 2336 * @syscap SystemCapability.Multimedia.Audio.Renderer 2337 * @crossplatform 2338 * @atomicservice 2339 * @since 12 2340 */ 2341 forceType: InterruptForceType; 2342 2343 /** 2344 * Indicates the kind of action. 2345 * @type { InterruptHint } 2346 * @syscap SystemCapability.Multimedia.Audio.Renderer 2347 * @since 9 2348 */ 2349 /** 2350 * Indicates the kind of action. 2351 * @type { InterruptHint } 2352 * @syscap SystemCapability.Multimedia.Audio.Renderer 2353 * @crossplatform 2354 * @atomicservice 2355 * @since 12 2356 */ 2357 hintType: InterruptHint; 2358 } 2359 2360 /** 2361 * Enumerates interrupt action types. 2362 * @enum { number } 2363 * @syscap SystemCapability.Multimedia.Audio.Renderer 2364 * @since 7 2365 * @deprecated since 9 2366 */ 2367 enum InterruptActionType { 2368 2369 /** 2370 * Focus gain event. 2371 * @syscap SystemCapability.Multimedia.Audio.Renderer 2372 * @since 7 2373 * @deprecated since 9 2374 */ 2375 TYPE_ACTIVATED = 0, 2376 2377 /** 2378 * Audio interruption event. 2379 * @syscap SystemCapability.Multimedia.Audio.Renderer 2380 * @since 7 2381 * @deprecated since 9 2382 */ 2383 TYPE_INTERRUPT = 1 2384 } 2385 2386 /** 2387 * Enumerates device change types. 2388 * @enum { number } 2389 * @syscap SystemCapability.Multimedia.Audio.Device 2390 * @since 7 2391 */ 2392 /** 2393 * Enumerates device change types. 2394 * @enum { number } 2395 * @syscap SystemCapability.Multimedia.Audio.Device 2396 * @crossplatform 2397 * @since 12 2398 */ 2399 enum DeviceChangeType { 2400 /** 2401 * Device connection. 2402 * @syscap SystemCapability.Multimedia.Audio.Device 2403 * @since 7 2404 */ 2405 /** 2406 * Device connection. 2407 * @syscap SystemCapability.Multimedia.Audio.Device 2408 * @crossplatform 2409 * @since 12 2410 */ 2411 CONNECT = 0, 2412 2413 /** 2414 * Device disconnection. 2415 * @syscap SystemCapability.Multimedia.Audio.Device 2416 * @since 7 2417 */ 2418 /** 2419 * Device disconnection. 2420 * @syscap SystemCapability.Multimedia.Audio.Device 2421 * @crossplatform 2422 * @since 12 2423 */ 2424 DISCONNECT = 1, 2425 } 2426 2427 /** 2428 * Enumerates audio scenes. 2429 * @enum { number } 2430 * @syscap SystemCapability.Multimedia.Audio.Communication 2431 * @since 8 2432 */ 2433 /** 2434 * Enumerates audio scenes. 2435 * @enum { number } 2436 * @syscap SystemCapability.Multimedia.Audio.Communication 2437 * @crossplatform 2438 * @since 12 2439 */ 2440 enum AudioScene { 2441 /** 2442 * Default audio scene 2443 * @syscap SystemCapability.Multimedia.Audio.Communication 2444 * @since 8 2445 */ 2446 /** 2447 * Default audio scene 2448 * @syscap SystemCapability.Multimedia.Audio.Communication 2449 * @crossplatform 2450 * @since 12 2451 */ 2452 AUDIO_SCENE_DEFAULT = 0, 2453 /** 2454 * Ringing audio scene 2455 * @syscap SystemCapability.Multimedia.Audio.Communication 2456 * @since 12 2457 */ 2458 AUDIO_SCENE_RINGING = 1, 2459 /** 2460 * Phone call audio scene 2461 * @syscap SystemCapability.Multimedia.Audio.Communication 2462 * @since 12 2463 */ 2464 AUDIO_SCENE_PHONE_CALL = 2, 2465 /** 2466 * Voice chat audio scene 2467 * @syscap SystemCapability.Multimedia.Audio.Communication 2468 * @since 8 2469 */ 2470 /** 2471 * Voice chat audio scene 2472 * @syscap SystemCapability.Multimedia.Audio.Communication 2473 * @crossplatform 2474 * @since 12 2475 */ 2476 AUDIO_SCENE_VOICE_CHAT = 3 2477 } 2478 2479 /** 2480 * Enumerates volume adjustment types. 2481 * @enum { number } 2482 * @syscap SystemCapability.Multimedia.Audio.Volume 2483 * @systemapi 2484 * @since 10 2485 */ 2486 enum VolumeAdjustType { 2487 /** 2488 * Adjust volume up. 2489 * @syscap SystemCapability.Multimedia.Audio.Volume 2490 * @systemapi 2491 * @since 10 2492 */ 2493 VOLUME_UP = 0, 2494 /** 2495 * Adjust volume down. 2496 * @syscap SystemCapability.Multimedia.Audio.Volume 2497 * @systemapi 2498 * @since 10 2499 */ 2500 VOLUME_DOWN = 1, 2501 } 2502 2503 /** 2504 * Implements audio volume and audio device management. 2505 * @typedef AudioManager 2506 * @syscap SystemCapability.Multimedia.Audio.Core 2507 * @since 7 2508 */ 2509 /** 2510 * Implements audio volume and audio device management. 2511 * @typedef AudioManager 2512 * @syscap SystemCapability.Multimedia.Audio.Core 2513 * @crossplatform 2514 * @since 12 2515 */ 2516 interface AudioManager { 2517 /** 2518 * Sets the volume for a stream. This method uses an asynchronous callback to return the result. 2519 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 2520 * @param { AudioVolumeType } volumeType - Audio stream type. 2521 * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. 2522 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2523 * @syscap SystemCapability.Multimedia.Audio.Volume 2524 * @since 7 2525 * @deprecated since 9 2526 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setVolume 2527 */ 2528 setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback<void>): void; 2529 /** 2530 * Sets the volume for a stream. This method uses a promise to return the result. 2531 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 2532 * @param { AudioVolumeType } volumeType - Audio stream type. 2533 * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. 2534 * @returns { Promise<void> } Promise used to return the result. 2535 * @syscap SystemCapability.Multimedia.Audio.Volume 2536 * @since 7 2537 * @deprecated since 9 2538 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setVolume 2539 */ 2540 setVolume(volumeType: AudioVolumeType, volume: number): Promise<void>; 2541 /** 2542 * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. 2543 * @param { AudioVolumeType } volumeType - Audio stream type. 2544 * @param { AsyncCallback<number> } callback - Callback used to return the volume. 2545 * @syscap SystemCapability.Multimedia.Audio.Volume 2546 * @since 7 2547 * @deprecated since 9 2548 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getVolume 2549 */ 2550 getVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 2551 /** 2552 * Obtains the volume of a stream. This method uses a promise to return the query result. 2553 * @param { AudioVolumeType } volumeType - Audio stream type. 2554 * @returns { Promise<number> } Promise used to return the volume. 2555 * @syscap SystemCapability.Multimedia.Audio.Volume 2556 * @since 7 2557 * @deprecated since 9 2558 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getVolume 2559 */ 2560 getVolume(volumeType: AudioVolumeType): Promise<number>; 2561 /** 2562 * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. 2563 * @param { AudioVolumeType } volumeType - Audio stream type. 2564 * @param { AsyncCallback<number> } callback - Callback used to return the minimum volume. 2565 * @syscap SystemCapability.Multimedia.Audio.Volume 2566 * @since 7 2567 * @deprecated since 9 2568 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMinVolume 2569 */ 2570 getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 2571 /** 2572 * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. 2573 * @param { AudioVolumeType } volumeType - Audio stream type. 2574 * @returns { Promise<number> } Promise used to return the minimum volume. 2575 * @syscap SystemCapability.Multimedia.Audio.Volume 2576 * @since 7 2577 * @deprecated since 9 2578 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMinVolume 2579 */ 2580 getMinVolume(volumeType: AudioVolumeType): Promise<number>; 2581 /** 2582 * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. 2583 * @param { AudioVolumeType } volumeType - Audio stream type. 2584 * @param { AsyncCallback<number> } callback - Callback used to return the maximum volume. 2585 * @syscap SystemCapability.Multimedia.Audio.Volume 2586 * @since 7 2587 * @deprecated since 9 2588 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMaxVolume 2589 */ 2590 getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 2591 /** 2592 * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. 2593 * @param { AudioVolumeType } volumeType - Audio stream type. 2594 * @returns { Promise<number> } Promise used to return the maximum volume. 2595 * @syscap SystemCapability.Multimedia.Audio.Volume 2596 * @since 7 2597 * @deprecated since 9 2598 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMaxVolume 2599 */ 2600 getMaxVolume(volumeType: AudioVolumeType): Promise<number>; 2601 /** 2602 * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. 2603 * @param { DeviceFlag } deviceFlag - Audio device flag. 2604 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the device list. 2605 * @syscap SystemCapability.Multimedia.Audio.Device 2606 * @since 7 2607 * @deprecated since 9 2608 * @useinstead ohos.multimedia.audio.AudioRoutingManager#getDevices 2609 */ 2610 getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors>): void; 2611 /** 2612 * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. 2613 * @param { DeviceFlag } deviceFlag - Audio device flag. 2614 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the device list. 2615 * @syscap SystemCapability.Multimedia.Audio.Device 2616 * @since 7 2617 * @deprecated since 9 2618 * @useinstead ohos.multimedia.audio.AudioRoutingManager#getDevices 2619 */ 2620 getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors>; 2621 /** 2622 * Mutes a stream. This method uses an asynchronous callback to return the result. 2623 * @param { AudioVolumeType } volumeType - Audio stream type. 2624 * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. 2625 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2626 * @syscap SystemCapability.Multimedia.Audio.Volume 2627 * @since 7 2628 * @deprecated since 9 2629 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#mute 2630 */ 2631 mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void>): void; 2632 /** 2633 * Mutes a stream. This method uses a promise to return the result. 2634 * @param { AudioVolumeType } volumeType - Audio stream type. 2635 * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. 2636 * @returns { Promise<void> } Promise used to return the result. 2637 * @syscap SystemCapability.Multimedia.Audio.Volume 2638 * @since 7 2639 * @deprecated since 9 2640 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#mute 2641 */ 2642 mute(volumeType: AudioVolumeType, mute: boolean): Promise<void>; 2643 /** 2644 * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. 2645 * @param { AudioVolumeType } volumeType - Audio stream type. 2646 * @param { AsyncCallback<boolean> } callback - Callback used to return the mute status of the stream. 2647 * The value true means that the stream is muted, and false means the opposite. 2648 * @syscap SystemCapability.Multimedia.Audio.Volume 2649 * @since 7 2650 * @deprecated since 9 2651 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMute 2652 */ 2653 isMute(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void; 2654 /** 2655 * Checks whether a stream is muted. This method uses a promise to return the result. 2656 * @param { AudioVolumeType } volumeType - Audio stream type. 2657 * @returns { Promise<boolean> } Promise used to return the mute status of the stream. The value true means 2658 * that the stream is muted, and false means the opposite. 2659 * @syscap SystemCapability.Multimedia.Audio.Volume 2660 * @since 7 2661 * @deprecated since 9 2662 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMute 2663 */ 2664 isMute(volumeType: AudioVolumeType): Promise<boolean>; 2665 /** 2666 * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. 2667 * @param { AudioVolumeType } volumeType - Audio stream type. 2668 * @param { AsyncCallback<boolean> } callback - Callback used to return the active status of the stream. 2669 * The value true means that the stream is active, and false means the opposite. 2670 * @syscap SystemCapability.Multimedia.Audio.Volume 2671 * @since 7 2672 * @deprecated since 9 2673 * @useinstead ohos.multimedia.audio.AudioStreamManager#isActive 2674 */ 2675 isActive(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void; 2676 /** 2677 * Checks whether a stream is active. This method uses a promise to return the query result. 2678 * @param { AudioVolumeType } volumeType - Audio stream type. 2679 * @returns { Promise<boolean> } Promise used to return the active status of the stream. The value true means 2680 * that the stream is active, and false means the opposite. 2681 * @syscap SystemCapability.Multimedia.Audio.Volume 2682 * @since 7 2683 * @deprecated since 9 2684 * @useinstead ohos.multimedia.audio.AudioStreamManager#isActive 2685 */ 2686 isActive(volumeType: AudioVolumeType): Promise<boolean>; 2687 /** 2688 * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. 2689 * @permission ohos.permission.MICROPHONE 2690 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 2691 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2692 * @syscap SystemCapability.Multimedia.Audio.Device 2693 * @since 7 2694 * @deprecated since 9 2695 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicrophoneMute 2696 */ 2697 setMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void; 2698 /** 2699 * Mutes or unmutes the microphone. This method uses a promise to return the result. 2700 * @permission ohos.permission.MICROPHONE 2701 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 2702 * @returns { Promise<void> } Promise used to return the result. 2703 * @syscap SystemCapability.Multimedia.Audio.Device 2704 * @since 7 2705 * @deprecated since 9 2706 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicrophoneMute 2707 */ 2708 setMicrophoneMute(mute: boolean): Promise<void>; 2709 /** 2710 * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. 2711 * @permission ohos.permission.MICROPHONE 2712 * @param { AsyncCallback<boolean> } callback - used to return the mute status of the microphone. The value 2713 * true means that the microphone is muted, and false means the opposite. 2714 * @syscap SystemCapability.Multimedia.Audio.Device 2715 * @since 7 2716 * @deprecated since 9 2717 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMicrophoneMute 2718 */ 2719 isMicrophoneMute(callback: AsyncCallback<boolean>): void; 2720 /** 2721 * Checks whether the microphone is muted. This method uses a promise to return the query result. 2722 * @permission ohos.permission.MICROPHONE 2723 * @returns { Promise<boolean> } Promise used to return the mute status of the microphone. The value 2724 * true means that the microphone is muted, and false means the opposite. 2725 * @syscap SystemCapability.Multimedia.Audio.Device 2726 * @since 7 2727 * @deprecated since 9 2728 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMicrophoneMute 2729 */ 2730 isMicrophoneMute(): Promise<boolean>; 2731 /** 2732 * Sets the ringer mode. This method uses an asynchronous callback to return the result. 2733 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 2734 * @param { AudioRingMode } mode - Ringer mode. 2735 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2736 * @syscap SystemCapability.Multimedia.Audio.Communication 2737 * @since 7 2738 * @deprecated since 9 2739 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setRingerMode 2740 */ 2741 setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void; 2742 /** 2743 * Sets the ringer mode. This method uses a promise to return the result. 2744 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 2745 * @param { AudioRingMode } mode - Ringer mode. 2746 * @returns { Promise<void> } Promise used to return the result. 2747 * @syscap SystemCapability.Multimedia.Audio.Communication 2748 * @since 7 2749 * @deprecated since 9 2750 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setRingerMode 2751 */ 2752 setRingerMode(mode: AudioRingMode): Promise<void>; 2753 /** 2754 * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. 2755 * @param { AsyncCallback<AudioRingMode> } callback - Callback used to return the ringer mode. 2756 * @syscap SystemCapability.Multimedia.Audio.Communication 2757 * @since 7 2758 * @deprecated since 9 2759 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getRingerMode 2760 */ 2761 getRingerMode(callback: AsyncCallback<AudioRingMode>): void; 2762 /** 2763 * Obtains the ringer mode. This method uses a promise to return the query result. 2764 * @returns { Promise<AudioRingMode> } Promise used to return the ringer mode. 2765 * @syscap SystemCapability.Multimedia.Audio.Communication 2766 * @since 7 2767 * @deprecated since 9 2768 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getRingerMode 2769 */ 2770 getRingerMode(): Promise<AudioRingMode>; 2771 /** 2772 * Sets an audio parameter. This method uses an asynchronous callback to return the result. 2773 * @permission ohos.permission.MODIFY_AUDIO_SETTINGS 2774 * @param { string } key - Key of the audio parameter to set. 2775 * @param { string } value - Value of the audio parameter to set. 2776 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2777 * @syscap SystemCapability.Multimedia.Audio.Core 2778 * @since 7 2779 * @deprecated since 11 2780 * @useinstead ohos.multimedia.audio.AudioManager#setExtraParameters 2781 */ 2782 setAudioParameter(key: string, value: string, callback: AsyncCallback<void>): void; 2783 /** 2784 * Sets an audio parameter. This method uses a promise to return the result. 2785 * @permission ohos.permission.MODIFY_AUDIO_SETTINGS 2786 * @param { string } key - Key of the audio parameter to set. 2787 * @param { string } value - Value of the audio parameter to set. 2788 * @returns { Promise<void> } Promise used to return the result. 2789 * @syscap SystemCapability.Multimedia.Audio.Core 2790 * @since 7 2791 * @deprecated since 11 2792 * @useinstead ohos.multimedia.audio.AudioManager#setExtraParameters 2793 */ 2794 setAudioParameter(key: string, value: string): Promise<void>; 2795 2796 /** 2797 * Obtains the value of an audio parameter. This method uses an asynchronous callback to return the query result. 2798 * @param { string } key - Key of the audio parameter whose value is to be obtained. 2799 * @param { AsyncCallback<string> } callback - Callback used to return the value of the audio parameter. 2800 * @syscap SystemCapability.Multimedia.Audio.Core 2801 * @since 7 2802 * @deprecated since 11 2803 * @useinstead ohos.multimedia.audio.AudioManager#getExtraParameters 2804 */ 2805 getAudioParameter(key: string, callback: AsyncCallback<string>): void; 2806 /** 2807 * Obtains the value of an audio parameter. This method uses a promise to return the query result. 2808 * @param { string } key - Key of the audio parameter whose value is to be obtained. 2809 * @returns { Promise<string> } Promise used to return the value of the audio parameter. 2810 * @syscap SystemCapability.Multimedia.Audio.Core 2811 * @since 7 2812 * @deprecated since 11 2813 * @useinstead ohos.multimedia.audio.AudioManager#getExtraParameters 2814 */ 2815 getAudioParameter(key: string): Promise<string>; 2816 2817 /** 2818 * Sets extra audio parameters. This method uses a promise to return the result. 2819 * @permission ohos.permission.MODIFY_AUDIO_SETTINGS 2820 * @param { string } mainKey - Main key of the audio parameters to set. 2821 * @param { Record<string, string> } kvpairs - Key-value pairs with subkeys and values to set. 2822 * @returns { Promise<void> } Promise used to return the result. 2823 * @throws { BusinessError } 201 - Permission denied. 2824 * @throws { BusinessError } 202 - Not system App. 2825 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2826 * 1.Mandatory parameters are left unspecified; 2827 * 2.Incorrect parameter types. 2828 * @throws { BusinessError } 6800101 - Parameter verification failed. 2829 * @syscap SystemCapability.Multimedia.Audio.Core 2830 * @systemapi 2831 * @since 11 2832 */ 2833 setExtraParameters(mainKey: string, kvpairs: Record<string, string>): Promise<void>; 2834 2835 /** 2836 * Obtains the values of a certain key. This method uses a promise to return the query result. 2837 * @param { string } mainKey - Main key of the audio parameters to get. 2838 * @param { Array<string> } subKeys - Sub keys of the audio parameters to get. 2839 * @returns { Promise<Record<string, string>> } Promise used to return the key-value pairs. 2840 * @throws { BusinessError } 202 - Not system App. 2841 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2842 * 1.Mandatory parameters are left unspecified; 2843 * 2.Incorrect parameter types. 2844 * @throws { BusinessError } 6800101 - Parameter verification failed. 2845 * @syscap SystemCapability.Multimedia.Audio.Core 2846 * @systemapi 2847 * @since 11 2848 */ 2849 getExtraParameters(mainKey: string, subKeys?: Array<string>): Promise<Record<string, string>>; 2850 2851 /** 2852 * Sets a device to the active state. This method uses an asynchronous callback to return the result. 2853 * @param { ActiveDeviceType } deviceType - Audio device type. 2854 * @param { boolean } active - Active status to set. The value true means to set the device to the active 2855 * status, and false means the opposite. 2856 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2857 * @syscap SystemCapability.Multimedia.Audio.Device 2858 * @since 7 2859 * @deprecated since 9 2860 * @useinstead ohos.multimedia.audio.AudioRoutingManager#setCommunicationDevice 2861 */ 2862 setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback<void>): void; 2863 /** 2864 * Sets a device to the active state. This method uses a promise to return the result. 2865 * @param { ActiveDeviceType } deviceType - Audio device type. 2866 * @param { boolean } active - Active status to set. The value true means to set the device to the active 2867 * status, and false means the opposite. 2868 * @returns { Promise<void> } Promise used to return the result. 2869 * @syscap SystemCapability.Multimedia.Audio.Device 2870 * @since 7 2871 * @deprecated since 9 2872 * @useinstead ohos.multimedia.audio.AudioRoutingManager#setCommunicationDevice 2873 */ 2874 setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise<void>; 2875 /** 2876 * Checks whether a device is active. This method uses an asynchronous callback to return the query result. 2877 * @param { ActiveDeviceType } deviceType - Audio device type. 2878 * @param { AsyncCallback<boolean> } callback - Callback used to return the active status of the device. 2879 * @syscap SystemCapability.Multimedia.Audio.Device 2880 * @since 7 2881 * @deprecated since 9 2882 * @useinstead ohos.multimedia.audio.AudioRoutingManager#isCommunicationDeviceActive 2883 */ 2884 isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback<boolean>): void; 2885 /** 2886 * Checks whether a device is active. This method uses a promise to return the query result. 2887 * @param { ActiveDeviceType } deviceType - Audio device type. 2888 * @returns { Promise<boolean> } Promise used to return the active status of the device. 2889 * @syscap SystemCapability.Multimedia.Audio.Device 2890 * @since 7 2891 * @deprecated since 9 2892 * @useinstead ohos.multimedia.audio.AudioRoutingManager#isCommunicationDeviceActive 2893 */ 2894 isDeviceActive(deviceType: ActiveDeviceType): Promise<boolean>; 2895 /** 2896 * Listens for system volume change events. This method uses a callback to get volume change events. 2897 * @param { 'volumeChange' } type - Type of the event to listen for. Only the volumeChange event is supported. 2898 * @param { Callback<VolumeEvent> } callback - Callback used to get the system volume change event. 2899 * @syscap SystemCapability.Multimedia.Audio.Volume 2900 * @systemapi 2901 * @since 8 2902 * @deprecated since 9 2903 * @useinstead ohos.multimedia.audio.AudioVolumeManager#event:volumeChange 2904 */ 2905 on(type: 'volumeChange', callback: Callback<VolumeEvent>): void; 2906 /** 2907 * Listens for ringer mode change events. This method uses a callback to get ringer mode changes. 2908 * @param { 'ringerModeChange' } type - Type of the event to listen for. Only the ringerModeChange event is supported. 2909 * @param { Callback<AudioRingMode> } callback - Callback used to get the updated ringer mode. 2910 * @syscap SystemCapability.Multimedia.Audio.Communication 2911 * @systemapi 2912 * @since 8 2913 * @deprecated since 9 2914 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#event:ringerModeChange 2915 */ 2916 on(type: 'ringerModeChange', callback: Callback<AudioRingMode>): void; 2917 /** 2918 * Sets the audio scene mode to change audio strategies. This method uses an asynchronous callback to return the 2919 * result. 2920 * @param { AudioScene } scene - Audio scene mode. 2921 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2922 * @syscap SystemCapability.Multimedia.Audio.Communication 2923 * @systemapi 2924 * @since 8 2925 */ 2926 setAudioScene(scene: AudioScene, callback: AsyncCallback<void>): void; 2927 /** 2928 * Sets the audio scene mode to change audio strategies. This method uses a promise to return the result. 2929 * @param { AudioScene } scene - Audio scene mode. 2930 * @returns { Promise<void> } Promise used to return the result. 2931 * @syscap SystemCapability.Multimedia.Audio.Communication 2932 * @systemapi 2933 * @since 8 2934 */ 2935 setAudioScene(scene: AudioScene): Promise<void>; 2936 /** 2937 * Obtains the audio scene mode. This method uses an asynchronous callback to return the query result. 2938 * @param { AsyncCallback<AudioScene> } callback - Callback used to return the audio scene mode. 2939 * @syscap SystemCapability.Multimedia.Audio.Communication 2940 * @since 8 2941 */ 2942 /** 2943 * Obtains the audio scene mode. This method uses an asynchronous callback to return the query result. 2944 * @param { AsyncCallback<AudioScene> } callback - Callback used to return the audio scene mode. 2945 * @syscap SystemCapability.Multimedia.Audio.Communication 2946 * @crossplatform 2947 * @since 12 2948 */ 2949 getAudioScene(callback: AsyncCallback<AudioScene>): void; 2950 /** 2951 * Obtains the audio scene mode. This method uses a promise to return the query result. 2952 * @returns { Promise<AudioScene> } Promise used to return the audio scene mode. 2953 * @syscap SystemCapability.Multimedia.Audio.Communication 2954 * @since 8 2955 */ 2956 /** 2957 * Obtains the audio scene mode. This method uses a promise to return the query result. 2958 * @returns { Promise<AudioScene> } Promise used to return the audio scene mode. 2959 * @syscap SystemCapability.Multimedia.Audio.Communication 2960 * @crossplatform 2961 * @since 12 2962 */ 2963 getAudioScene(): Promise<AudioScene>; 2964 /** 2965 * Obtains the audio scene mode. 2966 * @returns { AudioScene } Current audio scene mode. 2967 * @syscap SystemCapability.Multimedia.Audio.Communication 2968 * @since 10 2969 */ 2970 /** 2971 * Obtains the audio scene mode. 2972 * @returns { AudioScene } Current audio scene mode. 2973 * @syscap SystemCapability.Multimedia.Audio.Communication 2974 * @crossplatform 2975 * @since 12 2976 */ 2977 getAudioSceneSync(): AudioScene; 2978 2979 /** 2980 * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive 2981 * the callback. 2982 * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. 2983 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 2984 * @syscap SystemCapability.Multimedia.Audio.Device 2985 * @since 7 2986 * @deprecated since 9 2987 * @useinstead ohos.multimedia.audio.AudioRoutingManager#event:deviceChange 2988 */ 2989 on(type: 'deviceChange', callback: Callback<DeviceChangeAction>): void; 2990 2991 /** 2992 * UnSubscribes to device change events. 2993 * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. 2994 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 2995 * @syscap SystemCapability.Multimedia.Audio.Device 2996 * @since 7 2997 * @deprecated since 9 2998 * @useinstead ohos.multimedia.audio.AudioRoutingManager#event:deviceChange 2999 */ 3000 off(type: 'deviceChange', callback?: Callback<DeviceChangeAction>): void; 3001 3002 /** 3003 * Listens for audio interruption events. When the audio of an application is interrupted by another application, 3004 * the callback is invoked to notify the former application. 3005 * @param { 'interrupt' } type - Type of the event to listen for. Only the interrupt event is supported. 3006 * @param { AudioInterrupt } interrupt - Parameters of the audio interruption event type. 3007 * @param { Callback<InterruptAction> } callback - Callback invoked for the audio interruption event. 3008 * @syscap SystemCapability.Multimedia.Audio.Renderer 3009 * @since 7 3010 * @deprecated since 11 3011 * @useinstead ohos.multimedia.audio.AudioRenderer#event:audioInterrupt 3012 */ 3013 on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback<InterruptAction>): void; 3014 3015 /** 3016 * Cancels the listening of audio interruption events. 3017 * @param { 'interrupt' } type - Type of the event to listen for. Only the interrupt event is supported. 3018 * @param { AudioInterrupt } interrupt - Input parameters of the audio interruption event. 3019 * @param { Callback<InterruptAction> } callback - Callback invoked for the audio interruption event. 3020 * @syscap SystemCapability.Multimedia.Audio.Renderer 3021 * @since 7 3022 * @deprecated since 11 3023 * @useinstead ohos.multimedia.audio.AudioRenderer#event:audioInterrupt 3024 */ 3025 off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback<InterruptAction>): void; 3026 3027 /** 3028 * Obtains an {@link AudioVolumeManager} instance. 3029 * @returns { AudioVolumeManager } AudioVolumeManager instance. 3030 * @syscap SystemCapability.Multimedia.Audio.Volume 3031 * @since 9 3032 */ 3033 /** 3034 * Obtains an {@link AudioVolumeManager} instance. 3035 * @returns { AudioVolumeManager } AudioVolumeManager instance. 3036 * @syscap SystemCapability.Multimedia.Audio.Volume 3037 * @crossplatform 3038 * @since 12 3039 */ 3040 getVolumeManager(): AudioVolumeManager; 3041 3042 /** 3043 * Obtains an {@link AudioStreamManager} instance. 3044 * @returns { AudioStreamManager } AudioStreamManager instance. 3045 * @syscap SystemCapability.Multimedia.Audio.Core 3046 * @since 9 3047 */ 3048 /** 3049 * Obtains an {@link AudioStreamManager} instance. 3050 * @returns { AudioStreamManager } AudioStreamManager instance. 3051 * @syscap SystemCapability.Multimedia.Audio.Core 3052 * @crossplatform 3053 * @since 12 3054 */ 3055 getStreamManager(): AudioStreamManager; 3056 3057 /** 3058 * Obtains an {@link AudioRoutingManager} instance. 3059 * @returns { AudioRoutingManager } AudioRoutingManager instance. 3060 * @syscap SystemCapability.Multimedia.Audio.Device 3061 * @since 9 3062 */ 3063 /** 3064 * Obtains an {@link AudioRoutingManager} instance. 3065 * @returns { AudioRoutingManager } AudioRoutingManager instance. 3066 * @syscap SystemCapability.Multimedia.Audio.Device 3067 * @crossplatform 3068 * @since 12 3069 */ 3070 getRoutingManager(): AudioRoutingManager; 3071 3072 /** 3073 * Obtains an {@link AudioSessionManager} instance. 3074 * @returns { AudioSessionManager } AudioSessionManager instance. 3075 * @syscap SystemCapability.Multimedia.Audio.Core 3076 * @crossplatform 3077 * @since 12 3078 */ 3079 getSessionManager(): AudioSessionManager; 3080 3081 /** 3082 * Obtains an {@link AudioSpatializationManager} instance. 3083 * @returns { AudioSpatializationManager } AudioSpatializationManager instance. 3084 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3085 * @since 18 3086 */ 3087 getSpatializationManager(): AudioSpatializationManager; 3088 3089 /** 3090 * Obtains an {@link AudioEffectManager} instance. 3091 * @returns { AudioEffectManager } AudioEffectManager instance. 3092 * @throws { BusinessError } 202 - Not system App. 3093 * @syscap SystemCapability.Multimedia.Audio.Core 3094 * @systemapi 3095 * @since 18 3096 */ 3097 getEffectManager(): AudioEffectManager; 3098 3099 /** 3100 * user disable the safe media volume state. 3101 * @permission ohos.permission.MODIFY_AUDIO_SETTINGS 3102 * @returns { Promise<void> } Promise used to return the result. 3103 * @throws { BusinessError } 201 - Permission denied. 3104 * @throws { BusinessError } 202 - Not system App. 3105 * @syscap SystemCapability.Multimedia.Audio.Core 3106 * @systemapi 3107 * @since 12 3108 */ 3109 disableSafeMediaVolume(): Promise<void>; 3110 } 3111 3112 /** 3113 * Enumerates audio interrupt request result type. 3114 * @enum { number } 3115 * @syscap SystemCapability.Multimedia.Audio.Interrupt 3116 * @systemapi 3117 * @since 9 3118 */ 3119 enum InterruptRequestResultType { 3120 /** 3121 * Request audio interrupt success 3122 * @syscap SystemCapability.Multimedia.Audio.Interrupt 3123 * @systemapi 3124 * @since 9 3125 */ 3126 INTERRUPT_REQUEST_GRANT = 0, 3127 /** 3128 * Request audio interrupt fail, may have higher priority type 3129 * @syscap SystemCapability.Multimedia.Audio.Interrupt 3130 * @systemapi 3131 * @since 9 3132 */ 3133 INTERRUPT_REQUEST_REJECT = 1 3134 } 3135 3136 /** 3137 * Describes audio interrupt operation results. 3138 * @typedef InterruptResult 3139 * @syscap SystemCapability.Multimedia.Audio.Interrupt 3140 * @systemapi 3141 * @since 9 3142 */ 3143 interface InterruptResult { 3144 /** 3145 * Interrupt request or abandon result. 3146 * @type { InterruptRequestResultType } 3147 * @syscap SystemCapability.Multimedia.Audio.Interrupt 3148 * @systemapi 3149 * @since 9 3150 */ 3151 requestResult: InterruptRequestResultType; 3152 /** 3153 * Interrupt node as a unit to receive interrupt change event. 3154 * @type { number } 3155 * @syscap SystemCapability.Multimedia.Audio.Interrupt 3156 * @systemapi 3157 * @since 9 3158 */ 3159 interruptNode: number; 3160 } 3161 3162 /** 3163 * Desribes audio device block status. By default, the device is consider as unblocked. 3164 * @enum { number } 3165 * @syscap SystemCapability.Multimedia.Audio.Device 3166 * @since 13 3167 */ 3168 enum DeviceBlockStatus{ 3169 /** 3170 * Device is unblocked. 3171 * @syscap SystemCapability.Multimedia.Audio.Device 3172 * @since 13 3173 */ 3174 UNBLOCKED = 0, 3175 /** 3176 * Device is blocked. 3177 * @syscap SystemCapability.Multimedia.Audio.Device 3178 * @since 13 3179 */ 3180 BLOCKED = 1, 3181 } 3182 3183 /** 3184 * Desribes audio device block status info. 3185 * @typedef DeviceBlockStatusInfo 3186 * @syscap SystemCapability.Multimedia.Audio.Device 3187 * @since 13 3188 */ 3189 interface DeviceBlockStatusInfo { 3190 /** 3191 * Device block status. 3192 * @type {DeviceBlockStatus} 3193 * @syscap SystemCapability.Multimedia.Audio.Device 3194 * @since 13 3195 */ 3196 blockStatus: DeviceBlockStatus; 3197 3198 /** 3199 * Audio device descriptors whose block status has changed. 3200 * @type {AudioDeviceDescriptors} 3201 * @syscap SystemCapability.Multimedia.Audio.Device 3202 * @since 13 3203 */ 3204 devices: AudioDeviceDescriptors; 3205 } 3206 3207 /** 3208 * Implements audio router management. 3209 * @typedef AudioRoutingManager 3210 * @syscap SystemCapability.Multimedia.Audio.Device 3211 * @since 9 3212 */ 3213 /** 3214 * Implements audio router management. 3215 * @typedef AudioRoutingManager 3216 * @syscap SystemCapability.Multimedia.Audio.Device 3217 * @crossplatform 3218 * @since 12 3219 */ 3220 interface AudioRoutingManager { 3221 /** 3222 * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. 3223 * @param { DeviceFlag } deviceFlag - Audio device flag. 3224 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the device list. 3225 * @syscap SystemCapability.Multimedia.Audio.Device 3226 * @since 9 3227 */ 3228 /** 3229 * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. 3230 * @param { DeviceFlag } deviceFlag - Audio device flag. 3231 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the device list. 3232 * @syscap SystemCapability.Multimedia.Audio.Device 3233 * @crossplatform 3234 * @since 12 3235 */ 3236 getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors>): void; 3237 /** 3238 * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. 3239 * @param { DeviceFlag } deviceFlag - Audio device flag. 3240 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the device list. 3241 * @syscap SystemCapability.Multimedia.Audio.Device 3242 * @since 9 3243 */ 3244 /** 3245 * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. 3246 * @param { DeviceFlag } deviceFlag - Audio device flag. 3247 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the device list. 3248 * @syscap SystemCapability.Multimedia.Audio.Device 3249 * @crossplatform 3250 * @since 12 3251 */ 3252 getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors>; 3253 /** 3254 * Obtains the audio devices with a specific flag. 3255 * @param { DeviceFlag } deviceFlag - Audio device flag. 3256 * @returns { AudioDeviceDescriptors } The device list. 3257 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3258 * 1.Mandatory parameters are left unspecified; 3259 * 2.Incorrect parameter types. 3260 * @throws { BusinessError } 6800101 - Parameter verification failed. 3261 * @syscap SystemCapability.Multimedia.Audio.Device 3262 * @since 10 3263 */ 3264 /** 3265 * Obtains the audio devices with a specific flag. 3266 * @param { DeviceFlag } deviceFlag - Audio device flag. 3267 * @returns { AudioDeviceDescriptors } The device list. 3268 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3269 * 1.Mandatory parameters are left unspecified; 3270 * 2.Incorrect parameter types. 3271 * @throws { BusinessError } 6800101 - Parameter verification failed. 3272 * @syscap SystemCapability.Multimedia.Audio.Device 3273 * @crossplatform 3274 * @since 12 3275 */ 3276 getDevicesSync(deviceFlag: DeviceFlag): AudioDeviceDescriptors; 3277 3278 /** 3279 * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive 3280 * the callback. 3281 * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. 3282 * @param { DeviceFlag } deviceFlag - Audio device flag. 3283 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 3284 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3285 * 1.Mandatory parameters are left unspecified; 3286 * 2.Incorrect parameter types. 3287 * @throws { BusinessError } 6800101 - Parameter verification failed. 3288 * @syscap SystemCapability.Multimedia.Audio.Device 3289 * @since 9 3290 */ 3291 /** 3292 * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive 3293 * the callback. 3294 * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. 3295 * @param { DeviceFlag } deviceFlag - Audio device flag. 3296 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 3297 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3298 * 1.Mandatory parameters are left unspecified; 3299 * 2.Incorrect parameter types. 3300 * @throws { BusinessError } 6800101 - Parameter verification failed. 3301 * @syscap SystemCapability.Multimedia.Audio.Device 3302 * @crossplatform 3303 * @since 12 3304 */ 3305 on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback<DeviceChangeAction>): void; 3306 3307 /** 3308 * UnSubscribes to device change events. 3309 * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. 3310 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 3311 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3312 * 1.Mandatory parameters are left unspecified; 3313 * 2.Incorrect parameter types. 3314 * @throws { BusinessError } 6800101 - Parameter verification failed. 3315 * @syscap SystemCapability.Multimedia.Audio.Device 3316 * @since 9 3317 */ 3318 /** 3319 * UnSubscribes to device change events. 3320 * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. 3321 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 3322 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3323 * 1.Mandatory parameters are left unspecified; 3324 * 2.Incorrect parameter types. 3325 * @throws { BusinessError } 6800101 - Parameter verification failed. 3326 * @syscap SystemCapability.Multimedia.Audio.Device 3327 * @crossplatform 3328 * @since 12 3329 */ 3330 off(type: 'deviceChange', callback?: Callback<DeviceChangeAction>): void; 3331 3332 /** 3333 * Obtains all the available audio devices with a specific device usage. 3334 * @param { DeviceUsage } deviceUsage - Audio device usage. 3335 * @returns { AudioDeviceDescriptors } The device list. 3336 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3337 * 1.Mandatory parameters are left unspecified; 3338 * 2.Incorrect parameter types. 3339 * @throws { BusinessError } 6800101 - Parameter verification failed. 3340 * @syscap SystemCapability.Multimedia.Audio.Device 3341 * @since 12 3342 */ 3343 getAvailableDevices(deviceUsage: DeviceUsage): AudioDeviceDescriptors; 3344 3345 /** 3346 * Subscribes to available device change events. When a device is connected/disconnected, registered clients will receive 3347 * the callback. 3348 * @param { 'availableDeviceChange' } type - Type of the event to listen for. Only the availableDeviceChange event is supported. 3349 * @param { DeviceUsage } deviceUsage - Audio device usage. 3350 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 3351 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3352 * 1.Mandatory parameters are left unspecified; 3353 * 2.Incorrect parameter types. 3354 * @throws { BusinessError } 6800101 - Parameter verification failed. 3355 * @syscap SystemCapability.Multimedia.Audio.Device 3356 * @since 12 3357 */ 3358 on(type: 'availableDeviceChange', deviceUsage: DeviceUsage, callback: Callback<DeviceChangeAction>): void; 3359 3360 /** 3361 * UnSubscribes to available device change events. 3362 * @param { 'availableDeviceChange' } type - Type of the event to listen for. Only the availableDeviceChange event is supported. 3363 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 3364 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3365 * 1.Mandatory parameters are left unspecified; 3366 * 2.Incorrect parameter types. 3367 * @throws { BusinessError } 6800101 - Parameter verification failed. 3368 * @syscap SystemCapability.Multimedia.Audio.Device 3369 * @since 12 3370 */ 3371 off(type: 'availableDeviceChange', callback?: Callback<DeviceChangeAction>): void; 3372 3373 /** 3374 * Sets a device to the active state. This method uses an asynchronous callback to return the result. 3375 * @param { CommunicationDeviceType } deviceType - Audio device type. 3376 * @param { boolean } active - Active status to set. The value true means to set the device to 3377 * the active status, and false means the opposite. 3378 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3379 * @syscap SystemCapability.Multimedia.Audio.Communication 3380 * @since 9 3381 */ 3382 /** 3383 * Sets a device to the active state. This method uses an asynchronous callback to return the result. 3384 * @param { CommunicationDeviceType } deviceType - Audio device type. 3385 * @param { boolean } active - Active status to set. The value true means to set the device to 3386 * the active status, and false means the opposite. 3387 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3388 * @syscap SystemCapability.Multimedia.Audio.Communication 3389 * @crossplatform 3390 * @since 12 3391 */ 3392 setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean, callback: AsyncCallback<void>): void; 3393 /** 3394 * Sets a device to the active state. This method uses a promise to return the result. 3395 * @param { CommunicationDeviceType } deviceType - Audio device type. 3396 * @param { boolean } active - Active status to set. The value true means to set the device to the active status, 3397 * and false means the opposite. 3398 * @returns { Promise<void> } Promise used to return the result. 3399 * @syscap SystemCapability.Multimedia.Audio.Communication 3400 * @since 9 3401 */ 3402 /** 3403 * Sets a device to the active state. This method uses a promise to return the result. 3404 * @param { CommunicationDeviceType } deviceType - Audio device type. 3405 * @param { boolean } active - Active status to set. The value true means to set the device to the active status, 3406 * and false means the opposite. 3407 * @returns { Promise<void> } Promise used to return the result. 3408 * @syscap SystemCapability.Multimedia.Audio.Communication 3409 * @crossplatform 3410 * @since 12 3411 */ 3412 setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean): Promise<void>; 3413 3414 /** 3415 * Checks whether a device is active. This method uses an asynchronous callback to return the query result. 3416 * @param { CommunicationDeviceType } deviceType - Audio device type. 3417 * @param { AsyncCallback<boolean> } callback - Callback used to return the active status of the device. 3418 * @syscap SystemCapability.Multimedia.Audio.Communication 3419 * @since 9 3420 */ 3421 /** 3422 * Checks whether a device is active. This method uses an asynchronous callback to return the query result. 3423 * @param { CommunicationDeviceType } deviceType - Audio device type. 3424 * @param { AsyncCallback<boolean> } callback - Callback used to return the active status of the device. 3425 * @syscap SystemCapability.Multimedia.Audio.Communication 3426 * @crossplatform 3427 * @since 12 3428 */ 3429 isCommunicationDeviceActive(deviceType: CommunicationDeviceType, callback: AsyncCallback<boolean>): void; 3430 /** 3431 * Checks whether a device is active. This method uses a promise to return the query result. 3432 * @param { CommunicationDeviceType } deviceType - Audio device type. 3433 * @returns { Promise<boolean> } Promise used to return the active status of the device. 3434 * @syscap SystemCapability.Multimedia.Audio.Communication 3435 * @since 9 3436 */ 3437 /** 3438 * Checks whether a device is active. This method uses a promise to return the query result. 3439 * @param { CommunicationDeviceType } deviceType - Audio device type. 3440 * @returns { Promise<boolean> } Promise used to return the active status of the device. 3441 * @syscap SystemCapability.Multimedia.Audio.Communication 3442 * @crossplatform 3443 * @since 12 3444 */ 3445 isCommunicationDeviceActive(deviceType: CommunicationDeviceType): Promise<boolean>; 3446 /** 3447 * Checks whether a device is active. 3448 * @param { CommunicationDeviceType } deviceType - Audio device type. 3449 * @returns { boolean } The active status of the device. 3450 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3451 * 1.Mandatory parameters are left unspecified; 3452 * 2.Incorrect parameter types. 3453 * @throws { BusinessError } 6800101 - Parameter verification failed. 3454 * @syscap SystemCapability.Multimedia.Audio.Communication 3455 * @since 10 3456 */ 3457 /** 3458 * Checks whether a device is active. 3459 * @param { CommunicationDeviceType } deviceType - Audio device type. 3460 * @returns { boolean } The active status of the device. 3461 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3462 * 1.Mandatory parameters are left unspecified; 3463 * 2.Incorrect parameter types. 3464 * @throws { BusinessError } 6800101 - Parameter verification failed. 3465 * @syscap SystemCapability.Multimedia.Audio.Communication 3466 * @crossplatform 3467 * @since 12 3468 */ 3469 isCommunicationDeviceActiveSync(deviceType: CommunicationDeviceType): boolean; 3470 3471 /** 3472 * Select the output device. This method uses an asynchronous callback to return the result. 3473 * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description 3474 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3475 * @syscap SystemCapability.Multimedia.Audio.Device 3476 * @systemapi 3477 * @since 9 3478 */ 3479 selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback<void>): void; 3480 /** 3481 * Select the output device. This method uses a promise to return the result. 3482 * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description 3483 * @returns { Promise<void> } Promise used to return the result. 3484 * @syscap SystemCapability.Multimedia.Audio.Device 3485 * @systemapi 3486 * @since 9 3487 */ 3488 selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors): Promise<void>; 3489 3490 /** 3491 * Select the output device with desired AudioRenderer. This method uses an asynchronous callback to return the result. 3492 * @param { AudioRendererFilter } filter - Filter for AudioRenderer. 3493 * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description. 3494 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3495 * @syscap SystemCapability.Multimedia.Audio.Device 3496 * @systemapi 3497 * @since 9 3498 */ 3499 selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback<void>): void; 3500 /** 3501 * Select the output device with desired AudioRenderer. This method uses a promise to return the result. 3502 * @param { AudioRendererFilter } filter - Filter for AudioRenderer. 3503 * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description 3504 * @returns { Promise<void> } Promise used to return the result. 3505 * @syscap SystemCapability.Multimedia.Audio.Device 3506 * @systemapi 3507 * @since 9 3508 */ 3509 selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise<void>; 3510 3511 /** 3512 * Select the input device. This method uses an asynchronous callback to return the result. 3513 * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device description 3514 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3515 * @syscap SystemCapability.Multimedia.Audio.Device 3516 * @systemapi 3517 * @since 9 3518 */ 3519 selectInputDevice(inputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback<void>): void; 3520 /** 3521 * Select the input device. This method uses a promise to return the result. 3522 * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device description 3523 * @returns { Promise<void> } Promise used to return the result. 3524 * @syscap SystemCapability.Multimedia.Audio.Device 3525 * @systemapi 3526 * @since 9 3527 */ 3528 selectInputDevice(inputAudioDevices: AudioDeviceDescriptors): Promise<void>; 3529 3530 /** 3531 * Select the input device with desired AudioCapturer. This method uses a promise to return the result. 3532 * @param { AudioCapturerFilter } filter - Filter for AudioCapturer. 3533 * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device descriptions 3534 * @returns { Promise<void> } Promise used to return the result. 3535 * @throws { BusinessError } 202 - Not system App. 3536 * @throws { BusinessError } 6800101 - Parameter verification failed. 3537 * @syscap SystemCapability.Multimedia.Audio.Device 3538 * @systemapi 3539 * @since 18 3540 */ 3541 selectInputDeviceByFilter(filter: AudioCapturerFilter, inputAudioDevices: AudioDeviceDescriptors): Promise<void>; 3542 3543 /** 3544 * Get output device for target audio renderer info. 3545 * @param { AudioRendererInfo } rendererInfo - Audio renderer information 3546 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the result. 3547 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3548 * 1.Mandatory parameters are left unspecified; 3549 * 2.Incorrect parameter types. 3550 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 3551 * @throws { BusinessError } 6800301 - System error. Return by callback. 3552 * @syscap SystemCapability.Multimedia.Audio.Device 3553 * @since 10 3554 */ 3555 /** 3556 * Get output device for target audio renderer info. 3557 * @param { AudioRendererInfo } rendererInfo - Audio renderer information 3558 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the result. 3559 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3560 * 1.Mandatory parameters are left unspecified; 3561 * 2.Incorrect parameter types. 3562 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 3563 * @throws { BusinessError } 6800301 - System error. Return by callback. 3564 * @syscap SystemCapability.Multimedia.Audio.Device 3565 * @crossplatform 3566 * @since 12 3567 */ 3568 getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo, callback: AsyncCallback<AudioDeviceDescriptors>): void; 3569 /** 3570 * Get output device for target audio renderer info. 3571 * @param { AudioRendererInfo } rendererInfo - Audio renderer information. 3572 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the result. 3573 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3574 * 1.Mandatory parameters are left unspecified; 3575 * 2.Incorrect parameter types. 3576 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 3577 * @throws { BusinessError } 6800301 - System error. Return by promise. 3578 * @syscap SystemCapability.Multimedia.Audio.Device 3579 * @since 10 3580 */ 3581 /** 3582 * Get output device for target audio renderer info. 3583 * @param { AudioRendererInfo } rendererInfo - Audio renderer information. 3584 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the result. 3585 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3586 * 1.Mandatory parameters are left unspecified; 3587 * 2.Incorrect parameter types. 3588 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 3589 * @throws { BusinessError } 6800301 - System error. Return by promise. 3590 * @syscap SystemCapability.Multimedia.Audio.Device 3591 * @crossplatform 3592 * @since 12 3593 */ 3594 getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo): Promise<AudioDeviceDescriptors>; 3595 3596 /** 3597 * Gets preferred output device for target audio renderer info. 3598 * @param { AudioRendererInfo } rendererInfo - Audio renderer information. 3599 * @returns { AudioDeviceDescriptors } The preferred devices. 3600 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3601 * 1.Mandatory parameters are left unspecified; 3602 * 2.Incorrect parameter types. 3603 * @throws { BusinessError } 6800101 - Parameter verification failed. 3604 * @syscap SystemCapability.Multimedia.Audio.Device 3605 * @since 10 3606 */ 3607 /** 3608 * Gets preferred output device for target audio renderer info. 3609 * @param { AudioRendererInfo } rendererInfo - Audio renderer information. 3610 * @returns { AudioDeviceDescriptors } The preferred devices. 3611 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3612 * 1.Mandatory parameters are left unspecified; 3613 * 2.Incorrect parameter types. 3614 * @throws { BusinessError } 6800101 - Parameter verification failed. 3615 * @syscap SystemCapability.Multimedia.Audio.Device 3616 * @crossplatform 3617 * @since 12 3618 */ 3619 getPreferredOutputDeviceForRendererInfoSync(rendererInfo: AudioRendererInfo): AudioDeviceDescriptors; 3620 3621 /** 3622 * Get the preferred output devices by the target audio renderer filter. 3623 * @param { AudioRendererFilter } filter - Audio renderer filter. 3624 * @returns { AudioDeviceDescriptors } The preferred devices. 3625 * @throws { BusinessError } 202 - Not system App. 3626 * @throws { BusinessError } 6800101 - Parameter verification failed. 3627 * @syscap SystemCapability.Multimedia.Audio.Device 3628 * @systemapi 3629 * @since 18 3630 */ 3631 getPreferredOutputDeviceByFilter(filter: AudioRendererFilter): AudioDeviceDescriptors; 3632 3633 /** 3634 * Subscribes to prefer output device change events. When prefer device for target audio renderer info changes, 3635 * registered clients will receive the callback. 3636 * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the 3637 * preferOutputDeviceChangeForRendererInfo event is supported. 3638 * @param { AudioRendererInfo } rendererInfo - Audio renderer information. 3639 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed prefer devices information. 3640 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3641 * 1.Mandatory parameters are left unspecified; 3642 * 2.Incorrect parameter types. 3643 * @throws { BusinessError } 6800101 - Parameter verification failed. 3644 * @syscap SystemCapability.Multimedia.Audio.Device 3645 * @since 10 3646 */ 3647 /** 3648 * Subscribes to prefer output device change events. When prefer device for target audio renderer info changes, 3649 * registered clients will receive the callback. 3650 * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the 3651 * preferOutputDeviceChangeForRendererInfo event is supported. 3652 * @param { AudioRendererInfo } rendererInfo - Audio renderer information. 3653 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed prefer devices information. 3654 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3655 * 1.Mandatory parameters are left unspecified; 3656 * 2.Incorrect parameter types. 3657 * @throws { BusinessError } 6800101 - Parameter verification failed. 3658 * @syscap SystemCapability.Multimedia.Audio.Device 3659 * @crossplatform 3660 * @since 12 3661 */ 3662 on(type: 'preferOutputDeviceChangeForRendererInfo', rendererInfo: AudioRendererInfo, callback: Callback<AudioDeviceDescriptors>): void; 3663 /** 3664 * UnSubscribes to prefer output device change events. 3665 * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the 3666 * preferOutputDeviceChangeForRendererInfo event is supported. 3667 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed prefer devices in subscribe. 3668 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3669 * 1.Mandatory parameters are left unspecified; 3670 * 2.Incorrect parameter types. 3671 * @throws { BusinessError } 6800101 - Parameter verification failed. 3672 * @syscap SystemCapability.Multimedia.Audio.Device 3673 * @since 10 3674 */ 3675 /** 3676 * UnSubscribes to prefer output device change events. 3677 * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the 3678 * preferOutputDeviceChangeForRendererInfo event is supported. 3679 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed prefer devices in subscribe. 3680 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3681 * 1.Mandatory parameters are left unspecified; 3682 * 2.Incorrect parameter types. 3683 * @throws { BusinessError } 6800101 - Parameter verification failed. 3684 * @syscap SystemCapability.Multimedia.Audio.Device 3685 * @crossplatform 3686 * @since 12 3687 */ 3688 off(type: 'preferOutputDeviceChangeForRendererInfo', callback?: Callback<AudioDeviceDescriptors>): void; 3689 3690 /** 3691 * Get input device for target audio capturer info. 3692 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 3693 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the result. 3694 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3695 * 1.Mandatory parameters are left unspecified; 3696 * 2.Incorrect parameter types. 3697 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 3698 * @throws { BusinessError } 6800301 - System error. Return by callback. 3699 * @syscap SystemCapability.Multimedia.Audio.Device 3700 * @since 10 3701 */ 3702 /** 3703 * Get input device for target audio capturer info. 3704 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 3705 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the result. 3706 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3707 * 1.Mandatory parameters are left unspecified; 3708 * 2.Incorrect parameter types. 3709 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 3710 * @throws { BusinessError } 6800301 - System error. Return by callback. 3711 * @syscap SystemCapability.Multimedia.Audio.Device 3712 * @crossplatform 3713 * @since 12 3714 */ 3715 getPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo, callback: AsyncCallback<AudioDeviceDescriptors>): void; 3716 /** 3717 * Get input device for target audio capturer info. 3718 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 3719 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the result. 3720 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3721 * 1.Mandatory parameters are left unspecified; 3722 * 2.Incorrect parameter types. 3723 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 3724 * @throws { BusinessError } 6800301 - System error. Return by promise. 3725 * @syscap SystemCapability.Multimedia.Audio.Device 3726 * @since 10 3727 */ 3728 /** 3729 * Get input device for target audio capturer info. 3730 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 3731 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the result. 3732 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3733 * 1.Mandatory parameters are left unspecified; 3734 * 2.Incorrect parameter types. 3735 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 3736 * @throws { BusinessError } 6800301 - System error. Return by promise. 3737 * @syscap SystemCapability.Multimedia.Audio.Device 3738 * @crossplatform 3739 * @since 12 3740 */ 3741 getPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo): Promise<AudioDeviceDescriptors>; 3742 3743 /** 3744 * Get the preferred input device for the target audio capturer filter. 3745 * @param { AudioCapturerFilter } filter - Audio capturer filter. 3746 * @returns { AudioDeviceDescriptors } The preferred devices. 3747 * @throws { BusinessError } 202 - Not system App. 3748 * @throws { BusinessError } 6800101 - Parameter verification failed. 3749 * @syscap SystemCapability.Multimedia.Audio.Device 3750 * @systemapi 3751 * @since 18 3752 */ 3753 getPreferredInputDeviceByFilter(filter: AudioCapturerFilter): AudioDeviceDescriptors; 3754 3755 /** 3756 * Subscribes to preferred input device change events. When preferred device for target audio capturer info changes, 3757 * registered clients will receive the callback. 3758 * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. 3759 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 3760 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed preferred devices information. 3761 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3762 * 1.Mandatory parameters are left unspecified; 3763 * 2.Incorrect parameter types. 3764 * @throws { BusinessError } 6800101 - Parameter verification failed. 3765 * @syscap SystemCapability.Multimedia.Audio.Device 3766 * @since 10 3767 */ 3768 /** 3769 * Subscribes to preferred input device change events. When preferred device for target audio capturer info changes, 3770 * registered clients will receive the callback. 3771 * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. 3772 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 3773 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed preferred devices information. 3774 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3775 * 1.Mandatory parameters are left unspecified; 3776 * 2.Incorrect parameter types. 3777 * @throws { BusinessError } 6800101 - Parameter verification failed. 3778 * @syscap SystemCapability.Multimedia.Audio.Device 3779 * @crossplatform 3780 * @since 12 3781 */ 3782 on(type: 'preferredInputDeviceChangeForCapturerInfo', capturerInfo: AudioCapturerInfo, callback: Callback<AudioDeviceDescriptors>): void; 3783 /** 3784 * Unsubscribes to preferred input device change events. 3785 * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. 3786 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed preferred devices in subscribe. 3787 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3788 * 1.Mandatory parameters are left unspecified; 3789 * 2.Incorrect parameter types. 3790 * @throws { BusinessError } 6800101 - Parameter verification failed. 3791 * @syscap SystemCapability.Multimedia.Audio.Device 3792 * @since 10 3793 */ 3794 /** 3795 * Unsubscribes to preferred input device change events. 3796 * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. 3797 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed preferred devices in subscribe. 3798 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3799 * 1.Mandatory parameters are left unspecified; 3800 * 2.Incorrect parameter types. 3801 * @throws { BusinessError } 6800101 - Parameter verification failed. 3802 * @syscap SystemCapability.Multimedia.Audio.Device 3803 * @crossplatform 3804 * @since 12 3805 */ 3806 off(type: 'preferredInputDeviceChangeForCapturerInfo', callback?: Callback<AudioDeviceDescriptors>): void; 3807 3808 /** 3809 * Gets preferred input device for target audio capturer info. 3810 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 3811 * @returns { AudioDeviceDescriptors } The preferred devices. 3812 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3813 * 1.Mandatory parameters are left unspecified; 3814 * 2.Incorrect parameter types. 3815 * @throws { BusinessError } 6800101 - Parameter verification failed. 3816 * @syscap SystemCapability.Multimedia.Audio.Device 3817 * @since 10 3818 */ 3819 /** 3820 * Gets preferred input device for target audio capturer info. 3821 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 3822 * @returns { AudioDeviceDescriptors } The preferred devices. 3823 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3824 * 1.Mandatory parameters are left unspecified; 3825 * 2.Incorrect parameter types. 3826 * @throws { BusinessError } 6800101 - Parameter verification failed. 3827 * @syscap SystemCapability.Multimedia.Audio.Device 3828 * @crossplatform 3829 * @since 12 3830 */ 3831 getPreferredInputDeviceForCapturerInfoSync(capturerInfo: AudioCapturerInfo): AudioDeviceDescriptors; 3832 3833 /** 3834 * Query whether microphone block detection is supported on current device. 3835 * @returns { Promise<boolean> } Promise used to return the result. 3836 * @syscap SystemCapability.Multimedia.Audio.Device 3837 * @since 13 3838 */ 3839 isMicBlockDetectionSupported():Promise<boolean>; 3840 3841 /** 3842 * Subscribes microphone blocked events. Before subscribing, users should query whether block detection is supported 3843 * on current device. The caller will receive the callback only when it is recording and the used 3844 * microphones' block status have changed. Currently, block detecting is only support for microphones located on 3845 * the local device. 3846 * @param { 'micBlockStatusChanged' } type - Type of the event to listen for. 3847 * @param { Callback<DeviceBlockStatusInfo> } callback - Callback used to obtain the microphone block status. 3848 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3849 * 1.Mandatory parameters are left unspecified; 3850 * 2.Incorrect parameter types. 3851 * @throws { BusinessError } 6800101 - Parameter verification failed. 3852 * @syscap SystemCapability.Multimedia.Audio.Device 3853 * @since 13 3854 */ 3855 on(type: 'micBlockStatusChanged', callback: Callback<DeviceBlockStatusInfo>): void; 3856 3857 /** 3858 * Unsubscribes microphone blocked events. 3859 * @param { 'microphoneBlockStatusChanged' } type - Type of the event to listen for. 3860 * @param { Callback<DeviceBlockStatusInfo> } callback - Callback used to obtain the microphone block status. 3861 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3862 * 1.Mandatory parameters are left unspecified; 3863 * 2.Incorrect parameter types. 3864 * @throws { BusinessError } 6800101 - Parameter verification failed. 3865 * @syscap SystemCapability.Multimedia.Audio.Device 3866 * @since 13 3867 */ 3868 off(type: 'micBlockStatusChanged', callback?: Callback<DeviceBlockStatusInfo>): void; 3869 3870 /** 3871 * Exclude output devices. After calling this function successfully, audio will not be played on the specified 3872 * devices. Note that only the external ouput device can be excluded by this function. Local output devices is not 3873 * accepted. 3874 * @permission ohos.permission.MANAGE_AUDIO_CONFIG 3875 * @param { DeviceUsage } usage - Device usage, only output device usages can be accepted. 3876 * @param { AudioDeviceDescriptors } devices - The devices to be excluded. 3877 * @returns { Promise<void> } Promise used to return result. 3878 * @throws { BusinessError } 201 - Permisson denied. 3879 * @throws { BusinessError } 202 - Not system application. 3880 * @throws { BusinessError } 6800101 - Parameter verification failed. 3881 * @syscap SystemCapability.Multimedia.Audio.Device 3882 * @systemapi 3883 * @since 18 3884 */ 3885 excludeOutputDevices(usage: DeviceUsage, devices: AudioDeviceDescriptors): Promise<void>; 3886 3887 /** 3888 * Unexclude output devices. 3889 * @permission ohos.permission.MANAGE_AUDIO_CONFIG 3890 * @param { DeviceUsage } usage - Device usage, only output device usages can be accepted. 3891 * @param { AudioDeviceDescriptors } devices - The devices to be unexcluded. 3892 * @returns { Promise<void> } Promise used to return result. 3893 * @throws { BusinessError } 201 - Permisson denied. 3894 * @throws { BusinessError } 202 - Not system application. 3895 * @throws { BusinessError } 6800101 - Parameter verification failed. 3896 * @syscap SystemCapability.Multimedia.Audio.Device 3897 * @systemapi 3898 * @since 18 3899 */ 3900 unexcludeOutputDevices(usage: DeviceUsage, devices: AudioDeviceDescriptors): Promise<void>; 3901 3902 /** 3903 * Unexclude output devices. This function will unexclude all output devices belong to specific usage. 3904 * @permission ohos.permission.MANAGE_AUDIO_CONFIG 3905 * @param { DeviceUsage } usage - Device usage, only output device usages can be accepted. 3906 * @returns { Promise<void> } Promise used to return result. 3907 * @throws { BusinessError } 201 - Permisson denied. 3908 * @throws { BusinessError } 202 - Not system application. 3909 * @throws { BusinessError } 6800101 - Parameter verification failed. 3910 * @syscap SystemCapability.Multimedia.Audio.Device 3911 * @systemapi 3912 * @since 18 3913 */ 3914 unexcludeOutputDevices(usage: DeviceUsage): Promise<void>; 3915 3916 /** 3917 * Get excluded devices by filter. 3918 * @param { DeviceUsage } usage - Device usage, only output device usages can be accepted. 3919 * @returns { AudioDeviceDescriptors } Exclueded devices. 3920 * @throws { BusinessError } 202 - Not system application. 3921 * @throws { BusinessError } 6800101 - Parameter verification failed. 3922 * @syscap SystemCapability.Multimedia.Audio.Device 3923 * @systemapi 3924 * @since 18 3925 */ 3926 getExcludedDevices(usage: DeviceUsage): AudioDeviceDescriptors; 3927 } 3928 3929 /** 3930 * Implements audio stream management. 3931 * @typedef AudioStreamManager 3932 * @syscap SystemCapability.Multimedia.Audio.Core 3933 * @since 9 3934 */ 3935 /** 3936 * Implements audio stream management. 3937 * @typedef AudioStreamManager 3938 * @syscap SystemCapability.Multimedia.Audio.Core 3939 * @crossplatform 3940 * @since 12 3941 */ 3942 interface AudioStreamManager { 3943 /** 3944 * Get information of current existing audio renderers. 3945 * @param { AsyncCallback<AudioRendererChangeInfoArray> } callback - Callback used to return the information 3946 * of current existing audio renderers. 3947 * @syscap SystemCapability.Multimedia.Audio.Renderer 3948 * @since 9 3949 */ 3950 /** 3951 * Get information of current existing audio renderers. 3952 * @param { AsyncCallback<AudioRendererChangeInfoArray> } callback - Callback used to return the information 3953 * of current existing audio renderers. 3954 * @syscap SystemCapability.Multimedia.Audio.Renderer 3955 * @crossplatform 3956 * @since 12 3957 */ 3958 getCurrentAudioRendererInfoArray(callback: AsyncCallback<AudioRendererChangeInfoArray>): void; 3959 3960 /** 3961 * Get information of current existing audio renderers. 3962 * @returns { Promise<AudioRendererChangeInfoArray> } Promise used to return the information of current 3963 * existing audio renderers. 3964 * @syscap SystemCapability.Multimedia.Audio.Renderer 3965 * @since 9 3966 */ 3967 /** 3968 * Get information of current existing audio renderers. 3969 * @returns { Promise<AudioRendererChangeInfoArray> } Promise used to return the information of current 3970 * existing audio renderers. 3971 * @syscap SystemCapability.Multimedia.Audio.Renderer 3972 * @crossplatform 3973 * @since 12 3974 */ 3975 getCurrentAudioRendererInfoArray(): Promise<AudioRendererChangeInfoArray>; 3976 3977 /** 3978 * Get information of current existing audio renderers. 3979 * @returns { AudioRendererChangeInfoArray } The information of current existing audio renderers. 3980 * @syscap SystemCapability.Multimedia.Audio.Renderer 3981 * @since 10 3982 */ 3983 /** 3984 * Get information of current existing audio renderers. 3985 * @returns { AudioRendererChangeInfoArray } The information of current existing audio renderers. 3986 * @syscap SystemCapability.Multimedia.Audio.Renderer 3987 * @crossplatform 3988 * @since 12 3989 */ 3990 getCurrentAudioRendererInfoArraySync(): AudioRendererChangeInfoArray; 3991 3992 /** 3993 * Get information of current existing audio capturers. 3994 * @param { AsyncCallback<AudioCapturerChangeInfoArray> } callback - Callback used to return the information 3995 * of current existing audio capturers. 3996 * @syscap SystemCapability.Multimedia.Audio.Renderer 3997 * @since 9 3998 */ 3999 /** 4000 * Get information of current existing audio capturers. 4001 * @param { AsyncCallback<AudioCapturerChangeInfoArray> } callback - Callback used to return the information 4002 * of current existing audio capturers. 4003 * @syscap SystemCapability.Multimedia.Audio.Renderer 4004 * @crossplatform 4005 * @since 12 4006 */ 4007 getCurrentAudioCapturerInfoArray(callback: AsyncCallback<AudioCapturerChangeInfoArray>): void; 4008 4009 /** 4010 * Get information of current existing audio capturers. 4011 * @returns { Promise<AudioCapturerChangeInfoArray> } Promise used to return the information of current existing 4012 * audio capturers. 4013 * @syscap SystemCapability.Multimedia.Audio.Renderer 4014 * @since 9 4015 */ 4016 /** 4017 * Get information of current existing audio capturers. 4018 * @returns { Promise<AudioCapturerChangeInfoArray> } Promise used to return the information of current existing 4019 * audio capturers. 4020 * @syscap SystemCapability.Multimedia.Audio.Renderer 4021 * @crossplatform 4022 * @since 12 4023 */ 4024 getCurrentAudioCapturerInfoArray(): Promise<AudioCapturerChangeInfoArray>; 4025 4026 /** 4027 * Get information of current existing audio capturers. 4028 * @returns { AudioCapturerChangeInfoArray } The information of current existing audio capturers. 4029 * @syscap SystemCapability.Multimedia.Audio.Capturer 4030 * @since 10 4031 */ 4032 /** 4033 * Get information of current existing audio capturers. 4034 * @returns { AudioCapturerChangeInfoArray } The information of current existing audio capturers. 4035 * @syscap SystemCapability.Multimedia.Audio.Capturer 4036 * @crossplatform 4037 * @since 12 4038 */ 4039 getCurrentAudioCapturerInfoArraySync(): AudioCapturerChangeInfoArray; 4040 4041 /** 4042 * Gets information of audio effects. 4043 * @param { StreamUsage } usage - Stream usage. 4044 * @param { AsyncCallback<AudioEffectInfoArray> } callback - Callback used to return the information of audio effects. 4045 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4046 * 1.Mandatory parameters are left unspecified; 4047 * 2.Incorrect parameter types. 4048 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 4049 * @syscap SystemCapability.Multimedia.Audio.Renderer 4050 * @since 10 4051 */ 4052 getAudioEffectInfoArray(usage: StreamUsage, callback: AsyncCallback<AudioEffectInfoArray>): void; 4053 4054 /** 4055 * Gets information of audio effects. 4056 * @param { StreamUsage } usage - Stream usage. 4057 * @returns { Promise<AudioEffectInfoArray> } Promise used to return the information of audio effects. 4058 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4059 * 1.Mandatory parameters are left unspecified; 4060 * 2.Incorrect parameter types. 4061 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 4062 * @syscap SystemCapability.Multimedia.Audio.Renderer 4063 * @since 10 4064 */ 4065 getAudioEffectInfoArray(usage: StreamUsage): Promise<AudioEffectInfoArray>; 4066 4067 /** 4068 * Gets information of audio effects. 4069 * @param { StreamUsage } usage - Stream usage. 4070 * @returns { AudioEffectInfoArray } The information of audio effects. 4071 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4072 * 1.Mandatory parameters are left unspecified; 4073 * 2.Incorrect parameter types. 4074 * @throws { BusinessError } 6800101 - Parameter verification failed. 4075 * @syscap SystemCapability.Multimedia.Audio.Renderer 4076 * @since 10 4077 */ 4078 getAudioEffectInfoArraySync(usage: StreamUsage): AudioEffectInfoArray; 4079 4080 /** 4081 * Listens for audio renderer change events. When there is any audio renderer change, 4082 * registered clients will receive the callback. 4083 * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. 4084 * @param { Callback<AudioRendererChangeInfoArray> } callback - Callback invoked for the audio renderer change event. 4085 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4086 * 1.Mandatory parameters are left unspecified; 4087 * 2.Incorrect parameter types. 4088 * @throws { BusinessError } 6800101 - Parameter verification failed. 4089 * @syscap SystemCapability.Multimedia.Audio.Renderer 4090 * @since 9 4091 */ 4092 /** 4093 * Listens for audio renderer change events. When there is any audio renderer change, 4094 * registered clients will receive the callback. 4095 * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. 4096 * @param { Callback<AudioRendererChangeInfoArray> } callback - Callback invoked for the audio renderer change event. 4097 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4098 * 1.Mandatory parameters are left unspecified; 4099 * 2.Incorrect parameter types. 4100 * @throws { BusinessError } 6800101 - Parameter verification failed. 4101 * @syscap SystemCapability.Multimedia.Audio.Renderer 4102 * @crossplatform 4103 * @since 12 4104 */ 4105 on(type: 'audioRendererChange', callback: Callback<AudioRendererChangeInfoArray>): void; 4106 4107 /** 4108 * UnSubscribes to audio renderer change events. 4109 * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. 4110 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4111 * 1.Mandatory parameters are left unspecified; 4112 * 2.Incorrect parameter types. 4113 * @throws { BusinessError } 6800101 - Parameter verification failed. 4114 * @syscap SystemCapability.Multimedia.Audio.Renderer 4115 * @since 9 4116 */ 4117 /** 4118 * UnSubscribes to audio renderer change events. 4119 * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. 4120 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4121 * 1.Mandatory parameters are left unspecified; 4122 * 2.Incorrect parameter types. 4123 * @throws { BusinessError } 6800101 - Parameter verification failed. 4124 * @syscap SystemCapability.Multimedia.Audio.Renderer 4125 * @crossplatform 4126 * @since 12 4127 */ 4128 /** 4129 * Unsubscribes to audio renderer change events. 4130 * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. 4131 * @param { Callback<AudioRendererChangeInfoArray> } callback - Callback invoked for the audio renderer change event. 4132 * @throws { BusinessError } 6800101 - Parameter verification failed. 4133 * @syscap SystemCapability.Multimedia.Audio.Renderer 4134 * @crossplatform 4135 * @since 18 4136 */ 4137 off(type: 'audioRendererChange', callback?: Callback<AudioRendererChangeInfoArray>): void; 4138 4139 /** 4140 * Listens for audio capturer change events. When there is any audio capturer change, 4141 * registered clients will receive the callback. 4142 * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. 4143 * @param { Callback<AudioCapturerChangeInfoArray> } callback - Callback invoked for the audio capturer change event. 4144 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4145 * 1.Mandatory parameters are left unspecified; 4146 * 2.Incorrect parameter types. 4147 * @throws { BusinessError } 6800101 - Parameter verification failed. 4148 * @syscap SystemCapability.Multimedia.Audio.Capturer 4149 * @since 9 4150 */ 4151 /** 4152 * Listens for audio capturer change events. When there is any audio capturer change, 4153 * registered clients will receive the callback. 4154 * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. 4155 * @param { Callback<AudioCapturerChangeInfoArray> } callback - Callback invoked for the audio capturer change event. 4156 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4157 * 1.Mandatory parameters are left unspecified; 4158 * 2.Incorrect parameter types. 4159 * @throws { BusinessError } 6800101 - Parameter verification failed. 4160 * @syscap SystemCapability.Multimedia.Audio.Capturer 4161 * @crossplatform 4162 * @since 12 4163 */ 4164 on(type: 'audioCapturerChange', callback: Callback<AudioCapturerChangeInfoArray>): void; 4165 4166 /** 4167 * UnSubscribes to audio capturer change events. 4168 * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. 4169 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4170 * 1.Mandatory parameters are left unspecified; 4171 * 2.Incorrect parameter types. 4172 * @throws { BusinessError } 6800101 - Parameter verification failed. 4173 * @syscap SystemCapability.Multimedia.Audio.Capturer 4174 * @since 9 4175 */ 4176 /** 4177 * UnSubscribes to audio capturer change events. 4178 * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. 4179 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4180 * 1.Mandatory parameters are left unspecified; 4181 * 2.Incorrect parameter types. 4182 * @throws { BusinessError } 6800101 - Parameter verification failed. 4183 * @syscap SystemCapability.Multimedia.Audio.Capturer 4184 * @crossplatform 4185 * @since 12 4186 */ 4187 /** 4188 * Unsubscribes to audio capturer change events. 4189 * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. 4190 * @param { Callback<AudioCapturerChangeInfoArray> } callback - Callback invoked for the audio capturer change event. 4191 * @throws { BusinessError } 6800101 - Parameter verification failed. 4192 * @syscap SystemCapability.Multimedia.Audio.Capturer 4193 * @crossplatform 4194 * @since 18 4195 */ 4196 off(type: 'audioCapturerChange', callback?: Callback<AudioCapturerChangeInfoArray>): void; 4197 4198 /** 4199 * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. 4200 * @param { AudioVolumeType } volumeType - Audio stream type. 4201 * @param { AsyncCallback<boolean> } callback - Callback used to return the active status of the stream. 4202 * The value true means that the stream is active, and false means the opposite. 4203 * @syscap SystemCapability.Multimedia.Audio.Renderer 4204 * @since 9 4205 */ 4206 /** 4207 * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. 4208 * @param { AudioVolumeType } volumeType - Audio stream type. 4209 * @param { AsyncCallback<boolean> } callback - Callback used to return the active status of the stream. 4210 * The value true means that the stream is active, and false means the opposite. 4211 * @syscap SystemCapability.Multimedia.Audio.Renderer 4212 * @crossplatform 4213 * @since 12 4214 */ 4215 isActive(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void; 4216 /** 4217 * Checks whether a stream is active. This method uses a promise to return the query result. 4218 * @param { AudioVolumeType } volumeType - Audio stream type. 4219 * @returns { Promise<boolean> } Promise used to return the active status of the stream. The value 4220 * true means that the stream is active, and false means the opposite. 4221 * @syscap SystemCapability.Multimedia.Audio.Renderer 4222 * @since 9 4223 */ 4224 /** 4225 * Checks whether a stream is active. This method uses a promise to return the query result. 4226 * @param { AudioVolumeType } volumeType - Audio stream type. 4227 * @returns { Promise<boolean> } Promise used to return the active status of the stream. The value 4228 * true means that the stream is active, and false means the opposite. 4229 * @syscap SystemCapability.Multimedia.Audio.Renderer 4230 * @crossplatform 4231 * @since 12 4232 */ 4233 isActive(volumeType: AudioVolumeType): Promise<boolean>; 4234 /** 4235 * Checks whether a stream is active. 4236 * @param { AudioVolumeType } volumeType - Audio stream type. 4237 * @returns { boolean } The active status of the stream. 4238 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4239 * 1.Mandatory parameters are left unspecified; 4240 * 2.Incorrect parameter types. 4241 * @throws { BusinessError } 6800101 - Parameter verification failed. 4242 * @syscap SystemCapability.Multimedia.Audio.Renderer 4243 * @since 10 4244 */ 4245 /** 4246 * Checks whether a stream is active. 4247 * @param { AudioVolumeType } volumeType - Audio stream type. 4248 * @returns { boolean } The active status of the stream. 4249 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4250 * 1.Mandatory parameters are left unspecified; 4251 * 2.Incorrect parameter types. 4252 * @throws { BusinessError } 6800101 - Parameter verification failed. 4253 * @syscap SystemCapability.Multimedia.Audio.Renderer 4254 * @crossplatform 4255 * @since 12 4256 */ 4257 isActiveSync(volumeType: AudioVolumeType): boolean; 4258 } 4259 4260 /** 4261 * Audio concurrency mode. 4262 * @enum { number } 4263 * @syscap SystemCapability.Multimedia.Audio.Core 4264 * @crossplatform 4265 * @since 12 4266 */ 4267 enum AudioConcurrencyMode { 4268 /** 4269 * Default concurrency mode. 4270 * @syscap SystemCapability.Multimedia.Audio.Core 4271 * @crossplatform 4272 * @since 12 4273 */ 4274 CONCURRENCY_DEFAULT = 0, 4275 /** 4276 * Mix with others mode. 4277 * @syscap SystemCapability.Multimedia.Audio.Core 4278 * @crossplatform 4279 * @since 12 4280 */ 4281 CONCURRENCY_MIX_WITH_OTHERS = 1, 4282 /** 4283 * Duck others mode. 4284 * @syscap SystemCapability.Multimedia.Audio.Core 4285 * @crossplatform 4286 * @since 12 4287 */ 4288 CONCURRENCY_DUCK_OTHERS = 2, 4289 /** 4290 * Pause others mode. 4291 * @syscap SystemCapability.Multimedia.Audio.Core 4292 * @crossplatform 4293 * @since 12 4294 */ 4295 CONCURRENCY_PAUSE_OTHERS = 3, 4296 } 4297 4298 /** 4299 * Audio session deactivated reason. 4300 * @enum { number } 4301 * @syscap SystemCapability.Multimedia.Audio.Core 4302 * @crossplatform 4303 * @since 12 4304 */ 4305 enum AudioSessionDeactivatedReason { 4306 /** 4307 * Lower priority. 4308 * @syscap SystemCapability.Multimedia.Audio.Core 4309 * @crossplatform 4310 * @since 12 4311 */ 4312 DEACTIVATED_LOWER_PRIORITY = 0, 4313 /** 4314 * Time out. 4315 * @syscap SystemCapability.Multimedia.Audio.Core 4316 * @crossplatform 4317 * @since 12 4318 */ 4319 DEACTIVATED_TIMEOUT = 1, 4320 } 4321 4322 /** 4323 * Audio session strategy. 4324 * @typedef AudioSessionStrategy 4325 * @syscap SystemCapability.Multimedia.Audio.Core 4326 * @crossplatform 4327 * @since 12 4328 */ 4329 interface AudioSessionStrategy { 4330 /** 4331 * Audio concurrency mode. 4332 * @type { AudioConcurrencyMode } 4333 * @syscap SystemCapability.Multimedia.Audio.Core 4334 * @crossplatform 4335 * @since 12 4336 */ 4337 concurrencyMode: AudioConcurrencyMode; 4338 } 4339 4340 /** 4341 * Audio session deactivated event. 4342 * @typedef AudioSessionDeactivatedEvent 4343 * @syscap SystemCapability.Multimedia.Audio.Core 4344 * @crossplatform 4345 * @since 12 4346 */ 4347 interface AudioSessionDeactivatedEvent { 4348 /** 4349 * Audio session deactivated reason. 4350 * @type { AudioSessionDeactivatedReason } 4351 * @syscap SystemCapability.Multimedia.Audio.Core 4352 * @crossplatform 4353 * @since 12 4354 */ 4355 reason: AudioSessionDeactivatedReason; 4356 } 4357 4358 /** 4359 * Implements audio session management. 4360 * @typedef AudioSessionManager 4361 * @syscap SystemCapability.Multimedia.Audio.Core 4362 * @crossplatform 4363 * @since 12 4364 */ 4365 interface AudioSessionManager { 4366 /** 4367 * Activate the audio session for the current pid application. 4368 * @param { AudioSessionStrategy } strategy - Audio session strategy. 4369 * @returns { Promise<void> } Promise used to return the result. 4370 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4371 * 1.Mandatory parameters unspecified. 4372 * 2.Incorrect parameter types. 4373 * @throws { BusinessError } 6800101 - Parameter verification failed. 4374 * @throws { BusinessError } 6800301 - System error. Returned by promise. 4375 * @syscap SystemCapability.Multimedia.Audio.Core 4376 * @crossplatform 4377 * @since 12 4378 */ 4379 activateAudioSession(strategy: AudioSessionStrategy): Promise<void>; 4380 4381 /** 4382 * Deactivate the audio session for the current pid application. 4383 * @returns { Promise<void> } Promise used to return the result. 4384 * @throws { BusinessError } 6800301 - System error. Returned by promise. 4385 * @syscap SystemCapability.Multimedia.Audio.Core 4386 * @crossplatform 4387 * @since 12 4388 */ 4389 deactivateAudioSession(): Promise<void>; 4390 4391 /** 4392 * Check whether the audio session is activated for the current pid application. 4393 * @returns { boolean } The active audio session status for the current pid application. 4394 * @syscap SystemCapability.Multimedia.Audio.Core 4395 * @crossplatform 4396 * @since 12 4397 */ 4398 isAudioSessionActivated(): boolean; 4399 4400 /** 4401 * Listens for audio session deactivated event. When the audio session is deactivated, 4402 * registered clients will receive the callback. 4403 * @param { 'audioSessionDeactivated' } type - Type of the event to listen for. Only the audioSessionDeactivated event is supported. 4404 * @param { Callback<AudioSessionDeactivatedEvent> } callback - Callback invoked for the audio session deactivated event. 4405 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4406 * 1.Mandatory parameters unspecified. 4407 * 2.Incorrect parameter types. 4408 * @throws { BusinessError } 6800101 - Parameter verification failed. 4409 * @syscap SystemCapability.Multimedia.Audio.Core 4410 * @crossplatform 4411 * @since 12 4412 */ 4413 on(type: 'audioSessionDeactivated', callback: Callback<AudioSessionDeactivatedEvent>): void; 4414 4415 /** 4416 * Unsubscribes to audio session deactivated event. 4417 * @param { 'audioSessionDeactivated' } type - Type of the event to listen for. Only the audioSessionDeactivated event is supported. 4418 * @param { Callback<AudioSessionDeactivatedEvent> } callback - Callback invoked for the audio session deactivated event. 4419 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4420 * 1.Mandatory parameters are left unspecified; 4421 * 2.Incorrect parameter types. 4422 * @throws { BusinessError } 6800101 - Parameter verification failed. 4423 * @syscap SystemCapability.Multimedia.Audio.Core 4424 * @crossplatform 4425 * @since 12 4426 */ 4427 off(type: 'audioSessionDeactivated', callback?: Callback<AudioSessionDeactivatedEvent>): void; 4428 } 4429 4430 /** 4431 * Implements audio volume management. 4432 * @typedef AudioVolumeManager 4433 * @syscap SystemCapability.Multimedia.Audio.Volume 4434 * @since 9 4435 */ 4436 /** 4437 * Implements audio volume management. 4438 * @typedef AudioVolumeManager 4439 * @syscap SystemCapability.Multimedia.Audio.Volume 4440 * @crossplatform 4441 * @since 12 4442 */ 4443 interface AudioVolumeManager { 4444 /** 4445 * Get the volume group list for a networkId. This method uses an asynchronous callback to return the result. 4446 * @param { string } networkId - Distributed deice net work id 4447 * @param { AsyncCallback<VolumeGroupInfos> } callback - Callback used to return the result. 4448 * @syscap SystemCapability.Multimedia.Audio.Volume 4449 * @systemapi 4450 * @since 9 4451 */ 4452 getVolumeGroupInfos(networkId: string, callback: AsyncCallback<VolumeGroupInfos>): void; 4453 /** 4454 * Get the volume group list for a networkId. This method uses a promise to return the result. 4455 * @param { string } networkId - Distributed deice net work id 4456 * @returns { Promise<VolumeGroupInfos> } Promise used to return the result. 4457 * @syscap SystemCapability.Multimedia.Audio.Volume 4458 * @systemapi 4459 * @since 9 4460 */ 4461 getVolumeGroupInfos(networkId: string): Promise<VolumeGroupInfos>; 4462 /** 4463 * Get the volume group list for a networkId. 4464 * @param { string } networkId - Distributed deice net work id 4465 * @returns { VolumeGroupInfos } Volume group info list. 4466 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4467 * 1.Mandatory parameters are left unspecified; 4468 * 2.Incorrect parameter types. 4469 * @throws { BusinessError } 6800101 - Parameter verification failed. 4470 * @syscap SystemCapability.Multimedia.Audio.Volume 4471 * @systemapi 4472 * @since 10 4473 */ 4474 getVolumeGroupInfosSync(networkId: string): VolumeGroupInfos; 4475 4476 /** 4477 * Obtains an AudioVolumeGroupManager instance. This method uses an asynchronous callback to return the result. 4478 * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default 4479 * @param { AsyncCallback<AudioVolumeGroupManager> } callback - Callback used to return the result. 4480 * @syscap SystemCapability.Multimedia.Audio.Volume 4481 * @since 9 4482 */ 4483 /** 4484 * Obtains an AudioVolumeGroupManager instance. This method uses an asynchronous callback to return the result. 4485 * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default 4486 * @param { AsyncCallback<AudioVolumeGroupManager> } callback - Callback used to return the result. 4487 * @syscap SystemCapability.Multimedia.Audio.Volume 4488 * @crossplatform 4489 * @since 12 4490 */ 4491 getVolumeGroupManager(groupId: number, callback: AsyncCallback<AudioVolumeGroupManager>): void; 4492 /** 4493 * Obtains an AudioVolumeGroupManager instance. This method uses a promise to return the result. 4494 * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default 4495 * @returns { Promise<AudioVolumeGroupManager> } Promise used to return the result. 4496 * @syscap SystemCapability.Multimedia.Audio.Volume 4497 * @since 9 4498 */ 4499 /** 4500 * Obtains an AudioVolumeGroupManager instance. This method uses a promise to return the result. 4501 * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default 4502 * @returns { Promise<AudioVolumeGroupManager> } Promise used to return the result. 4503 * @syscap SystemCapability.Multimedia.Audio.Volume 4504 * @crossplatform 4505 * @since 12 4506 */ 4507 getVolumeGroupManager(groupId: number): Promise<AudioVolumeGroupManager>; 4508 /** 4509 * Obtains an AudioVolumeGroupManager instance. 4510 * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default 4511 * @returns { AudioVolumeGroupManager } The audio volume group manager instance. 4512 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4513 * 1.Mandatory parameters are left unspecified; 4514 * 2.Incorrect parameter types. 4515 * @throws { BusinessError } 6800101 - Parameter verification failed. 4516 * @syscap SystemCapability.Multimedia.Audio.Volume 4517 * @since 10 4518 */ 4519 /** 4520 * Obtains an AudioVolumeGroupManager instance. 4521 * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default 4522 * @returns { AudioVolumeGroupManager } The audio volume group manager instance. 4523 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4524 * 1.Mandatory parameters are left unspecified; 4525 * 2.Incorrect parameter types. 4526 * @throws { BusinessError } 6800101 - Parameter verification failed. 4527 * @syscap SystemCapability.Multimedia.Audio.Volume 4528 * @crossplatform 4529 * @since 12 4530 */ 4531 getVolumeGroupManagerSync(groupId: number): AudioVolumeGroupManager; 4532 4533 /** 4534 * Listens for system volume change events. This method uses a callback to get volume change events. 4535 * @param { 'volumeChange' } type - Type of the event to listen for. Only the volumeChange event is supported. 4536 * @param { Callback<VolumeEvent> } callback - Callback used to get the system volume change event. 4537 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4538 * 1.Mandatory parameters are left unspecified; 4539 * 2.Incorrect parameter types. 4540 * @throws { BusinessError } 6800101 - Parameter verification failed. 4541 * @syscap SystemCapability.Multimedia.Audio.Volume 4542 * @since 9 4543 */ 4544 /** 4545 * Listens for system volume change events. This method uses a callback to get volume change events. 4546 * @param { 'volumeChange' } type - Type of the event to listen for. Only the volumeChange event is supported. 4547 * @param { Callback<VolumeEvent> } callback - Callback used to get the system volume change event. 4548 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4549 * 1.Mandatory parameters are left unspecified; 4550 * 2.Incorrect parameter types. 4551 * @throws { BusinessError } 6800101 - Parameter verification failed. 4552 * @syscap SystemCapability.Multimedia.Audio.Volume 4553 * @crossplatform 4554 * @since 12 4555 */ 4556 on(type: 'volumeChange', callback: Callback<VolumeEvent>): void; 4557 4558 /** 4559 * Unsubscribes to the volume change events.. 4560 * @param { 'volumeChange' } type - Type of the event to be unregistered. Only the volumeChange event is supported. 4561 * @param { Callback<VolumeEvent> } callback - Callback used to obtain the invoking volume change event. 4562 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4563 * 1.Mandatory parameters missing; 4564 * 2.Incorrect parameter types. 4565 * @throws { BusinessError } 6800101 - Parameter verification failed. 4566 * @syscap SystemCapability.Multimedia.Audio.Volume 4567 * @since 12 4568 */ 4569 off(type: 'volumeChange', callback?: Callback<VolumeEvent>): void; 4570 } 4571 4572 /** 4573 * Implements audio volume group management. 4574 * @typedef AudioVolumeGroupManager 4575 * @syscap SystemCapability.Multimedia.Audio.Volume 4576 * @since 9 4577 */ 4578 /** 4579 * Implements audio volume group management. 4580 * @typedef AudioVolumeGroupManager 4581 * @syscap SystemCapability.Multimedia.Audio.Volume 4582 * @crossplatform 4583 * @since 12 4584 */ 4585 interface AudioVolumeGroupManager { 4586 /** 4587 * Sets the volume for a stream. This method uses an asynchronous callback to return the result. 4588 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 4589 * @param { AudioVolumeType } volumeType - Audio stream type. 4590 * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. 4591 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4592 * @syscap SystemCapability.Multimedia.Audio.Volume 4593 * @systemapi 4594 * @since 9 4595 */ 4596 setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback<void>): void; 4597 /** 4598 * Sets the volume for a stream. This method uses a promise to return the result. 4599 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 4600 * @param { AudioVolumeType } volumeType - Audio stream type. 4601 * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. 4602 * @returns { Promise<void> } Promise used to return the result. 4603 * @syscap SystemCapability.Multimedia.Audio.Volume 4604 * @systemapi 4605 * @since 9 4606 */ 4607 setVolume(volumeType: AudioVolumeType, volume: number): Promise<void>; 4608 4609 /** 4610 * Sets the volume for a stream. This method uses a promise to return the result. 4611 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 4612 * @param { AudioVolumeType } volumeType - Audio stream type. 4613 * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. 4614 * @param { number } flags - volume flags used to enable different operations, can be union of {@link VolumeFlag} 4615 * @returns { Promise<void> } Promise used to return the result. 4616 * @throws { BusinessError } 201 - Permission denied. 4617 * @throws { BusinessError } 202 - Not system App. 4618 * @syscap SystemCapability.Multimedia.Audio.Volume 4619 * @systemapi 4620 * @since 12 4621 */ 4622 setVolumeWithFlag(volumeType: AudioVolumeType, volume: number, flags: number): Promise<void>; 4623 4624 /** 4625 * Obtains the active volume type in the calling moment. This method returns in sync mode. 4626 * @param { number } uid - The target uid's active volume type or 4627 * 0 which means the global active volume type. 4628 * @returns { AudioVolumeType } Current active volume type. 4629 * @throws { BusinessError } 202 - Not system App. 4630 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4631 * 1.Mandatory parameters unspecified. 4632 * 2.Incorrect parameter types. 4633 * @throws { BusinessError } 6800101 - Parameter verification failed. 4634 * @syscap SystemCapability.Multimedia.Audio.Volume 4635 * @systemapi 4636 * @since 13 4637 */ 4638 getActiveVolumeTypeSync(uid: number): AudioVolumeType; 4639 4640 /** 4641 * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. 4642 * @param { AudioVolumeType } volumeType - Audio stream type. 4643 * @param { AsyncCallback<number> } callback - Callback used to return the volume. 4644 * @syscap SystemCapability.Multimedia.Audio.Volume 4645 * @since 9 4646 */ 4647 /** 4648 * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. 4649 * @param { AudioVolumeType } volumeType - Audio stream type. 4650 * @param { AsyncCallback<number> } callback - Callback used to return the volume. 4651 * @syscap SystemCapability.Multimedia.Audio.Volume 4652 * @crossplatform 4653 * @since 12 4654 */ 4655 getVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 4656 /** 4657 * Obtains the volume of a stream. This method uses a promise to return the query result. 4658 * @param { AudioVolumeType } volumeType - Audio stream type. 4659 * @returns { Promise<number> } Promise used to return the volume. 4660 * @syscap SystemCapability.Multimedia.Audio.Volume 4661 * @since 9 4662 */ 4663 /** 4664 * Obtains the volume of a stream. This method uses a promise to return the query result. 4665 * @param { AudioVolumeType } volumeType - Audio stream type. 4666 * @returns { Promise<number> } Promise used to return the volume. 4667 * @syscap SystemCapability.Multimedia.Audio.Volume 4668 * @crossplatform 4669 * @since 12 4670 */ 4671 getVolume(volumeType: AudioVolumeType): Promise<number>; 4672 /** 4673 * Obtains the volume of a stream. 4674 * @param { AudioVolumeType } volumeType - Audio stream type. 4675 * @returns { number } Current system volume level. 4676 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4677 * 1.Mandatory parameters are left unspecified; 4678 * 2.Incorrect parameter types. 4679 * @throws { BusinessError } 6800101 - Parameter verification failed. 4680 * @syscap SystemCapability.Multimedia.Audio.Volume 4681 * @since 10 4682 */ 4683 /** 4684 * Obtains the volume of a stream. 4685 * @param { AudioVolumeType } volumeType - Audio stream type. 4686 * @returns { number } Current system volume level. 4687 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4688 * 1.Mandatory parameters are left unspecified; 4689 * 2.Incorrect parameter types. 4690 * @throws { BusinessError } 6800101 - Parameter verification failed. 4691 * @syscap SystemCapability.Multimedia.Audio.Volume 4692 * @crossplatform 4693 * @since 12 4694 */ 4695 getVolumeSync(volumeType: AudioVolumeType): number; 4696 4697 /** 4698 * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. 4699 * @param { AudioVolumeType } volumeType - Audio stream type. 4700 * @param { AsyncCallback<number> } callback - Callback used to return the minimum volume. 4701 * @syscap SystemCapability.Multimedia.Audio.Volume 4702 * @since 9 4703 */ 4704 /** 4705 * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. 4706 * @param { AudioVolumeType } volumeType - Audio stream type. 4707 * @param { AsyncCallback<number> } callback - Callback used to return the minimum volume. 4708 * @syscap SystemCapability.Multimedia.Audio.Volume 4709 * @crossplatform 4710 * @since 12 4711 */ 4712 getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 4713 /** 4714 * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. 4715 * @param { AudioVolumeType } volumeType - Audio stream type. 4716 * @returns { Promise<number> } Promise used to return the minimum volume. 4717 * @syscap SystemCapability.Multimedia.Audio.Volume 4718 * @since 9 4719 */ 4720 /** 4721 * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. 4722 * @param { AudioVolumeType } volumeType - Audio stream type. 4723 * @returns { Promise<number> } Promise used to return the minimum volume. 4724 * @syscap SystemCapability.Multimedia.Audio.Volume 4725 * @crossplatform 4726 * @since 12 4727 */ 4728 getMinVolume(volumeType: AudioVolumeType): Promise<number>; 4729 /** 4730 * Obtains the minimum volume allowed for a stream. 4731 * @param { AudioVolumeType } volumeType - Audio stream type. 4732 * @returns { number } Min volume level. 4733 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4734 * 1.Mandatory parameters are left unspecified; 4735 * 2.Incorrect parameter types. 4736 * @throws { BusinessError } 6800101 - Parameter verification failed. 4737 * @syscap SystemCapability.Multimedia.Audio.Volume 4738 * @since 10 4739 */ 4740 /** 4741 * Obtains the minimum volume allowed for a stream. 4742 * @param { AudioVolumeType } volumeType - Audio stream type. 4743 * @returns { number } Min volume level. 4744 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4745 * 1.Mandatory parameters are left unspecified; 4746 * 2.Incorrect parameter types. 4747 * @throws { BusinessError } 6800101 - Parameter verification failed. 4748 * @syscap SystemCapability.Multimedia.Audio.Volume 4749 * @crossplatform 4750 * @since 12 4751 */ 4752 getMinVolumeSync(volumeType: AudioVolumeType): number; 4753 4754 /** 4755 * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. 4756 * @param { AudioVolumeType } volumeType - Audio stream type. 4757 * @param { AsyncCallback<number> } callback - Callback used to return the maximum volume. 4758 * @syscap SystemCapability.Multimedia.Audio.Volume 4759 * @since 9 4760 */ 4761 /** 4762 * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. 4763 * @param { AudioVolumeType } volumeType - Audio stream type. 4764 * @param { AsyncCallback<number> } callback - Callback used to return the maximum volume. 4765 * @syscap SystemCapability.Multimedia.Audio.Volume 4766 * @crossplatform 4767 * @since 12 4768 */ 4769 getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 4770 /** 4771 * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. 4772 * @param { AudioVolumeType } volumeType - Audio stream type. 4773 * @returns { Promise<number> } Promise used to return the maximum volume. 4774 * @syscap SystemCapability.Multimedia.Audio.Volume 4775 * @since 9 4776 */ 4777 /** 4778 * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. 4779 * @param { AudioVolumeType } volumeType - Audio stream type. 4780 * @returns { Promise<number> } Promise used to return the maximum volume. 4781 * @syscap SystemCapability.Multimedia.Audio.Volume 4782 * @crossplatform 4783 * @since 12 4784 */ 4785 getMaxVolume(volumeType: AudioVolumeType): Promise<number>; 4786 /** 4787 * Obtains the maximum volume allowed for a stream. 4788 * @param { AudioVolumeType } volumeType - Audio stream type. 4789 * @returns { number } Max volume level. 4790 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4791 * 1.Mandatory parameters are left unspecified; 4792 * 2.Incorrect parameter types. 4793 * @throws { BusinessError } 6800101 - Parameter verification failed. 4794 * @syscap SystemCapability.Multimedia.Audio.Volume 4795 * @since 10 4796 */ 4797 /** 4798 * Obtains the maximum volume allowed for a stream. 4799 * @param { AudioVolumeType } volumeType - Audio stream type. 4800 * @returns { number } Max volume level. 4801 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4802 * 1.Mandatory parameters are left unspecified; 4803 * 2.Incorrect parameter types. 4804 * @throws { BusinessError } 6800101 - Parameter verification failed. 4805 * @syscap SystemCapability.Multimedia.Audio.Volume 4806 * @crossplatform 4807 * @since 12 4808 */ 4809 getMaxVolumeSync(volumeType: AudioVolumeType): number; 4810 4811 /** 4812 * Mutes a stream. This method uses an asynchronous callback to return the result. 4813 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 4814 * @param { AudioVolumeType } volumeType - Audio stream type. 4815 * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. 4816 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4817 * @syscap SystemCapability.Multimedia.Audio.Volume 4818 * @systemapi 4819 * @since 9 4820 */ 4821 mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void>): void; 4822 /** 4823 * Mutes a stream. This method uses a promise to return the result. 4824 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 4825 * @param { AudioVolumeType } volumeType - Audio stream type. 4826 * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. 4827 * @returns { Promise<void> } Promise used to return the result. 4828 * @syscap SystemCapability.Multimedia.Audio.Volume 4829 * @systemapi 4830 * @since 9 4831 */ 4832 mute(volumeType: AudioVolumeType, mute: boolean): Promise<void>; 4833 4834 /** 4835 * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. 4836 * @param { AudioVolumeType } volumeType - Audio stream type. 4837 * @param { AsyncCallback<boolean> } callback - Callback used to return the mute status of the stream. The 4838 * value true means that the stream is muted, and false means the opposite. 4839 * @syscap SystemCapability.Multimedia.Audio.Volume 4840 * @since 9 4841 */ 4842 /** 4843 * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. 4844 * @param { AudioVolumeType } volumeType - Audio stream type. 4845 * @param { AsyncCallback<boolean> } callback - Callback used to return the mute status of the stream. The 4846 * value true means that the stream is muted, and false means the opposite. 4847 * @syscap SystemCapability.Multimedia.Audio.Volume 4848 * @crossplatform 4849 * @since 12 4850 */ 4851 isMute(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void; 4852 /** 4853 * Checks whether a stream is muted. This method uses a promise to return the result. 4854 * @param { AudioVolumeType } volumeType - Audio stream type. 4855 * @returns { Promise<boolean> } Promise used to return the mute status of the stream. The value true 4856 * means that the stream is muted, and false means the opposite. 4857 * @syscap SystemCapability.Multimedia.Audio.Volume 4858 * @since 9 4859 */ 4860 /** 4861 * Checks whether a stream is muted. This method uses a promise to return the result. 4862 * @param { AudioVolumeType } volumeType - Audio stream type. 4863 * @returns { Promise<boolean> } Promise used to return the mute status of the stream. The value true 4864 * means that the stream is muted, and false means the opposite. 4865 * @syscap SystemCapability.Multimedia.Audio.Volume 4866 * @crossplatform 4867 * @since 12 4868 */ 4869 isMute(volumeType: AudioVolumeType): Promise<boolean>; 4870 /** 4871 * Checks whether a stream is muted. 4872 * @param { AudioVolumeType } volumeType - Audio stream type. 4873 * @returns { boolean } The mute status of the stream. The value true 4874 * means that the stream is muted, and false means the opposite. 4875 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4876 * 1.Mandatory parameters are left unspecified; 4877 * 2.Incorrect parameter types. 4878 * @throws { BusinessError } 6800101 - Parameter verification failed. 4879 * @syscap SystemCapability.Multimedia.Audio.Volume 4880 * @since 10 4881 */ 4882 /** 4883 * Checks whether a stream is muted. 4884 * @param { AudioVolumeType } volumeType - Audio stream type. 4885 * @returns { boolean } The mute status of the stream. The value true 4886 * means that the stream is muted, and false means the opposite. 4887 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4888 * 1.Mandatory parameters are left unspecified; 4889 * 2.Incorrect parameter types. 4890 * @throws { BusinessError } 6800101 - Parameter verification failed. 4891 * @syscap SystemCapability.Multimedia.Audio.Volume 4892 * @crossplatform 4893 * @since 12 4894 */ 4895 isMuteSync(volumeType: AudioVolumeType): boolean; 4896 4897 /** 4898 * Sets the ringer mode. This method uses an asynchronous callback to return the result. 4899 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 4900 * @param { AudioRingMode } mode - Ringer mode. 4901 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4902 * @syscap SystemCapability.Multimedia.Audio.Volume 4903 * @systemapi 4904 * @since 9 4905 */ 4906 setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void; 4907 /** 4908 * Sets the ringer mode. This method uses a promise to return the result. 4909 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 4910 * @param { AudioRingMode } mode - Ringer mode. 4911 * @returns { Promise<void> } Promise used to return the result. 4912 * @syscap SystemCapability.Multimedia.Audio.Volume 4913 * @systemapi 4914 * @since 9 4915 */ 4916 setRingerMode(mode: AudioRingMode): Promise<void>; 4917 4918 /** 4919 * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. 4920 * @param { AsyncCallback<AudioRingMode> } callback - Callback used to return the ringer mode. 4921 * @syscap SystemCapability.Multimedia.Audio.Volume 4922 * @since 9 4923 */ 4924 /** 4925 * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. 4926 * @param { AsyncCallback<AudioRingMode> } callback - Callback used to return the ringer mode. 4927 * @syscap SystemCapability.Multimedia.Audio.Volume 4928 * @crossplatform 4929 * @since 12 4930 */ 4931 getRingerMode(callback: AsyncCallback<AudioRingMode>): void; 4932 /** 4933 * Obtains the ringer mode. This method uses a promise to return the query result. 4934 * @returns { Promise<AudioRingMode> } Promise used to return the ringer mode. 4935 * @syscap SystemCapability.Multimedia.Audio.Volume 4936 * @since 9 4937 */ 4938 /** 4939 * Obtains the ringer mode. This method uses a promise to return the query result. 4940 * @returns { Promise<AudioRingMode> } Promise used to return the ringer mode. 4941 * @syscap SystemCapability.Multimedia.Audio.Volume 4942 * @crossplatform 4943 * @since 12 4944 */ 4945 getRingerMode(): Promise<AudioRingMode>; 4946 /** 4947 * Obtains the ringer mode. 4948 * @returns { AudioRingMode } Current ringer mode. 4949 * @syscap SystemCapability.Multimedia.Audio.Volume 4950 * @since 10 4951 */ 4952 /** 4953 * Obtains the ringer mode. 4954 * @returns { AudioRingMode } Current ringer mode. 4955 * @syscap SystemCapability.Multimedia.Audio.Volume 4956 * @crossplatform 4957 * @since 12 4958 */ 4959 getRingerModeSync(): AudioRingMode; 4960 4961 /** 4962 * Listens for ringer mode change events. This method uses a callback to get ringer mode changes. 4963 * @param { 'ringerModeChange' } type - Type of the event to listen for. Only the ringerModeChange event is supported. 4964 * @param { Callback<AudioRingMode> } callback - Callback used to get the updated ringer mode. 4965 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4966 * 1.Mandatory parameters are left unspecified; 4967 * 2.Incorrect parameter types. 4968 * @throws { BusinessError } 6800101 - Parameter verification failed. 4969 * @syscap SystemCapability.Multimedia.Audio.Volume 4970 * @since 9 4971 */ 4972 on(type: 'ringerModeChange', callback: Callback<AudioRingMode>): void; 4973 4974 /** 4975 * Unsubscribes to the ringer mode state change events. 4976 * @param { 'ringerModeChange' } type - Type of the event to listen for. 4977 * @param { Callback<AudioRingMode> } callback - Callback used to get the updated ringer mode. 4978 * @throws { BusinessError } 6800101 - Parameter verification failed. 4979 * @syscap SystemCapability.Multimedia.Audio.Volume 4980 * @since 18 4981 */ 4982 off(type: 'ringerModeChange', callback?: Callback<AudioRingMode>): void; 4983 4984 /** 4985 * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. 4986 * @permission ohos.permission.MANAGE_AUDIO_CONFIG 4987 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 4988 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4989 * @syscap SystemCapability.Multimedia.Audio.Volume 4990 * @since 9 4991 * @deprecated since 11 4992 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicMute 4993 */ 4994 setMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void; 4995 /** 4996 * Mutes or unmutes the microphone. This method uses a promise to return the result. 4997 * @permission ohos.permission.MANAGE_AUDIO_CONFIG 4998 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 4999 * @returns { Promise<void> } Promise used to return the result. 5000 * @syscap SystemCapability.Multimedia.Audio.Volume 5001 * @since 9 5002 * @deprecated since 11 5003 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicMute 5004 */ 5005 setMicrophoneMute(mute: boolean): Promise<void>; 5006 5007 /** 5008 * Mutes or unmutes the microphone. This method uses a promise to return the result. 5009 * @permission ohos.permission.MANAGE_AUDIO_CONFIG 5010 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 5011 * @returns { Promise<void> } Promise used to return the result. 5012 * @throws { BusinessError } 201 - Permission denied. 5013 * @throws { BusinessError } 202 - Not system App. 5014 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5015 * 1.Mandatory parameters are left unspecified; 5016 * 2.Incorrect parameter types. 5017 * @throws { BusinessError } 6800101 - Parameter verification failed. 5018 * @syscap SystemCapability.Multimedia.Audio.Volume 5019 * @systemapi 5020 * @since 11 5021 */ 5022 setMicMute(mute: boolean): Promise<void>; 5023 5024 /** 5025 * Mutes or unmutes the microphone. This method uses a promise to return the result. 5026 * @permission ohos.permission.MICROPHONE_CONTROL 5027 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 5028 * @param { PolicyType } type - Mute status to set. This value represents the caller's type such as EDM or privacy. 5029 * @returns { Promise<void> } Promise used to return the result. 5030 * @throws { BusinessError } 201 - Permission denied. 5031 * @throws { BusinessError } 202 - Not system App. 5032 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5033 * 1.Mandatory parameters missing. 5034 * 2.Incorrect parameter types. 5035 * @throws { BusinessError } 6800101 - Parameter verification failed. 5036 * @syscap SystemCapability.Multimedia.Audio.Volume 5037 * @systemapi 5038 * @since 12 5039 */ 5040 setMicMutePersistent(mute: boolean, type: PolicyType): Promise<void>; 5041 5042 /** 5043 * Checks whether the persistent microphone status is muted. 5044 * @permission ohos.permission.MICROPHONE_CONTROL 5045 * @returns { boolean } Returns microphone persistent mute status. 5046 * true: The persistent mic mute is enabled in the current system. 5047 * false: The persistent mic mute is disabled in the current system. 5048 * @throws { BusinessError } 201 - Permission denied. 5049 * @throws { BusinessError } 202 - Not system App. 5050 * @syscap SystemCapability.Multimedia.Audio.Volume 5051 * @systemapi 5052 * @since 12 5053 */ 5054 isPersistentMicMute(): boolean; 5055 5056 /** 5057 * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. 5058 * @param { AsyncCallback<boolean> } callback - used to return the mute status of the microphone. The value 5059 * true means that the microphone is muted, and false means the opposite. 5060 * @syscap SystemCapability.Multimedia.Audio.Volume 5061 * @since 9 5062 */ 5063 /** 5064 * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. 5065 * @param { AsyncCallback<boolean> } callback - used to return the mute status of the microphone. The value 5066 * true means that the microphone is muted, and false means the opposite. 5067 * @syscap SystemCapability.Multimedia.Audio.Volume 5068 * @crossplatform 5069 * @since 12 5070 */ 5071 isMicrophoneMute(callback: AsyncCallback<boolean>): void; 5072 /** 5073 * Checks whether the microphone is muted. This method uses a promise to return the query result. 5074 * @returns { Promise<boolean> } Promise used to return the mute status of the microphone. The value true 5075 * means that the microphone is muted, and false means the opposite. 5076 * @syscap SystemCapability.Multimedia.Audio.Volume 5077 * @since 9 5078 */ 5079 /** 5080 * Checks whether the microphone is muted. This method uses a promise to return the query result. 5081 * @returns { Promise<boolean> } Promise used to return the mute status of the microphone. The value true 5082 * means that the microphone is muted, and false means the opposite. 5083 * @syscap SystemCapability.Multimedia.Audio.Volume 5084 * @crossplatform 5085 * @since 12 5086 */ 5087 isMicrophoneMute(): Promise<boolean>; 5088 /** 5089 * Checks whether the microphone is muted. 5090 * @returns { boolean } The mute status of the microphone. The value true 5091 * means that the microphone is muted, and false means the opposite. 5092 * @syscap SystemCapability.Multimedia.Audio.Volume 5093 * @since 10 5094 */ 5095 /** 5096 * Checks whether the microphone is muted. 5097 * @returns { boolean } The mute status of the microphone. The value true 5098 * means that the microphone is muted, and false means the opposite. 5099 * @syscap SystemCapability.Multimedia.Audio.Volume 5100 * @crossplatform 5101 * @since 12 5102 */ 5103 isMicrophoneMuteSync(): boolean; 5104 5105 /** 5106 * Listens for system microphone state change events. This method uses a callback to get microphone change events. 5107 * @param { 'micStateChange' } type - Type of the event to listen for. Only the micStateChange event is supported. 5108 * @param { Callback<MicStateChangeEvent> } callback - Callback used to get the system microphone state change event. 5109 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5110 * 1.Mandatory parameters are left unspecified; 5111 * 2.Incorrect parameter types. 5112 * @throws { BusinessError } 6800101 - Parameter verification failed. 5113 * @syscap SystemCapability.Multimedia.Audio.Volume 5114 * @since 9 5115 */ 5116 on(type: 'micStateChange', callback: Callback<MicStateChangeEvent>): void; 5117 5118 /** 5119 * Unsubscribes to the microphone state change events. 5120 * @param { 'micStateChange' } type - Type of the event to listen for. 5121 * @param { Callback<MicStateChangeEvent> } callback - Callback used to get the system microphone state change event. 5122 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5123 * 1.Mandatory parameters missing; 5124 * 2.Incorrect parameter types. 5125 * @throws { BusinessError } 6800101 - Parameter verification failed. 5126 * @syscap SystemCapability.Multimedia.Audio.Volume 5127 * @since 12 5128 */ 5129 off(type: 'micStateChange', callback?: Callback<MicStateChangeEvent>): void; 5130 5131 /** 5132 * Gets if this volume group is volume unadjustable. 5133 * @returns { boolean } Whether it is volume unadjustable. 5134 * @syscap SystemCapability.Multimedia.Audio.Volume 5135 * @since 10 5136 */ 5137 /** 5138 * Gets if this volume group is volume unadjustable. 5139 * @returns { boolean } Whether it is volume unadjustable. 5140 * @syscap SystemCapability.Multimedia.Audio.Volume 5141 * @crossplatform 5142 * @since 12 5143 */ 5144 isVolumeUnadjustable(): boolean; 5145 5146 /** 5147 * Adjusts system volume by step, volume type is decided by system. 5148 * This method uses an asynchronous callback to return the result. 5149 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 5150 * @param { VolumeAdjustType } adjustType - Volume adjustment type. 5151 * @param { AsyncCallback<void> } callback - Callback used to return the result. 5152 * @throws { BusinessError } 201 - Permission denied. 5153 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5154 * 1.Mandatory parameters are left unspecified; 5155 * 2.Incorrect parameter types. 5156 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 5157 * @throws { BusinessError } 6800301 - System error. Return by callback. 5158 * @syscap SystemCapability.Multimedia.Audio.Volume 5159 * @systemapi 5160 * @since 10 5161 */ 5162 adjustVolumeByStep(adjustType: VolumeAdjustType, callback: AsyncCallback<void>): void; 5163 /** 5164 * Adjusts system volume by step, volume type is decided by system. 5165 * This method uses a promise to return the result. 5166 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 5167 * @param { VolumeAdjustType } adjustType - Volume adjustment type. 5168 * @returns { Promise<void> } Promise used to return the result. 5169 * @throws { BusinessError } 201 - Permission denied. 5170 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5171 * 1.Mandatory parameters are left unspecified; 5172 * 2.Incorrect parameter types. 5173 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 5174 * @throws { BusinessError } 6800301 - System error. Return by promise. 5175 * @syscap SystemCapability.Multimedia.Audio.Volume 5176 * @systemapi 5177 * @since 10 5178 */ 5179 adjustVolumeByStep(adjustType: VolumeAdjustType): Promise<void>; 5180 5181 /** 5182 * Adjusts system volume by step for target volume type. 5183 * This method uses an asynchronous callback to return the result. 5184 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 5185 * @param { AudioVolumeType } volumeType - Audio volume type. 5186 * @param { VolumeAdjustType } adjustType - Volume adjustment type. 5187 * @param { AsyncCallback<void> } callback - Callback used to return the result. 5188 * @throws { BusinessError } 201 - Permission denied. 5189 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5190 * 1.Mandatory parameters are left unspecified; 5191 * 2.Incorrect parameter types. 5192 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 5193 * @throws { BusinessError } 6800301 - System error. Return by callback. 5194 * @syscap SystemCapability.Multimedia.Audio.Volume 5195 * @systemapi 5196 * @since 10 5197 */ 5198 adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustType, callback: AsyncCallback<void>): void; 5199 /** 5200 * Adjusts system volume by step for target volume type. 5201 * This method uses a promise to return the result. 5202 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 5203 * @param { AudioVolumeType } volumeType - Audio volume type. 5204 * @param { VolumeAdjustType } adjustType - Volume adjustment type. 5205 * @returns { Promise<void> } Promise used to return the result. 5206 * @throws { BusinessError } 201 - Permission denied. 5207 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5208 * 1.Mandatory parameters are left unspecified; 5209 * 2.Incorrect parameter types. 5210 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 5211 * @throws { BusinessError } 6800301 - System error. Return by promise. 5212 * @syscap SystemCapability.Multimedia.Audio.Volume 5213 * @systemapi 5214 * @since 10 5215 */ 5216 adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustType): Promise<void>; 5217 5218 /** 5219 * Gets the volume db value that system calculate by volume type, volume level and device type. 5220 * This method uses an asynchronous callback to return the result. 5221 * @param { AudioVolumeType } volumeType - Audio volume type. 5222 * @param { number } volumeLevel - Volume level to set. 5223 * @param { DeviceType } device - Output device type. 5224 * @param { AsyncCallback<number> } callback - Callback used to return the result. 5225 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5226 * 1.Mandatory parameters are left unspecified; 5227 * 2.Incorrect parameter types. 5228 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 5229 * @throws { BusinessError } 6800301 - System error. Return by callback. 5230 * @syscap SystemCapability.Multimedia.Audio.Volume 5231 * @since 10 5232 */ 5233 /** 5234 * Gets the volume db value that system calculate by volume type, volume level and device type. 5235 * This method uses an asynchronous callback to return the result. 5236 * @param { AudioVolumeType } volumeType - Audio volume type. 5237 * @param { number } volumeLevel - Volume level to set. 5238 * @param { DeviceType } device - Output device type. 5239 * @param { AsyncCallback<number> } callback - Callback used to return the result. 5240 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5241 * 1.Mandatory parameters are left unspecified; 5242 * 2.Incorrect parameter types. 5243 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 5244 * @throws { BusinessError } 6800301 - System error. Return by callback. 5245 * @syscap SystemCapability.Multimedia.Audio.Volume 5246 * @crossplatform 5247 * @since 12 5248 */ 5249 getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType, callback: AsyncCallback<number>): void; 5250 /** 5251 * Gets the volume db value that system calculate by volume type, volume level and device type. 5252 * This method uses a promise to return the result. 5253 * @param { AudioVolumeType } volumeType - Audio volume type. 5254 * @param { number } volumeLevel - Volume level to set. 5255 * @param { DeviceType } device - Output device type. 5256 * @returns { Promise<number> } Promise used to return the result. 5257 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5258 * 1.Mandatory parameters are left unspecified; 5259 * 2.Incorrect parameter types. 5260 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 5261 * @throws { BusinessError } 6800301 - System error. Return by promise. 5262 * @syscap SystemCapability.Multimedia.Audio.Volume 5263 * @since 10 5264 */ 5265 /** 5266 * Gets the volume db value that system calculate by volume type, volume level and device type. 5267 * This method uses a promise to return the result. 5268 * @param { AudioVolumeType } volumeType - Audio volume type. 5269 * @param { number } volumeLevel - Volume level to set. 5270 * @param { DeviceType } device - Output device type. 5271 * @returns { Promise<number> } Promise used to return the result. 5272 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5273 * 1.Mandatory parameters are left unspecified; 5274 * 2.Incorrect parameter types. 5275 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 5276 * @throws { BusinessError } 6800301 - System error. Return by promise. 5277 * @syscap SystemCapability.Multimedia.Audio.Volume 5278 * @crossplatform 5279 * @since 12 5280 */ 5281 getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType): Promise<number>; 5282 /** 5283 * Gets the volume db value that system calculate by volume type, volume level and device type. 5284 * @param { AudioVolumeType } volumeType - Audio volume type. 5285 * @param { number } volumeLevel - Volume level to set. 5286 * @param { DeviceType } device - Output device type. 5287 * @returns { number } The system volume in dB. 5288 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5289 * 1.Mandatory parameters are left unspecified; 5290 * 2.Incorrect parameter types. 5291 * @throws { BusinessError } 6800101 - Parameter verification failed. 5292 * @syscap SystemCapability.Multimedia.Audio.Volume 5293 * @since 10 5294 */ 5295 /** 5296 * Gets the volume db value that system calculate by volume type, volume level and device type. 5297 * @param { AudioVolumeType } volumeType - Audio volume type. 5298 * @param { number } volumeLevel - Volume level to set. 5299 * @param { DeviceType } device - Output device type. 5300 * @returns { number } The system volume in dB. 5301 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5302 * 1.Mandatory parameters are left unspecified; 5303 * 2.Incorrect parameter types. 5304 * @throws { BusinessError } 6800101 - Parameter verification failed. 5305 * @syscap SystemCapability.Multimedia.Audio.Volume 5306 * @crossplatform 5307 * @since 12 5308 */ 5309 getSystemVolumeInDbSync(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType): number; 5310 5311 /** 5312 * Gets the max amplitude value for a specific input device. 5313 * This method uses a promise to return the result. 5314 * @param { AudioDeviceDescriptor } inputDevice - the target device. 5315 * @returns { Promise<number> } Promise used to return the max amplitude value. 5316 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5317 * 1.Mandatory parameters are left unspecified; 5318 * 2.Incorrect parameter types. 5319 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 5320 * @throws { BusinessError } 6800301 - System error. Return by promise. 5321 * @syscap SystemCapability.Multimedia.Audio.Volume 5322 * @since 12 5323 */ 5324 getMaxAmplitudeForInputDevice(inputDevice: AudioDeviceDescriptor): Promise<number>; 5325 /** 5326 * Gets the max amplitude value for a specific output device. 5327 * This method uses a promise to return the result. 5328 * @param { AudioDeviceDescriptor } outputDevice - the target device. 5329 * @returns { Promise<number> } Promise used to return the max amplitude value. 5330 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5331 * 1.Mandatory parameters are left unspecified; 5332 * 2.Incorrect parameter types. 5333 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 5334 * @throws { BusinessError } 6800301 - System error. Return by promise. 5335 * @syscap SystemCapability.Multimedia.Audio.Volume 5336 * @since 12 5337 */ 5338 getMaxAmplitudeForOutputDevice(outputDevice: AudioDeviceDescriptor): Promise<number>; 5339 } 5340 5341 /** 5342 * This interface is used to notify the listener of any device Spatialization or Head Tracking enable state change. 5343 * @interface AudioSpatialEnabledStateForDevice 5344 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5345 * @systemapi 5346 * @since 12 5347 */ 5348 interface AudioSpatialEnabledStateForDevice { 5349 /** 5350 * Audio device description. 5351 * @type { AudioDeviceDescriptor } 5352 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5353 * @systemapi 5354 * @since 12 5355 */ 5356 deviceDescriptor: AudioDeviceDescriptor; 5357 /** 5358 * Spatialization or Head Tracking enable state. 5359 * @type { boolean } 5360 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5361 * @systemapi 5362 * @since 12 5363 */ 5364 enabled: boolean; 5365 } 5366 5367 /** 5368 * Implements audio spatialization management. 5369 * @typedef AudioSpatializationManager 5370 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5371 * @since 18 5372 */ 5373 interface AudioSpatializationManager { 5374 /** 5375 * Checks whether spatialization is supported by system. 5376 * @returns { boolean } Whether spatialization is supported by system. 5377 * @throws { BusinessError } 202 - Not system App. 5378 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5379 * @systemapi 5380 * @since 11 5381 */ 5382 isSpatializationSupported(): boolean; 5383 5384 /** 5385 * Checks whether spatialization is supported by the specified device. 5386 * @param { AudioDeviceDescriptor } deviceDescriptor - Audio device description. 5387 * @returns { boolean } Whether spatialization is supported by the specified device. 5388 * @throws { BusinessError } 202 - Not system App. 5389 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5390 * 1.Mandatory parameters are left unspecified; 5391 * 2.Incorrect parameter types. 5392 * @throws { BusinessError } 6800101 - Parameter verification failed. 5393 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5394 * @systemapi 5395 * @since 11 5396 */ 5397 isSpatializationSupportedForDevice(deviceDescriptor: AudioDeviceDescriptor): boolean; 5398 5399 /** 5400 * Checks whether head tracking is supported by system. 5401 * @returns { boolean } Whether head tracking is supported by system. 5402 * @throws { BusinessError } 202 - Not system App. 5403 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5404 * @systemapi 5405 * @since 11 5406 */ 5407 isHeadTrackingSupported(): boolean; 5408 5409 /** 5410 * Checks whether head tracking is supported by the specified device. 5411 * @param { AudioDeviceDescriptor } deviceDescriptor - Audio device description. 5412 * @returns { boolean } Whether head tracking is supported by the specified device. 5413 * @throws { BusinessError } 202 - Not system App. 5414 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5415 * 1.Mandatory parameters are left unspecified; 5416 * 2.Incorrect parameter types. 5417 * @throws { BusinessError } 6800101 - Parameter verification failed. 5418 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5419 * @systemapi 5420 * @since 11 5421 */ 5422 isHeadTrackingSupportedForDevice(deviceDescriptor: AudioDeviceDescriptor): boolean; 5423 5424 /** 5425 * Sets the spatialization enabled or disabled. This method uses an asynchronous callback to return the result. 5426 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5427 * @param { boolean } enable - Spatialization enable state. 5428 * @param { AsyncCallback<void> } callback - Callback used to return the result. 5429 * @throws { BusinessError } 201 - Permission denied. Return by callback. 5430 * @throws { BusinessError } 202 - Not system App. 5431 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5432 * 1.Mandatory parameters are left unspecified; 5433 * 2.Incorrect parameter types. 5434 * @throws { BusinessError } 6800101 - Parameter verification failed. 5435 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5436 * @systemapi 5437 * @since 11 5438 * @deprecated since 12 5439 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#setSpatializationEnabled 5440 */ 5441 setSpatializationEnabled(enable: boolean, callback: AsyncCallback<void>): void; 5442 /** 5443 * Sets the spatialization enabled or disabled. This method uses a promise to return the result. 5444 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5445 * @param { boolean } enable - Spatialization enable state. 5446 * @returns { Promise<void> } Promise used to return the result. 5447 * @throws { BusinessError } 201 - Permission denied. Return by promise. 5448 * @throws { BusinessError } 202 - Not system App. 5449 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5450 * 1.Mandatory parameters are left unspecified; 5451 * 2.Incorrect parameter types. 5452 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5453 * @systemapi 5454 * @since 11 5455 * @deprecated since 12 5456 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#setSpatializationEnabled 5457 */ 5458 setSpatializationEnabled(enable: boolean): Promise<void>; 5459 /** 5460 * Sets the spatialization enabled or disabled by the specified device. 5461 * This method uses a promise to return the result. 5462 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5463 * @param { AudioDeviceDescriptor } deviceDescriptor - Audio device description. 5464 * @param { boolean } enabled - Spatialization enable state. 5465 * @returns { Promise<void> } Promise used to return the result. 5466 * @throws { BusinessError } 201 - Permission denied. Return by promise. 5467 * @throws { BusinessError } 202 - Not system App. 5468 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5469 * 1.Mandatory parameters are left unspecified; 5470 * 2.Incorrect parameter types. 5471 * @throws { BusinessError } 6800101 - Parameter verification failed. 5472 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5473 * @systemapi 5474 * @since 12 5475 */ 5476 setSpatializationEnabled(deviceDescriptor: AudioDeviceDescriptor, enabled: boolean): Promise<void>; 5477 5478 /** 5479 * Checks whether the spatialization is enabled. 5480 * @returns { boolean } Whether the spatialization is enabled. 5481 * @throws { BusinessError } 202 - Not system App. 5482 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5483 * @systemapi 5484 * @since 11 5485 * @deprecated since 12 5486 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#isSpatializationEnabled 5487 */ 5488 isSpatializationEnabled(): boolean; 5489 /** 5490 * Checks whether the spatialization is enabled by the specified device. 5491 * @param { AudioDeviceDescriptor } deviceDescriptor - Audio device description. 5492 * @returns { boolean } Whether the spatialization is enabled by the specified device. 5493 * @throws { BusinessError } 202 - Not system App. 5494 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5495 * 1.Mandatory parameters are left unspecified; 5496 * 2.Incorrect parameter types. 5497 * @throws { BusinessError } 6800101 - Parameter verification failed. 5498 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5499 * @systemapi 5500 * @since 12 5501 */ 5502 isSpatializationEnabled(deviceDescriptor: AudioDeviceDescriptor): boolean; 5503 5504 /** 5505 * Subscribes to the spatialization enable state change events. When the spatialization enable state changes, 5506 * registered clients will receive the callback. 5507 * @param { 'spatializationEnabledChange' } type - Type of the event to listen for. 5508 * @param { Callback<boolean> } callback - Callback used to get the spatialization enable state. 5509 * @throws { BusinessError } 202 - Not system App. 5510 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5511 * 1.Mandatory parameters are left unspecified; 5512 * 2.Incorrect parameter types. 5513 * @throws { BusinessError } 6800101 - Parameter verification failed. 5514 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5515 * @systemapi 5516 * @since 11 5517 * @deprecated since 12 5518 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#on 5519 */ 5520 on(type: 'spatializationEnabledChange', callback: Callback<boolean>): void; 5521 /** 5522 * Subscribes to the spatialization enable state change events by the specified device. 5523 * When the spatialization enable state changes, registered clients will receive the callback. 5524 * @param { 'spatializationEnabledChangeForAnyDevice' } type - Type of the event to listen for. 5525 * @param { Callback<AudioSpatialEnabledStateForDevice> } callback - Callback used to get the spatialization enable state by the specified device. 5526 * @throws { BusinessError } 202 - Not system App. 5527 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5528 * 1.Mandatory parameters are left unspecified; 5529 * 2.Incorrect parameter types. 5530 * @throws { BusinessError } 6800101 - Parameter verification failed. 5531 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5532 * @systemapi 5533 * @since 12 5534 */ 5535 on(type: 'spatializationEnabledChangeForAnyDevice', callback: Callback<AudioSpatialEnabledStateForDevice>): void; 5536 5537 /** 5538 * Unsubscribes to the spatialization enable state change events. 5539 * @param { 'spatializationEnabledChange' } type - Type of the event to listen for. 5540 * @param { Callback<boolean> } callback - Callback used to get the spatialization enable state. 5541 * @throws { BusinessError } 202 - Not system App. 5542 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5543 * 1.Mandatory parameters are left unspecified; 5544 * 2.Incorrect parameter types. 5545 * @throws { BusinessError } 6800101 - Parameter verification failed. 5546 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5547 * @systemapi 5548 * @since 11 5549 * @deprecated since 12 5550 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#off 5551 */ 5552 off(type: 'spatializationEnabledChange', callback?: Callback<boolean>): void; 5553 /** 5554 * Unsubscribes to the spatialization enable state change events by the specified device. 5555 * @param { 'spatializationEnabledChangeForAnyDevice' } type - Type of the event to listen for. 5556 * @param { Callback<AudioSpatialEnabledStateForDevice> } callback - Callback used to get the spatialization enable state by the specified device. 5557 * @throws { BusinessError } 202 - Not system App. 5558 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5559 * 1.Mandatory parameters are left unspecified; 5560 * 2.Incorrect parameter types. 5561 * @throws { BusinessError } 6800101 - Parameter verification failed. 5562 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5563 * @systemapi 5564 * @since 12 5565 */ 5566 off(type: 'spatializationEnabledChangeForAnyDevice', callback?: Callback<AudioSpatialEnabledStateForDevice>): void; 5567 5568 /** 5569 * Sets the head tracking enabled or disabled. This method uses an asynchronous callback to return the result. 5570 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5571 * @param { boolean } enable - Head tracking enable state. 5572 * @param { AsyncCallback<void> } callback - Callback used to return the result. 5573 * @throws { BusinessError } 201 - Permission denied. Return by callback. 5574 * @throws { BusinessError } 202 - Not system App. 5575 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5576 * 1.Mandatory parameters are left unspecified; 5577 * 2.Incorrect parameter types. 5578 * @throws { BusinessError } 6800101 - Parameter verification failed. 5579 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5580 * @systemapi 5581 * @since 11 5582 * @deprecated since 12 5583 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#setHeadTrackingEnabled 5584 */ 5585 setHeadTrackingEnabled(enable: boolean, callback: AsyncCallback<void>): void; 5586 /** 5587 * Sets the head tracking enabled or disabled. This method uses a promise to return the result. 5588 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5589 * @param { boolean } enable - Head tracking enable state. 5590 * @returns { Promise<void> } Promise used to return the result. 5591 * @throws { BusinessError } 201 - Permission denied. Return by promise. 5592 * @throws { BusinessError } 202 - Not system App. 5593 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5594 * 1.Mandatory parameters are left unspecified; 5595 * 2.Incorrect parameter types. 5596 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5597 * @systemapi 5598 * @since 11 5599 * @deprecated since 12 5600 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#setHeadTrackingEnabled 5601 */ 5602 setHeadTrackingEnabled(enable: boolean): Promise<void>; 5603 /** 5604 * Sets the head tracking enabled or disabled by the specified device. 5605 * This method uses a promise to return the result. 5606 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5607 * @param { AudioDeviceDescriptor } deviceDescriptor - Audio device description. 5608 * @param { boolean } enabled - Head tracking enable state. 5609 * @returns { Promise<void> } Promise used to return the result. 5610 * @throws { BusinessError } 201 - Permission denied. Return by promise. 5611 * @throws { BusinessError } 202 - Not system App. 5612 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5613 * 1.Mandatory parameters are left unspecified; 5614 * 2.Incorrect parameter types. 5615 * @throws { BusinessError } 6800101 - Parameter verification failed. 5616 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5617 * @systemapi 5618 * @since 12 5619 */ 5620 setHeadTrackingEnabled(deviceDescriptor: AudioDeviceDescriptor, enabled: boolean): Promise<void>; 5621 5622 /** 5623 * Checks whether the head tracking is enabled. 5624 * @returns { boolean } Whether the head tracking is enabled. 5625 * @throws { BusinessError } 202 - Not system App. 5626 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5627 * @systemapi 5628 * @since 11 5629 * @deprecated since 12 5630 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#isHeadTrackingEnabled 5631 */ 5632 isHeadTrackingEnabled(): boolean; 5633 /** 5634 * Checks whether the head tracking is enabled by the specified device. 5635 * @param { AudioDeviceDescriptor } deviceDescriptor - Audio device description. 5636 * @returns { boolean } Whether the head tracking is enabled by the specified device. 5637 * @throws { BusinessError } 202 - Not system App. 5638 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5639 * 1.Mandatory parameters are left unspecified; 5640 * 2.Incorrect parameter types. 5641 * @throws { BusinessError } 6800101 - Parameter verification failed. 5642 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5643 * @systemapi 5644 * @since 12 5645 */ 5646 isHeadTrackingEnabled(deviceDescriptor: AudioDeviceDescriptor): boolean; 5647 5648 /** 5649 * Subscribes to the head tracking enable state change events. When the head tracking enable state changes, 5650 * registered clients will receive the callback. 5651 * @param { 'headTrackingEnabledChange' } type - Type of the event to listen for. 5652 * @param { Callback<boolean> } callback - Callback used to get the head tracking enable state. 5653 * @throws { BusinessError } 202 - Not system App. 5654 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5655 * 1.Mandatory parameters are left unspecified; 5656 * 2.Incorrect parameter types. 5657 * @throws { BusinessError } 6800101 - Parameter verification failed. 5658 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5659 * @systemapi 5660 * @since 11 5661 * @deprecated since 12 5662 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#on 5663 */ 5664 on(type: 'headTrackingEnabledChange', callback: Callback<boolean>): void; 5665 /** 5666 * Subscribes to the head tracking enable state change events by the specified device. 5667 * When the head tracking enable state changes, registered clients will receive the callback. 5668 * @param { 'headTrackingEnabledChangeForAnyDevice' } type - Type of the event to listen for. 5669 * @param { Callback<AudioSpatialEnabledStateForDevice> } callback - Callback used to get the head tracking enable state by the specified device. 5670 * @throws { BusinessError } 202 - Not system App. 5671 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5672 * 1.Mandatory parameters are left unspecified; 5673 * 2.Incorrect parameter types. 5674 * @throws { BusinessError } 6800101 - Parameter verification failed. 5675 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5676 * @systemapi 5677 * @since 12 5678 */ 5679 on(type: 'headTrackingEnabledChangeForAnyDevice', callback: Callback<AudioSpatialEnabledStateForDevice>): void; 5680 5681 /** 5682 * Unsubscribes to the head tracking enable state change events. 5683 * @param { 'headTrackingEnabledChange' } type - Type of the event to listen for. 5684 * @param { Callback<boolean> } callback - Callback used to get the head tracking enable state. 5685 * @throws { BusinessError } 202 - Not system App. 5686 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5687 * 1.Mandatory parameters are left unspecified; 5688 * 2.Incorrect parameter types. 5689 * @throws { BusinessError } 6800101 - Parameter verification failed. 5690 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5691 * @systemapi 5692 * @since 11 5693 * @deprecated since 12 5694 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#off 5695 */ 5696 off(type: 'headTrackingEnabledChange', callback?: Callback<boolean>): void; 5697 /** 5698 * Unsubscribes to the head tracking enable state change events by the specified device. 5699 * @param { 'headTrackingEnabledChangeForAnyDevice' } type - Type of the event to listen for. 5700 * @param { Callback<AudioSpatialEnabledStateForDevice> } callback - Callback used to get the head tracking enable state by the specified device. 5701 * @throws { BusinessError } 202 - Not system App. 5702 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5703 * 1.Mandatory parameters are left unspecified; 5704 * 2.Incorrect parameter types. 5705 * @throws { BusinessError } 6800101 - Parameter verification failed. 5706 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5707 * @systemapi 5708 * @since 12 5709 */ 5710 off(type: 'headTrackingEnabledChangeForAnyDevice', callback?: Callback<AudioSpatialEnabledStateForDevice>): void; 5711 5712 /** 5713 * Updates the spatial device state. 5714 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5715 * @param { AudioSpatialDeviceState } spatialDeviceState - Spatial device state. 5716 * @throws { BusinessError } 201 - Permission denied. 5717 * @throws { BusinessError } 202 - Not system App. 5718 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5719 * 1.Mandatory parameters are left unspecified; 5720 * 2.Incorrect parameter types. 5721 * @throws { BusinessError } 6800101 - Parameter verification failed. 5722 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5723 * @systemapi 5724 * @since 11 5725 */ 5726 updateSpatialDeviceState(spatialDeviceState: AudioSpatialDeviceState): void; 5727 5728 /** 5729 * Set spatialization rendering scene type. 5730 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5731 * @param { AudioSpatializationSceneType } spatializationSceneType - Spatialization scene type. 5732 * @throws { BusinessError } 201 - Permission denied. 5733 * @throws { BusinessError } 202 - Not system App. 5734 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5735 * 1.Mandatory parameters are left unspecified; 5736 * 2.Incorrect parameter types. 5737 * @throws { BusinessError } 6800101 - Parameter verification failed. 5738 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5739 * @systemapi 5740 * @since 12 5741 */ 5742 setSpatializationSceneType(spatializationSceneType: AudioSpatializationSceneType): void; 5743 5744 /** 5745 * Get spatialization rendering scene type. 5746 * @returns { AudioSpatializationSceneType } Current spatialization rendering scene type. 5747 * @throws { BusinessError } 202 - Not system App. 5748 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5749 * @systemapi 5750 * @since 12 5751 */ 5752 getSpatializationSceneType(): AudioSpatializationSceneType; 5753 5754 /** 5755 * Checks whether the spatialization is enabled by the current device. 5756 * @returns { boolean } Whether the spatialization is enabled by the current device. 5757 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5758 * @since 18 5759 */ 5760 isSpatializationEnabledForCurrentDevice(): boolean; 5761 5762 /** 5763 * Subscribes to the spatialization enable state change events by the current device. 5764 * When the spatialization enable state changes, registered clients will receive the callback. 5765 * @param { 'spatializationEnabledChangeForCurrentDevice' } type - Type of the event to listen for. 5766 * @param { Callback<boolean> } callback - Callback used to get the spatialization enable state. 5767 * @throws { BusinessError } 6800101 - Parameter verification failed. 5768 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5769 * @since 18 5770 */ 5771 on(type: 'spatializationEnabledChangeForCurrentDevice', callback: Callback<boolean>): void; 5772 5773 /** 5774 * Unsubscribes to the spatialization enable state change events by the current device. 5775 * @param { 'spatializationEnabledChangeForCurrentDevice' } type - Type of the event to listen for. 5776 * @param { Callback<boolean> } callback - Callback used to get the spatialization enable state. 5777 * @throws { BusinessError } 6800101 - Parameter verification failed. 5778 * @syscap SystemCapability.Multimedia.Audio.Spatialization 5779 * @since 18 5780 */ 5781 off(type: 'spatializationEnabledChangeForCurrentDevice', callback?: Callback<boolean>): void; 5782 } 5783 5784 /** 5785 * Implements audio effect management. 5786 * @typedef AudioEffectManager 5787 * @syscap SystemCapability.Multimedia.Audio.Core 5788 * @systemapi 5789 * @since 18 5790 */ 5791 interface AudioEffectManager { 5792 /** 5793 * Gets supported audio effect properties based on current devices. 5794 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5795 * @returns { Array<AudioEffectProperty> } Array of supported audio effect properties. 5796 * @throws { BusinessError } 201 - Permission denied. 5797 * @throws { BusinessError } 202 - Caller is not a system application. 5798 * @throws { BusinessError } 6800301 - System error. 5799 * @syscap SystemCapability.Multimedia.Audio.Core 5800 * @systemapi 5801 * @since 18 5802 */ 5803 getSupportedAudioEffectProperty(): Array<AudioEffectProperty>; 5804 5805 /** 5806 * Sets current audio effect properties. 5807 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5808 * @param { Array<AudioEffectProperty> } propertyArray - array of audio effect property to be set. 5809 * Notice that only one effect property name in each effect property category should be set. 5810 * @throws { BusinessError } 201 - Permission denied. 5811 * @throws { BusinessError } 202 - Caller is not a system application. 5812 * @throws { BusinessError } 6800101 - Parameter verification failed. Possible causes: 5813 * 1. More than one effect property name of the same effect property category are in the input array. 5814 * 2. The input audioEffectProperties are not supported by the current device. 5815 * 3. The name or catergory of the input audioEffectProperties is incorrect. 5816 * @throws { BusinessError } 6800301 - System error. 5817 * @syscap SystemCapability.Multimedia.Audio.Core 5818 * @systemapi 5819 * @since 18 5820 */ 5821 setAudioEffectProperty(propertyArray: Array<AudioEffectProperty>): void; 5822 5823 /** 5824 * Gets current audio effect properties. 5825 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 5826 * @returns { Array<AudioEffectProperty> } Array of current audio effect properties. 5827 * @throws { BusinessError } 201 - Permission denied. 5828 * @throws { BusinessError } 202 - Caller is not a system application. 5829 * @throws { BusinessError } 6800301 - System error. 5830 * @syscap SystemCapability.Multimedia.Audio.Core 5831 * @systemapi 5832 * @since 18 5833 */ 5834 getAudioEffectProperty(): Array<AudioEffectProperty>; 5835 } 5836 5837 /** 5838 * Connect type for device. 5839 * @enum { number } 5840 * @syscap SystemCapability.Multimedia.Audio.Volume 5841 * @systemapi 5842 * @since 9 5843 */ 5844 enum ConnectType { 5845 /** 5846 * Connect type for local device. 5847 * @syscap SystemCapability.Multimedia.Audio.Volume 5848 * @systemapi 5849 * @since 9 5850 */ 5851 CONNECT_TYPE_LOCAL = 1, 5852 5853 /** 5854 * Connect type for distributed device. 5855 * @syscap SystemCapability.Multimedia.Audio.Volume 5856 * @systemapi 5857 * @since 9 5858 */ 5859 CONNECT_TYPE_DISTRIBUTED = 2 5860 } 5861 5862 /** 5863 * Describes an audio volume group. 5864 * @typedef VolumeGroupInfo 5865 * @syscap SystemCapability.Multimedia.Audio.Volume 5866 * @systemapi 5867 * @since 9 5868 */ 5869 interface VolumeGroupInfo { 5870 /** 5871 * Device network id. 5872 * @type { string } 5873 * @readonly 5874 * @syscap SystemCapability.Multimedia.Audio.Volume 5875 * @systemapi 5876 * @since 9 5877 */ 5878 readonly networkId: string; 5879 5880 /** 5881 * Volume group id. 5882 * @type { number } 5883 * @readonly 5884 * @syscap SystemCapability.Multimedia.Audio.Volume 5885 * @systemapi 5886 * @since 9 5887 */ 5888 readonly groupId: number; 5889 5890 /** 5891 * Volume mapping group id. 5892 * @type { number } 5893 * @readonly 5894 * @syscap SystemCapability.Multimedia.Audio.Volume 5895 * @systemapi 5896 * @since 9 5897 */ 5898 readonly mappingId: number; 5899 5900 /** 5901 * Volume group name. 5902 * @type { string } 5903 * @readonly 5904 * @syscap SystemCapability.Multimedia.Audio.Volume 5905 * @systemapi 5906 * @since 9 5907 */ 5908 readonly groupName: string; 5909 5910 /** 5911 * Connect type of device for this group. 5912 * @type { ConnectType } 5913 * @readonly 5914 * @syscap SystemCapability.Multimedia.Audio.Volume 5915 * @systemapi 5916 * @since 9 5917 */ 5918 readonly type: ConnectType; 5919 } 5920 5921 /** 5922 * Array of VolumeGroupInfos, which is read-only. 5923 * @typedef { Array<Readonly<VolumeGroupInfo>> } VolumeGroupInfos 5924 * @syscap SystemCapability.Multimedia.Audio.Volume 5925 * @systemapi 5926 * @since 9 5927 */ 5928 type VolumeGroupInfos = Array<Readonly<VolumeGroupInfo>>; 5929 5930 /** 5931 * Array of AudioRendererChangeInfo, which is read-only. 5932 * @typedef { Array<Readonly<AudioRendererChangeInfo>> } AudioRendererChangeInfoArray 5933 * @syscap SystemCapability.Multimedia.Audio.Renderer 5934 * @since 9 5935 */ 5936 /** 5937 * Array of AudioRendererChangeInfo, which is read-only. 5938 * @typedef { Array<Readonly<AudioRendererChangeInfo>> } AudioRendererChangeInfoArray 5939 * @syscap SystemCapability.Multimedia.Audio.Renderer 5940 * @crossplatform 5941 * @since 12 5942 */ 5943 type AudioRendererChangeInfoArray = Array<Readonly<AudioRendererChangeInfo>>; 5944 5945 /** 5946 * Describes audio renderer change information. 5947 * @typedef AudioRendererChangeInfo 5948 * @syscap SystemCapability.Multimedia.Audio.Renderer 5949 * @since 9 5950 */ 5951 /** 5952 * Describes audio renderer change information. 5953 * @typedef AudioRendererChangeInfo 5954 * @syscap SystemCapability.Multimedia.Audio.Renderer 5955 * @crossplatform 5956 * @since 12 5957 */ 5958 interface AudioRendererChangeInfo { 5959 /** 5960 * Audio stream unique id. 5961 * @type { number } 5962 * @syscap SystemCapability.Multimedia.Audio.Renderer 5963 * @since 9 5964 */ 5965 /** 5966 * Audio stream unique id. 5967 * @type { number } 5968 * @readonly 5969 * @syscap SystemCapability.Multimedia.Audio.Renderer 5970 * @crossplatform 5971 * @since 12 5972 */ 5973 readonly streamId: number; 5974 5975 /** 5976 * Uid for audio renderer client application. 5977 * @type { number } 5978 * @readonly 5979 * @syscap SystemCapability.Multimedia.Audio.Renderer 5980 * @systemapi 5981 * @since 9 5982 */ 5983 readonly clientUid: number; 5984 5985 /** 5986 * Audio renderer information. 5987 * @type { AudioRendererInfo } 5988 * @syscap SystemCapability.Multimedia.Audio.Renderer 5989 * @since 9 5990 */ 5991 /** 5992 * Audio renderer information. 5993 * @type { AudioRendererInfo } 5994 * @readonly 5995 * @syscap SystemCapability.Multimedia.Audio.Renderer 5996 * @crossplatform 5997 * @since 12 5998 */ 5999 readonly rendererInfo: AudioRendererInfo; 6000 6001 /** 6002 * Audio state. 6003 * @type { AudioState } 6004 * @readonly 6005 * @syscap SystemCapability.Multimedia.Audio.Renderer 6006 * @systemapi 6007 * @since 9 6008 */ 6009 readonly rendererState: AudioState; 6010 6011 /** 6012 * Audio output devices. 6013 * @type { AudioDeviceDescriptors } 6014 * @syscap SystemCapability.Multimedia.Audio.Renderer 6015 * @since 9 6016 */ 6017 /** 6018 * Audio output devices. 6019 * @type { AudioDeviceDescriptors } 6020 * @readonly 6021 * @syscap SystemCapability.Multimedia.Audio.Renderer 6022 * @crossplatform 6023 * @since 12 6024 */ 6025 readonly deviceDescriptors: AudioDeviceDescriptors; 6026 } 6027 6028 /** 6029 * Array of AudioCapturerChangeInfo, which is read-only. 6030 * @typedef { Array<Readonly<AudioCapturerChangeInfo>> } AudioCapturerChangeInfoArray 6031 * @syscap SystemCapability.Multimedia.Audio.Capturer 6032 * @since 9 6033 */ 6034 /** 6035 * Array of AudioCapturerChangeInfo, which is read-only. 6036 * @typedef { Array<Readonly<AudioCapturerChangeInfo>> } AudioCapturerChangeInfoArray 6037 * @syscap SystemCapability.Multimedia.Audio.Capturer 6038 * @crossplatform 6039 * @since 12 6040 */ 6041 type AudioCapturerChangeInfoArray = Array<Readonly<AudioCapturerChangeInfo>>; 6042 6043 /** 6044 * Describes audio capturer change information. 6045 * @typedef AudioCapturerChangeInfo 6046 * @syscap SystemCapability.Multimedia.Audio.Capturer 6047 * @since 9 6048 */ 6049 /** 6050 * Describes audio capturer change information. 6051 * @typedef AudioCapturerChangeInfo 6052 * @syscap SystemCapability.Multimedia.Audio.Capturer 6053 * @crossplatform 6054 * @since 12 6055 */ 6056 interface AudioCapturerChangeInfo { 6057 /** 6058 * Audio stream unique id. 6059 * @type { number } 6060 * @syscap SystemCapability.Multimedia.Audio.Capturer 6061 * @since 9 6062 */ 6063 /** 6064 * Audio stream unique id. 6065 * @type { number } 6066 * @readonly 6067 * @syscap SystemCapability.Multimedia.Audio.Capturer 6068 * @crossplatform 6069 * @since 12 6070 */ 6071 readonly streamId: number; 6072 6073 /** 6074 * Uid for audio capturer client application. 6075 * @type { number } 6076 * @readonly 6077 * @syscap SystemCapability.Multimedia.Audio.Capturer 6078 * @systemapi 6079 * @since 9 6080 */ 6081 readonly clientUid: number; 6082 6083 /** 6084 * Audio capturer information. 6085 * @type { AudioCapturerInfo } 6086 * @syscap SystemCapability.Multimedia.Audio.Capturer 6087 * @since 9 6088 */ 6089 /** 6090 * Audio capturer information. 6091 * @type { AudioCapturerInfo } 6092 * @readonly 6093 * @syscap SystemCapability.Multimedia.Audio.Capturer 6094 * @crossplatform 6095 * @since 12 6096 */ 6097 readonly capturerInfo: AudioCapturerInfo; 6098 6099 /** 6100 * Audio state. 6101 * @type { AudioState } 6102 * @readonly 6103 * @syscap SystemCapability.Multimedia.Audio.Capturer 6104 * @systemapi 6105 * @since 9 6106 */ 6107 readonly capturerState: AudioState; 6108 6109 /** 6110 * Audio input devices. 6111 * @type { AudioDeviceDescriptors } 6112 * @syscap SystemCapability.Multimedia.Audio.Capturer 6113 * @since 9 6114 */ 6115 /** 6116 * Audio input devices. 6117 * @type { AudioDeviceDescriptors } 6118 * @readonly 6119 * @syscap SystemCapability.Multimedia.Audio.Capturer 6120 * @crossplatform 6121 * @since 12 6122 */ 6123 readonly deviceDescriptors: AudioDeviceDescriptors; 6124 6125 /** 6126 * Audio capturer muted status. 6127 * @type { ?boolean } 6128 * @syscap SystemCapability.Multimedia.Audio.Capturer 6129 * @since 11 6130 */ 6131 /** 6132 * Audio capturer muted status. 6133 * @type { ?boolean } 6134 * @readonly 6135 * @syscap SystemCapability.Multimedia.Audio.Capturer 6136 * @crossplatform 6137 * @since 12 6138 */ 6139 readonly muted?: boolean; 6140 } 6141 6142 /** 6143 * Describes an audio device. 6144 * @typedef AudioDeviceDescriptor 6145 * @syscap SystemCapability.Multimedia.Audio.Device 6146 * @since 7 6147 */ 6148 /** 6149 * Describes an audio device. 6150 * @typedef AudioDeviceDescriptor 6151 * @syscap SystemCapability.Multimedia.Audio.Device 6152 * @crossplatform 6153 * @atomicservice 6154 * @since 12 6155 */ 6156 interface AudioDeviceDescriptor { 6157 /** 6158 * Audio device role. 6159 * @type { DeviceRole } 6160 * @syscap SystemCapability.Multimedia.Audio.Device 6161 * @since 7 6162 */ 6163 /** 6164 * Audio device role. 6165 * @type { DeviceRole } 6166 * @readonly 6167 * @syscap SystemCapability.Multimedia.Audio.Device 6168 * @crossplatform 6169 * @atomicservice 6170 * @since 12 6171 */ 6172 readonly deviceRole: DeviceRole; 6173 6174 /** 6175 * Audio device type. 6176 * @type { DeviceType } 6177 * @syscap SystemCapability.Multimedia.Audio.Device 6178 * @since 7 6179 */ 6180 /** 6181 * Audio device type. 6182 * @type { DeviceType } 6183 * @readonly 6184 * @syscap SystemCapability.Multimedia.Audio.Device 6185 * @crossplatform 6186 * @atomicservice 6187 * @since 12 6188 */ 6189 readonly deviceType: DeviceType; 6190 6191 /** 6192 * Audio device id. 6193 * @type { number } 6194 * @syscap SystemCapability.Multimedia.Audio.Device 6195 * @since 9 6196 */ 6197 /** 6198 * Audio device id. 6199 * @type { number } 6200 * @readonly 6201 * @syscap SystemCapability.Multimedia.Audio.Device 6202 * @crossplatform 6203 * @atomicservice 6204 * @since 12 6205 */ 6206 readonly id: number; 6207 6208 /** 6209 * Audio device name. 6210 * @type { string } 6211 * @syscap SystemCapability.Multimedia.Audio.Device 6212 * @since 9 6213 */ 6214 /** 6215 * Audio device name. 6216 * @type { string } 6217 * @readonly 6218 * @syscap SystemCapability.Multimedia.Audio.Device 6219 * @crossplatform 6220 * @atomicservice 6221 * @since 12 6222 */ 6223 readonly name: string; 6224 6225 /** 6226 * Audio device address. 6227 * @type { string } 6228 * @syscap SystemCapability.Multimedia.Audio.Device 6229 * @since 9 6230 */ 6231 /** 6232 * Audio device address. 6233 * @type { string } 6234 * @readonly 6235 * @syscap SystemCapability.Multimedia.Audio.Device 6236 * @crossplatform 6237 * @atomicservice 6238 * @since 12 6239 */ 6240 readonly address: string; 6241 6242 /** 6243 * Supported sampling rates. 6244 * @type { Array<number> } 6245 * @syscap SystemCapability.Multimedia.Audio.Device 6246 * @since 9 6247 */ 6248 /** 6249 * Supported sampling rates. 6250 * @type { Array<number> } 6251 * @readonly 6252 * @syscap SystemCapability.Multimedia.Audio.Device 6253 * @crossplatform 6254 * @atomicservice 6255 * @since 12 6256 */ 6257 readonly sampleRates: Array<number>; 6258 6259 /** 6260 * Supported channel counts. 6261 * @type { Array<number> } 6262 * @syscap SystemCapability.Multimedia.Audio.Device 6263 * @since 9 6264 */ 6265 /** 6266 * Supported channel counts. 6267 * @type { Array<number> } 6268 * @readonly 6269 * @syscap SystemCapability.Multimedia.Audio.Device 6270 * @crossplatform 6271 * @atomicservice 6272 * @since 12 6273 */ 6274 readonly channelCounts: Array<number>; 6275 6276 /** 6277 * Supported channel masks. 6278 * @type { Array<number> } 6279 * @syscap SystemCapability.Multimedia.Audio.Device 6280 * @since 9 6281 */ 6282 /** 6283 * Supported channel masks. 6284 * @type { Array<number> } 6285 * @readonly 6286 * @syscap SystemCapability.Multimedia.Audio.Device 6287 * @crossplatform 6288 * @atomicservice 6289 * @since 12 6290 */ 6291 readonly channelMasks: Array<number>; 6292 /** 6293 * Device network id 6294 * @type { string } 6295 * @readonly 6296 * @syscap SystemCapability.Multimedia.Audio.Device 6297 * @systemapi 6298 * @since 9 6299 */ 6300 readonly networkId: string; 6301 /** 6302 * Interrupt group id 6303 * @type { number } 6304 * @readonly 6305 * @syscap SystemCapability.Multimedia.Audio.Device 6306 * @systemapi 6307 * @since 9 6308 */ 6309 readonly interruptGroupId: number; 6310 /** 6311 * Volume group id 6312 * @type { number } 6313 * @readonly 6314 * @syscap SystemCapability.Multimedia.Audio.Device 6315 * @systemapi 6316 * @since 9 6317 */ 6318 readonly volumeGroupId: number; 6319 /** 6320 * Name used to display, considering distributed device situation. 6321 * @type { string } 6322 * @syscap SystemCapability.Multimedia.Audio.Device 6323 * @since 10 6324 */ 6325 /** 6326 * Name used to display, considering distributed device situation. 6327 * @type { string } 6328 * @readonly 6329 * @syscap SystemCapability.Multimedia.Audio.Device 6330 * @crossplatform 6331 * @atomicservice 6332 * @since 12 6333 */ 6334 readonly displayName: string; 6335 6336 /** 6337 * Supported encoding types. 6338 * @type { ?Array<AudioEncodingType> } 6339 * @syscap SystemCapability.Multimedia.Audio.Core 6340 * @since 11 6341 */ 6342 /** 6343 * Supported encoding types. 6344 * @type { ?Array<AudioEncodingType> } 6345 * @readonly 6346 * @syscap SystemCapability.Multimedia.Audio.Core 6347 * @crossplatform 6348 * @atomicservice 6349 * @since 12 6350 */ 6351 readonly encodingTypes?: Array<AudioEncodingType>; 6352 6353 /** 6354 * whether supports spatial rendering. 6355 * @type { boolean } 6356 * @readonly 6357 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6358 * @since 18 6359 */ 6360 readonly spatializationSupported?: boolean; 6361 6362 /** 6363 * Only {@link DeviceType.SPEAKER} with networkId、{@link DeviceType.REMOTE_CAST} 6364 * or {@link DeviceType.REMOTE_DAUDIO} has dmDeviceType which indicated deviceTypeId. 6365 * @type { number } 6366 * @readonly 6367 * @syscap SystemCapability.Multimedia.Audio.Core 6368 * @systemapi 6369 * @since 18 6370 */ 6371 readonly dmDeviceType?: number; 6372 } 6373 6374 /** 6375 * Array of AudioDeviceDescriptors, which is read-only. 6376 * @typedef { Array<Readonly<AudioDeviceDescriptor>> } AudioDeviceDescriptors 6377 * @syscap SystemCapability.Multimedia.Audio.Device 6378 * @since 7 6379 */ 6380 /** 6381 * Array of AudioDeviceDescriptors, which is read-only. 6382 * @typedef { Array<Readonly<AudioDeviceDescriptor>> } AudioDeviceDescriptors 6383 * @syscap SystemCapability.Multimedia.Audio.Device 6384 * @crossplatform 6385 * @atomicservice 6386 * @since 12 6387 */ 6388 type AudioDeviceDescriptors = Array<Readonly<AudioDeviceDescriptor>>; 6389 6390 /** 6391 * Describes the volume event received by the app when the volume is changed. 6392 * @typedef VolumeEvent 6393 * @syscap SystemCapability.Multimedia.Audio.Volume 6394 * @since 9 6395 */ 6396 /** 6397 * Describes the volume event received by the app when the volume is changed. 6398 * @typedef VolumeEvent 6399 * @syscap SystemCapability.Multimedia.Audio.Volume 6400 * @crossplatform 6401 * @since 12 6402 */ 6403 interface VolumeEvent { 6404 /** 6405 * Volume type of the current stream. 6406 * @type { AudioVolumeType } 6407 * @syscap SystemCapability.Multimedia.Audio.Volume 6408 * @since 9 6409 */ 6410 volumeType: AudioVolumeType; 6411 /** 6412 * Volume level. 6413 * @type { number } 6414 * @syscap SystemCapability.Multimedia.Audio.Volume 6415 * @since 9 6416 */ 6417 /** 6418 * Volume level. 6419 * @type { number } 6420 * @syscap SystemCapability.Multimedia.Audio.Volume 6421 * @crossplatform 6422 * @since 12 6423 */ 6424 volume: number; 6425 /** 6426 * Whether to show the volume change in UI. 6427 * @type { boolean } 6428 * @syscap SystemCapability.Multimedia.Audio.Volume 6429 * @since 9 6430 */ 6431 updateUi: boolean; 6432 /** 6433 * volumeGroup id 6434 * @type { number } 6435 * @syscap SystemCapability.Multimedia.Audio.Volume 6436 * @systemapi 6437 * @since 9 6438 */ 6439 volumeGroupId: number; 6440 /** 6441 * Device network id 6442 * @type { string } 6443 * @syscap SystemCapability.Multimedia.Audio.Volume 6444 * @systemapi 6445 * @since 9 6446 */ 6447 networkId: string; 6448 } 6449 6450 /** 6451 * Describes the callback invoked for audio interruption or focus gain events.When the audio of an application 6452 * is interrupted by another application, the callback is invoked to notify the former application. 6453 * @typedef InterruptAction 6454 * @syscap SystemCapability.Multimedia.Audio.Renderer 6455 * @since 7 6456 * @deprecated since 9 6457 * @useinstead ohos.multimedia.audio.InterruptEvent 6458 */ 6459 interface InterruptAction { 6460 6461 /** 6462 * Event type. 6463 * The value TYPE_ACTIVATED means the focus gain event, and TYPE_INTERRUPT means the audio interruption event. 6464 * @type { InterruptActionType } 6465 * @syscap SystemCapability.Multimedia.Audio.Renderer 6466 * @since 7 6467 * @deprecated since 9 6468 */ 6469 actionType: InterruptActionType; 6470 6471 /** 6472 * Type of the audio interruption event. 6473 * @type { ?InterruptType } 6474 * @syscap SystemCapability.Multimedia.Audio.Renderer 6475 * @since 7 6476 * @deprecated since 9 6477 */ 6478 type?: InterruptType; 6479 6480 /** 6481 * Hint for the audio interruption event. 6482 * @type { ?InterruptHint } 6483 * @syscap SystemCapability.Multimedia.Audio.Renderer 6484 * @since 7 6485 * @deprecated since 9 6486 */ 6487 hint?: InterruptHint; 6488 6489 /** 6490 * Whether the focus is gained or released. The value true means that the focus is gained or released, 6491 * and false means that the focus fails to be gained or released. 6492 * @type { ?boolean } 6493 * @syscap SystemCapability.Multimedia.Audio.Renderer 6494 * @since 7 6495 * @deprecated since 9 6496 */ 6497 activated?: boolean; 6498 } 6499 6500 /** 6501 * Describes input parameters of audio listening events. 6502 * @typedef AudioInterrupt 6503 * @syscap SystemCapability.Multimedia.Audio.Renderer 6504 * @since 7 6505 * @deprecated since 9 6506 */ 6507 interface AudioInterrupt { 6508 6509 /** 6510 * Audio stream usage type. 6511 * @type { StreamUsage } 6512 * @syscap SystemCapability.Multimedia.Audio.Renderer 6513 * @since 7 6514 * @deprecated since 9 6515 */ 6516 streamUsage: StreamUsage; 6517 6518 /** 6519 * Type of the media interrupted. 6520 * @type { ContentType } 6521 * @syscap SystemCapability.Multimedia.Audio.Renderer 6522 * @since 7 6523 * @deprecated since 9 6524 */ 6525 contentType: ContentType; 6526 6527 /** 6528 * Whether audio playback can be paused when it is interrupted. 6529 * The value true means that audio playback can be paused when it is interrupted, and false means the opposite. 6530 * @type { boolean } 6531 * @syscap SystemCapability.Multimedia.Audio.Renderer 6532 * @since 7 6533 * @deprecated since 9 6534 */ 6535 pauseWhenDucked: boolean; 6536 } 6537 6538 /** 6539 * Describes the microphone state change event received by the app when the microphone state is changed. 6540 * @typedef MicStateChangeEvent 6541 * @syscap SystemCapability.Multimedia.Audio.Device 6542 * @since 9 6543 */ 6544 interface MicStateChangeEvent { 6545 /** 6546 * Mic mute state. 6547 * @type { boolean } 6548 * @syscap SystemCapability.Multimedia.Audio.Device 6549 * @since 9 6550 */ 6551 mute: boolean; 6552 } 6553 /** 6554 * Describes the device change type and device information. 6555 * @typedef DeviceChangeAction 6556 * @syscap SystemCapability.Multimedia.Audio.Device 6557 * @since 7 6558 */ 6559 /** 6560 * Describes the device change type and device information. 6561 * @typedef DeviceChangeAction 6562 * @syscap SystemCapability.Multimedia.Audio.Device 6563 * @crossplatform 6564 * @since 12 6565 */ 6566 interface DeviceChangeAction { 6567 /** 6568 * Device change type. 6569 * @type { DeviceChangeType } 6570 * @syscap SystemCapability.Multimedia.Audio.Device 6571 * @since 7 6572 */ 6573 /** 6574 * Device change type. 6575 * @type { DeviceChangeType } 6576 * @syscap SystemCapability.Multimedia.Audio.Device 6577 * @crossplatform 6578 * @since 12 6579 */ 6580 type: DeviceChangeType; 6581 6582 /** 6583 * Device information. 6584 * @type { AudioDeviceDescriptors } 6585 * @syscap SystemCapability.Multimedia.Audio.Device 6586 * @since 7 6587 */ 6588 /** 6589 * Device information. 6590 * @type { AudioDeviceDescriptors } 6591 * @syscap SystemCapability.Multimedia.Audio.Device 6592 * @crossplatform 6593 * @since 12 6594 */ 6595 deviceDescriptors: AudioDeviceDescriptors; 6596 } 6597 6598 /** 6599 * Enumerates channel blend mode. 6600 * @enum { number } 6601 * @syscap SystemCapability.Multimedia.Audio.Core 6602 * @since 11 6603 */ 6604 /** 6605 * Enumerates channel blend mode. 6606 * @enum { number } 6607 * @syscap SystemCapability.Multimedia.Audio.Core 6608 * @crossplatform 6609 * @since 12 6610 */ 6611 enum ChannelBlendMode { 6612 /** 6613 * No channel process. 6614 * @syscap SystemCapability.Multimedia.Audio.Core 6615 * @since 11 6616 */ 6617 /** 6618 * No channel process. 6619 * @syscap SystemCapability.Multimedia.Audio.Core 6620 * @crossplatform 6621 * @since 12 6622 */ 6623 MODE_DEFAULT = 0, 6624 /** 6625 * Blend left and right channel. 6626 * @syscap SystemCapability.Multimedia.Audio.Core 6627 * @since 11 6628 */ 6629 /** 6630 * Blend left and right channel. 6631 * @syscap SystemCapability.Multimedia.Audio.Core 6632 * @crossplatform 6633 * @since 12 6634 */ 6635 MODE_BLEND_LR = 1, 6636 /** 6637 * Replicate left to right channel. 6638 * @syscap SystemCapability.Multimedia.Audio.Core 6639 * @since 11 6640 */ 6641 /** 6642 * Replicate left to right channel. 6643 * @syscap SystemCapability.Multimedia.Audio.Core 6644 * @crossplatform 6645 * @since 12 6646 */ 6647 MODE_ALL_LEFT = 2, 6648 /** 6649 * Replicate right to left channel. 6650 * @syscap SystemCapability.Multimedia.Audio.Core 6651 * @since 11 6652 */ 6653 /** 6654 * Replicate right to left channel. 6655 * @syscap SystemCapability.Multimedia.Audio.Core 6656 * @crossplatform 6657 * @since 12 6658 */ 6659 MODE_ALL_RIGHT = 3, 6660 } 6661 6662 /** 6663 * Enumerates audio stream device change reason. 6664 * @enum { number } 6665 * @syscap SystemCapability.Multimedia.Audio.Device 6666 * @since 11 6667 */ 6668 /** 6669 * Enumerates audio stream device change reason. 6670 * @enum { number } 6671 * @syscap SystemCapability.Multimedia.Audio.Device 6672 * @crossplatform 6673 * @atomicservice 6674 * @since 12 6675 */ 6676 enum AudioStreamDeviceChangeReason { 6677 /** 6678 * Unknown. 6679 * @syscap SystemCapability.Multimedia.Audio.Device 6680 * @since 11 6681 */ 6682 /** 6683 * Unknown. 6684 * @syscap SystemCapability.Multimedia.Audio.Device 6685 * @crossplatform 6686 * @atomicservice 6687 * @since 12 6688 */ 6689 REASON_UNKNOWN = 0, 6690 /** 6691 * New device available. 6692 * @syscap SystemCapability.Multimedia.Audio.Device 6693 * @since 11 6694 */ 6695 /** 6696 * New device available. 6697 * @syscap SystemCapability.Multimedia.Audio.Device 6698 * @crossplatform 6699 * @atomicservice 6700 * @since 12 6701 */ 6702 REASON_NEW_DEVICE_AVAILABLE = 1, 6703 /** 6704 * Old device unavailable. Applications should consider to pause the audio playback when this reason is 6705 * reported. 6706 * @syscap SystemCapability.Multimedia.Audio.Device 6707 * @since 11 6708 */ 6709 /** 6710 * Old device unavailable. Applications should consider to pause the audio playback when this reason is 6711 * reported. 6712 * @syscap SystemCapability.Multimedia.Audio.Device 6713 * @crossplatform 6714 * @atomicservice 6715 * @since 12 6716 */ 6717 REASON_OLD_DEVICE_UNAVAILABLE = 2, 6718 /** 6719 * Overrode by user or system. 6720 * @syscap SystemCapability.Multimedia.Audio.Device 6721 * @since 11 6722 */ 6723 /** 6724 * Overrode by user or system. 6725 * @syscap SystemCapability.Multimedia.Audio.Device 6726 * @crossplatform 6727 * @atomicservice 6728 * @since 12 6729 */ 6730 REASON_OVERRODE = 3, 6731 } 6732 /** 6733 * Audio stream device change info. 6734 * @typedef AudioStreamDeviceChangeInfo 6735 * @syscap SystemCapability.Multimedia.Audio.Device 6736 * @since 11 6737 */ 6738 /** 6739 * Audio stream device change info. 6740 * @typedef AudioStreamDeviceChangeInfo 6741 * @syscap SystemCapability.Multimedia.Audio.Device 6742 * @crossplatform 6743 * @atomicservice 6744 * @since 12 6745 */ 6746 interface AudioStreamDeviceChangeInfo { 6747 /** 6748 * Audio device descriptors after change. 6749 * @type { AudioDeviceDescriptors } 6750 * @syscap SystemCapability.Multimedia.Audio.Device 6751 * @since 11 6752 */ 6753 /** 6754 * Audio device descriptors after change. 6755 * @type { AudioDeviceDescriptors } 6756 * @syscap SystemCapability.Multimedia.Audio.Device 6757 * @crossplatform 6758 * @atomicservice 6759 * @since 12 6760 */ 6761 devices: AudioDeviceDescriptors; 6762 /** 6763 * Audio stream device change reason. 6764 * @type { AudioStreamDeviceChangeReason } 6765 * @syscap SystemCapability.Multimedia.Audio.Device 6766 * @since 11 6767 */ 6768 /** 6769 * Audio stream device change reason. 6770 * @type { AudioStreamDeviceChangeReason } 6771 * @syscap SystemCapability.Multimedia.Audio.Device 6772 * @crossplatform 6773 * @atomicservice 6774 * @since 12 6775 */ 6776 changeReason: AudioStreamDeviceChangeReason; 6777 } 6778 6779 /** 6780 * Enumerates callback result. 6781 * @enum { number } 6782 * @syscap SystemCapability.Multimedia.Audio.Core 6783 * @crossplatform 6784 * @since 12 6785 */ 6786 enum AudioDataCallbackResult { 6787 /** 6788 * Indicates data of this callback is invalid. 6789 * @syscap SystemCapability.Multimedia.Audio.Core 6790 * @crossplatform 6791 * @since 12 6792 */ 6793 INVALID = -1, 6794 6795 /** 6796 * Indicates data of this callback is valid. 6797 * @syscap SystemCapability.Multimedia.Audio.Core 6798 * @crossplatform 6799 * @since 12 6800 */ 6801 VALID = 0, 6802 } 6803 6804 /** 6805 * Type definition of callback function for audio renderer write data. 6806 * 6807 * @typedef { function } AudioRendererWriteDataCallback 6808 * @param { ArrayBuffer } data - audio data array buffer. 6809 * @returns { AudioDataCallbackResult | void } result of callback or void. If void or AudioDataCallbackResult.VALID is 6810 * returned, it indicates the data is valid and will be played. If AudioDataCallbackResult.INVALID is returned, it 6811 * indicates the data is will not be played. 6812 * @syscap SystemCapability.Multimedia.Audio.Renderer 6813 * @crossplatform 6814 * @since 12 6815 */ 6816 type AudioRendererWriteDataCallback = (data: ArrayBuffer) => AudioDataCallbackResult | void; 6817 6818 /** 6819 * Provides audio playback APIs. 6820 * @typedef AudioRenderer 6821 * @syscap SystemCapability.Multimedia.Audio.Renderer 6822 * @since 8 6823 */ 6824 /** 6825 * Provides audio playback APIs. 6826 * @typedef AudioRenderer 6827 * @syscap SystemCapability.Multimedia.Audio.Renderer 6828 * @crossplatform 6829 * @since 12 6830 */ 6831 interface AudioRenderer { 6832 /** 6833 * Defines the current render state. 6834 * @type { AudioState } 6835 * @syscap SystemCapability.Multimedia.Audio.Renderer 6836 * @since 8 6837 */ 6838 /** 6839 * Defines the current render state. 6840 * @type { AudioState } 6841 * @readonly 6842 * @syscap SystemCapability.Multimedia.Audio.Renderer 6843 * @crossplatform 6844 * @since 12 6845 */ 6846 readonly state: AudioState; 6847 6848 /** 6849 * Obtains the renderer information provided while creating a renderer instance. This method uses an asynchronous 6850 * callback to return the result. 6851 * @param { AsyncCallback<AudioRendererInfo> } callback - Callback used to return the renderer information. 6852 * @syscap SystemCapability.Multimedia.Audio.Renderer 6853 * @since 8 6854 */ 6855 /** 6856 * Obtains the renderer information provided while creating a renderer instance. This method uses an asynchronous 6857 * callback to return the result. 6858 * @param { AsyncCallback<AudioRendererInfo> } callback - Callback used to return the renderer information. 6859 * @syscap SystemCapability.Multimedia.Audio.Renderer 6860 * @crossplatform 6861 * @since 12 6862 */ 6863 getRendererInfo(callback: AsyncCallback<AudioRendererInfo>): void; 6864 /** 6865 * Obtains the renderer information provided while creating a renderer instance. This method uses a promise to 6866 * return the result. 6867 * @returns { Promise<AudioRendererInfo> } Promise used to return the renderer information. 6868 * @syscap SystemCapability.Multimedia.Audio.Renderer 6869 * @since 8 6870 */ 6871 /** 6872 * Obtains the renderer information provided while creating a renderer instance. This method uses a promise to 6873 * return the result. 6874 * @returns { Promise<AudioRendererInfo> } Promise used to return the renderer information. 6875 * @syscap SystemCapability.Multimedia.Audio.Renderer 6876 * @crossplatform 6877 * @since 12 6878 */ 6879 getRendererInfo(): Promise<AudioRendererInfo>; 6880 /** 6881 * Obtains the renderer information provided while creating a renderer instance. 6882 * @returns { AudioRendererInfo } The renderer information. 6883 * @syscap SystemCapability.Multimedia.Audio.Renderer 6884 * @since 10 6885 */ 6886 /** 6887 * Obtains the renderer information provided while creating a renderer instance. 6888 * @returns { AudioRendererInfo } The renderer information. 6889 * @syscap SystemCapability.Multimedia.Audio.Renderer 6890 * @crossplatform 6891 * @since 12 6892 */ 6893 getRendererInfoSync(): AudioRendererInfo; 6894 6895 /** 6896 * Obtains the renderer stream information. This method uses an asynchronous callback to return the result. 6897 * @param { AsyncCallback<AudioStreamInfo> } callback - Callback used to return the stream information. 6898 * @syscap SystemCapability.Multimedia.Audio.Renderer 6899 * @since 8 6900 */ 6901 /** 6902 * Obtains the renderer stream information. This method uses an asynchronous callback to return the result. 6903 * @param { AsyncCallback<AudioStreamInfo> } callback - Callback used to return the stream information. 6904 * @syscap SystemCapability.Multimedia.Audio.Renderer 6905 * @crossplatform 6906 * @since 12 6907 */ 6908 getStreamInfo(callback: AsyncCallback<AudioStreamInfo>): void; 6909 /** 6910 * Obtains the renderer stream information. This method uses a promise to return the result. 6911 * @returns { Promise<AudioStreamInfo> } Promise used to return the stream information. 6912 * @syscap SystemCapability.Multimedia.Audio.Renderer 6913 * @since 8 6914 */ 6915 /** 6916 * Obtains the renderer stream information. This method uses a promise to return the result. 6917 * @returns { Promise<AudioStreamInfo> } Promise used to return the stream information. 6918 * @syscap SystemCapability.Multimedia.Audio.Renderer 6919 * @crossplatform 6920 * @since 12 6921 */ 6922 getStreamInfo(): Promise<AudioStreamInfo>; 6923 /** 6924 * Obtains the renderer stream information. 6925 * @returns { AudioStreamInfo } The stream information. 6926 * @syscap SystemCapability.Multimedia.Audio.Renderer 6927 * @since 10 6928 */ 6929 /** 6930 * Obtains the renderer stream information. 6931 * @returns { AudioStreamInfo } The stream information. 6932 * @syscap SystemCapability.Multimedia.Audio.Renderer 6933 * @crossplatform 6934 * @since 12 6935 */ 6936 getStreamInfoSync(): AudioStreamInfo; 6937 6938 /** 6939 * Obtains the renderer stream id. This method uses an asynchronous callback to return the result. 6940 * @param { AsyncCallback<number> } callback - Callback used to return the stream id. 6941 * @syscap SystemCapability.Multimedia.Audio.Renderer 6942 * @since 9 6943 */ 6944 /** 6945 * Obtains the renderer stream id. This method uses an asynchronous callback to return the result. 6946 * @param { AsyncCallback<number> } callback - Callback used to return the stream id. 6947 * @syscap SystemCapability.Multimedia.Audio.Renderer 6948 * @crossplatform 6949 * @since 12 6950 */ 6951 getAudioStreamId(callback: AsyncCallback<number>): void; 6952 /** 6953 * Obtains the renderer stream id. This method uses a promise to return the result. 6954 * @returns { Promise<number> } Promise used to return the stream id. 6955 * @syscap SystemCapability.Multimedia.Audio.Renderer 6956 * @since 9 6957 */ 6958 /** 6959 * Obtains the renderer stream id. This method uses a promise to return the result. 6960 * @returns { Promise<number> } Promise used to return the stream id. 6961 * @syscap SystemCapability.Multimedia.Audio.Renderer 6962 * @crossplatform 6963 * @since 12 6964 */ 6965 getAudioStreamId(): Promise<number>; 6966 /** 6967 * Obtains the renderer stream id. 6968 * @returns { number } The stream id. 6969 * @syscap SystemCapability.Multimedia.Audio.Renderer 6970 * @since 10 6971 */ 6972 /** 6973 * Obtains the renderer stream id. 6974 * @returns { number } The stream id. 6975 * @syscap SystemCapability.Multimedia.Audio.Renderer 6976 * @crossplatform 6977 * @since 12 6978 */ 6979 getAudioStreamIdSync(): number; 6980 6981 /** 6982 * Obtains the current audio effect mode. This method uses an asynchronous callback to return the query result. 6983 * @param { AsyncCallback<AudioEffectMode> } callback - Callback used to return the current audio effect mode. 6984 * @syscap SystemCapability.Multimedia.Audio.Renderer 6985 * @since 10 6986 */ 6987 getAudioEffectMode(callback: AsyncCallback<AudioEffectMode>): void; 6988 /** 6989 * Obtains the current audio effect mode. This method uses a promise to return the query result. 6990 * @returns { Promise<AudioEffectMode> } Promise used to return the current audio effect mode. 6991 * @syscap SystemCapability.Multimedia.Audio.Renderer 6992 * @since 10 6993 */ 6994 getAudioEffectMode(): Promise<AudioEffectMode>; 6995 6996 /** 6997 * Sets the current audio effect mode. This method uses an asynchronous callback to return the result. 6998 * @param { AudioEffectMode } mode - Audio effect mode. 6999 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7000 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7001 * 1.Mandatory parameters are left unspecified; 7002 * 2.Incorrect parameter types. 7003 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 7004 * @syscap SystemCapability.Multimedia.Audio.Renderer 7005 * @since 10 7006 */ 7007 setAudioEffectMode(mode: AudioEffectMode, callback: AsyncCallback<void>): void; 7008 /** 7009 * Sets the current audio effect mode. This method uses a promise to return the result. 7010 * @param { AudioEffectMode } mode - Audio effect mode. 7011 * @returns { Promise<void> } Promise used to return the result. 7012 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7013 * 1.Mandatory parameters are left unspecified; 7014 * 2.Incorrect parameter types. 7015 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 7016 * @syscap SystemCapability.Multimedia.Audio.Renderer 7017 * @since 10 7018 */ 7019 setAudioEffectMode(mode: AudioEffectMode): Promise<void>; 7020 7021 /** 7022 * Starts the renderer. 7023 * Success: This method uses an asynchronous callback to return the result. 7024 * Failure: This method uses an asynchronous callback to return the error instance. Possible causes: 7025 * 6800301: Unsupported state, Audio focus request failed, System error. 7026 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7027 * @syscap SystemCapability.Multimedia.Audio.Renderer 7028 * @since 8 7029 */ 7030 /** 7031 * Starts the renderer. This method uses an asynchronous callback to return the result. 7032 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7033 * @syscap SystemCapability.Multimedia.Audio.Renderer 7034 * @crossplatform 7035 * @since 12 7036 */ 7037 start(callback: AsyncCallback<void>): void; 7038 /** 7039 * Starts the renderer. 7040 * Success: This method uses a promise to return the result. 7041 * Failure: This method uses a promise to return the error instance. Possible causes: 7042 * 6800301: Unsupported state, Audio focus request failed, System error. 7043 * @returns { Promise<void> } Promise used to return the result. 7044 * @syscap SystemCapability.Multimedia.Audio.Renderer 7045 * @since 8 7046 */ 7047 /** 7048 * Starts the renderer. This method uses a promise to return the result. 7049 * @returns { Promise<void> } Promise used to return the result. 7050 * @syscap SystemCapability.Multimedia.Audio.Renderer 7051 * @crossplatform 7052 * @since 12 7053 */ 7054 start(): Promise<void>; 7055 7056 /** 7057 * Writes the buffer. This method uses an asynchronous callback to return the result. 7058 * @param { ArrayBuffer } buffer - Buffer to be written. 7059 * @param { AsyncCallback<number> } callback - Returns the number of bytes written if the operation is successful. 7060 * Returns an error code otherwise. 7061 * @syscap SystemCapability.Multimedia.Audio.Renderer 7062 * @since 8 7063 * @deprecated since 11 7064 * @useinstead ohos.multimedia.audio.AudioRenderer#event:writeData 7065 */ 7066 write(buffer: ArrayBuffer, callback: AsyncCallback<number>): void; 7067 /** 7068 * Writes the buffer. This method uses a promise to return the result. 7069 * @param { ArrayBuffer } buffer - Buffer to be written. 7070 * @returns { Promise<number> } Returns the number of bytes written if the operation is successful. 7071 * Returns an error code otherwise. 7072 * @syscap SystemCapability.Multimedia.Audio.Renderer 7073 * @since 8 7074 * @deprecated since 11 7075 * @useinstead ohos.multimedia.audio.AudioRenderer#event:writeData 7076 */ 7077 write(buffer: ArrayBuffer): Promise<number>; 7078 7079 /** 7080 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an 7081 * asynchronous callback to return the result. 7082 * @param { AsyncCallback<number> } callback - Callback used to return the timestamp. 7083 * @syscap SystemCapability.Multimedia.Audio.Renderer 7084 * @since 8 7085 */ 7086 /** 7087 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an 7088 * asynchronous callback to return the result. 7089 * @param { AsyncCallback<number> } callback - Callback used to return the timestamp. 7090 * @syscap SystemCapability.Multimedia.Audio.Renderer 7091 * @crossplatform 7092 * @since 12 7093 */ 7094 getAudioTime(callback: AsyncCallback<number>): void; 7095 /** 7096 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a 7097 * promise to return the result. 7098 * @returns { Promise<number> } Promise used to return the timestamp. 7099 * @syscap SystemCapability.Multimedia.Audio.Renderer 7100 * @since 8 7101 */ 7102 /** 7103 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a 7104 * promise to return the result. 7105 * @returns { Promise<number> } Promise used to return the timestamp. 7106 * @syscap SystemCapability.Multimedia.Audio.Renderer 7107 * @crossplatform 7108 * @since 12 7109 */ 7110 getAudioTime(): Promise<number>; 7111 /** 7112 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. 7113 * @returns { number } The audio timestamp. 7114 * @syscap SystemCapability.Multimedia.Audio.Renderer 7115 * @since 10 7116 */ 7117 /** 7118 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. 7119 * @returns { number } The audio timestamp. 7120 * @syscap SystemCapability.Multimedia.Audio.Renderer 7121 * @crossplatform 7122 * @since 12 7123 */ 7124 getAudioTimeSync(): number; 7125 7126 /** 7127 * Drains the playback buffer. This method uses an asynchronous callback to return the result. 7128 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7129 * @syscap SystemCapability.Multimedia.Audio.Renderer 7130 * @since 8 7131 */ 7132 /** 7133 * Drains the playback buffer. This method uses an asynchronous callback to return the result. 7134 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7135 * @syscap SystemCapability.Multimedia.Audio.Renderer 7136 * @crossplatform 7137 * @since 12 7138 */ 7139 drain(callback: AsyncCallback<void>): void; 7140 /** 7141 * Drains the playback buffer. This method uses a promise to return the result. 7142 * @returns { Promise<void> } Promise used to return the result. 7143 * @syscap SystemCapability.Multimedia.Audio.Renderer 7144 * @since 8 7145 */ 7146 /** 7147 * Drains the playback buffer. This method uses a promise to return the result. 7148 * @returns { Promise<void> } Promise used to return the result. 7149 * @syscap SystemCapability.Multimedia.Audio.Renderer 7150 * @crossplatform 7151 * @since 12 7152 */ 7153 drain(): Promise<void>; 7154 7155 /** 7156 * Flushes the playback buffer. This method uses a promise to return the result. 7157 * @returns { Promise<void> } Promise used to return the result. 7158 * @throws { BusinessError } 6800103 - Operation not permit at current state. Return by promise. 7159 * @syscap SystemCapability.Multimedia.Audio.Renderer 7160 * @since 11 7161 */ 7162 /** 7163 * Flushes the playback buffer. This method uses a promise to return the result. 7164 * @returns { Promise<void> } Promise used to return the result. 7165 * @throws { BusinessError } 6800103 - Operation not permit at current state. Return by promise. 7166 * @syscap SystemCapability.Multimedia.Audio.Renderer 7167 * @crossplatform 7168 * @since 12 7169 */ 7170 flush(): Promise<void>; 7171 7172 /** 7173 * Pauses rendering. This method uses an asynchronous callback to return the result. 7174 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7175 * @syscap SystemCapability.Multimedia.Audio.Renderer 7176 * @since 8 7177 */ 7178 /** 7179 * Pauses rendering. This method uses an asynchronous callback to return the result. 7180 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7181 * @syscap SystemCapability.Multimedia.Audio.Renderer 7182 * @crossplatform 7183 * @since 12 7184 */ 7185 pause(callback: AsyncCallback<void>): void; 7186 /** 7187 * Pauses rendering. This method uses a promise to return the result. 7188 * @returns { Promise<void> } Promise used to return the result. 7189 * @syscap SystemCapability.Multimedia.Audio.Renderer 7190 * @since 8 7191 */ 7192 /** 7193 * Pauses rendering. This method uses a promise to return the result. 7194 * @returns { Promise<void> } Promise used to return the result. 7195 * @syscap SystemCapability.Multimedia.Audio.Renderer 7196 * @crossplatform 7197 * @since 12 7198 */ 7199 pause(): Promise<void>; 7200 7201 /** 7202 * Stops rendering. This method uses an asynchronous callback to return the result. 7203 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7204 * @syscap SystemCapability.Multimedia.Audio.Renderer 7205 * @since 8 7206 */ 7207 /** 7208 * Stops rendering. This method uses an asynchronous callback to return the result. 7209 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7210 * @syscap SystemCapability.Multimedia.Audio.Renderer 7211 * @crossplatform 7212 * @since 12 7213 */ 7214 stop(callback: AsyncCallback<void>): void; 7215 /** 7216 * Stops rendering. This method uses a promise to return the result. 7217 * @returns { Promise<void> } Promise used to return the result. 7218 * @syscap SystemCapability.Multimedia.Audio.Renderer 7219 * @since 8 7220 */ 7221 /** 7222 * Stops rendering. This method uses a promise to return the result. 7223 * @returns { Promise<void> } Promise used to return the result. 7224 * @syscap SystemCapability.Multimedia.Audio.Renderer 7225 * @crossplatform 7226 * @since 12 7227 */ 7228 stop(): Promise<void>; 7229 7230 /** 7231 * Releases the renderer. This method uses an asynchronous callback to return the result. 7232 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7233 * @syscap SystemCapability.Multimedia.Audio.Renderer 7234 * @since 8 7235 */ 7236 /** 7237 * Releases the renderer. This method uses an asynchronous callback to return the result. 7238 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7239 * @syscap SystemCapability.Multimedia.Audio.Renderer 7240 * @crossplatform 7241 * @since 12 7242 */ 7243 release(callback: AsyncCallback<void>): void; 7244 /** 7245 * Releases the renderer. This method uses a promise to return the result. 7246 * @returns { Promise<void> } Promise used to return the result. 7247 * @syscap SystemCapability.Multimedia.Audio.Renderer 7248 * @since 8 7249 */ 7250 /** 7251 * Releases the renderer. This method uses a promise to return the result. 7252 * @returns { Promise<void> } Promise used to return the result. 7253 * @syscap SystemCapability.Multimedia.Audio.Renderer 7254 * @crossplatform 7255 * @since 12 7256 */ 7257 release(): Promise<void>; 7258 7259 /** 7260 * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses an asynchronous callback to 7261 * return the result. 7262 * @param { AsyncCallback<number> } callback - Callback used to return the buffer size. 7263 * @syscap SystemCapability.Multimedia.Audio.Renderer 7264 * @since 8 7265 */ 7266 /** 7267 * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses an asynchronous callback to 7268 * return the result. 7269 * @param { AsyncCallback<number> } callback - Callback used to return the buffer size. 7270 * @syscap SystemCapability.Multimedia.Audio.Renderer 7271 * @crossplatform 7272 * @since 12 7273 */ 7274 getBufferSize(callback: AsyncCallback<number>): void; 7275 /** 7276 * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses a promise to return the result. 7277 * @returns { Promise<number> } Promise used to return the buffer size. 7278 * @syscap SystemCapability.Multimedia.Audio.Renderer 7279 * @since 8 7280 */ 7281 /** 7282 * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses a promise to return the result. 7283 * @returns { Promise<number> } Promise used to return the buffer size. 7284 * @syscap SystemCapability.Multimedia.Audio.Renderer 7285 * @crossplatform 7286 * @since 12 7287 */ 7288 getBufferSize(): Promise<number>; 7289 /** 7290 * Obtains a reasonable minimum buffer size in bytes for rendering. 7291 * @returns { number } The audio buffer size. 7292 * @syscap SystemCapability.Multimedia.Audio.Renderer 7293 * @since 10 7294 */ 7295 /** 7296 * Obtains a reasonable minimum buffer size in bytes for rendering. 7297 * @returns { number } The audio buffer size. 7298 * @syscap SystemCapability.Multimedia.Audio.Renderer 7299 * @crossplatform 7300 * @since 12 7301 */ 7302 getBufferSizeSync(): number; 7303 7304 /** 7305 * Sets the render rate. This method uses an asynchronous callback to return the result. 7306 * @param { AudioRendererRate } rate - Audio render rate. 7307 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7308 * @syscap SystemCapability.Multimedia.Audio.Renderer 7309 * @since 8 7310 * @deprecated since 11 7311 * @useinstead ohos.multimedia.audio.AudioRenderer#setSpeed 7312 */ 7313 setRenderRate(rate: AudioRendererRate, callback: AsyncCallback<void>): void; 7314 7315 /** 7316 * Sets the render rate. This method uses a promise to return the result. 7317 * @param { AudioRendererRate } rate - Audio render rate. 7318 * @returns { Promise<void> } Promise used to return the result. 7319 * @syscap SystemCapability.Multimedia.Audio.Renderer 7320 * @since 8 7321 * @deprecated since 11 7322 * @useinstead ohos.multimedia.audio.AudioRenderer#setSpeed 7323 */ 7324 setRenderRate(rate: AudioRendererRate): Promise<void>; 7325 7326 /** 7327 * Sets the playback speed. 7328 * @param { number } speed - Audio playback speed. The value type is float, form 0.25 to 4.0. 7329 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7330 * 1.Mandatory parameters are left unspecified; 7331 * 2.Incorrect parameter types. 7332 * @throws { BusinessError } 6800101 - Parameter verification failed. 7333 * @syscap SystemCapability.Multimedia.Audio.Renderer 7334 * @since 11 7335 */ 7336 /** 7337 * Sets the playback speed. 7338 * @param { number } speed - Audio playback speed. The value type is float, form 0.25 to 4.0. 7339 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7340 * 1.Mandatory parameters are left unspecified; 7341 * 2.Incorrect parameter types. 7342 * @throws { BusinessError } 6800101 - Parameter verification failed. 7343 * @syscap SystemCapability.Multimedia.Audio.Renderer 7344 * @crossplatform 7345 * @since 12 7346 */ 7347 setSpeed(speed: number): void; 7348 7349 /** 7350 * Obtains the current render rate. This method uses an asynchronous callback to return the result. 7351 * @param { AsyncCallback<AudioRendererRate> } callback - Callback used to return the audio render rate. 7352 * @syscap SystemCapability.Multimedia.Audio.Renderer 7353 * @since 8 7354 * @deprecated since 11 7355 * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed 7356 */ 7357 getRenderRate(callback: AsyncCallback<AudioRendererRate>): void; 7358 7359 /** 7360 * Obtains the current render rate. This method uses a promise to return the result. 7361 * @returns { Promise<AudioRendererRate> } Promise used to return the audio render rate. 7362 * @syscap SystemCapability.Multimedia.Audio.Renderer 7363 * @since 8 7364 * @deprecated since 11 7365 * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed 7366 */ 7367 getRenderRate(): Promise<AudioRendererRate>; 7368 7369 /** 7370 * Obtains the current render rate. 7371 * @returns { AudioRendererRate } The audio render rate. 7372 * @syscap SystemCapability.Multimedia.Audio.Renderer 7373 * @since 10 7374 * @deprecated since 11 7375 * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed 7376 */ 7377 getRenderRateSync(): AudioRendererRate; 7378 7379 /** 7380 * Obtains the current playback speed. 7381 * @returns { number } The playback speed. 7382 * @syscap SystemCapability.Multimedia.Audio.Renderer 7383 * @since 11 7384 */ 7385 /** 7386 * Obtains the current playback speed. 7387 * @returns { number } The playback speed. 7388 * @syscap SystemCapability.Multimedia.Audio.Renderer 7389 * @crossplatform 7390 * @since 12 7391 */ 7392 getSpeed(): number; 7393 7394 /** 7395 * Set interrupt mode. 7396 * @param { InterruptMode } mode - The interrupt mode. 7397 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7398 * @syscap SystemCapability.Multimedia.Audio.Interrupt 7399 * @since 9 7400 */ 7401 /** 7402 * Set interrupt mode. 7403 * @param { InterruptMode } mode - The interrupt mode. 7404 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7405 * @syscap SystemCapability.Multimedia.Audio.Interrupt 7406 * @crossplatform 7407 * @since 12 7408 */ 7409 setInterruptMode(mode: InterruptMode, callback: AsyncCallback<void>): void; 7410 /** 7411 * Set interrupt mode. 7412 * @param { InterruptMode } mode - The interrupt mode. 7413 * @returns { Promise<void> } Promise used to return the result. 7414 * @syscap SystemCapability.Multimedia.Audio.Interrupt 7415 * @since 9 7416 */ 7417 /** 7418 * Set interrupt mode. 7419 * @param { InterruptMode } mode - The interrupt mode. 7420 * @returns { Promise<void> } Promise used to return the result. 7421 * @syscap SystemCapability.Multimedia.Audio.Interrupt 7422 * @crossplatform 7423 * @since 12 7424 */ 7425 setInterruptMode(mode: InterruptMode): Promise<void>; 7426 /** 7427 * Set interrupt mode. 7428 * @param { InterruptMode } mode - The interrupt mode. 7429 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7430 * 1.Mandatory parameters are left unspecified; 7431 * 2.Incorrect parameter types. 7432 * @throws { BusinessError } 6800101 - Parameter verification failed. 7433 * @syscap SystemCapability.Multimedia.Audio.Interrupt 7434 * @since 10 7435 */ 7436 /** 7437 * Set interrupt mode. 7438 * @param { InterruptMode } mode - The interrupt mode. 7439 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7440 * 1.Mandatory parameters are left unspecified; 7441 * 2.Incorrect parameter types. 7442 * @throws { BusinessError } 6800101 - Parameter verification failed. 7443 * @syscap SystemCapability.Multimedia.Audio.Interrupt 7444 * @crossplatform 7445 * @since 12 7446 */ 7447 setInterruptModeSync(mode: InterruptMode): void; 7448 7449 /** 7450 * Sets the volume for this stream. This method uses an asynchronous callback to return the result. 7451 * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. 7452 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7453 * @syscap SystemCapability.Multimedia.Audio.Renderer 7454 * @since 9 7455 */ 7456 /** 7457 * Sets the volume for this stream. This method uses an asynchronous callback to return the result. 7458 * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. 7459 * @param { AsyncCallback<void> } callback - Callback used to return the result. 7460 * @syscap SystemCapability.Multimedia.Audio.Renderer 7461 * @crossplatform 7462 * @since 12 7463 */ 7464 setVolume(volume: number, callback: AsyncCallback<void>): void; 7465 /** 7466 * Sets the volume for a stream. This method uses a promise to return the result. 7467 * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. 7468 * @returns { Promise<void> } Promise used to return the result. 7469 * @syscap SystemCapability.Multimedia.Audio.Renderer 7470 * @since 9 7471 */ 7472 /** 7473 * Sets the volume for a stream. This method uses a promise to return the result. 7474 * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. 7475 * @returns { Promise<void> } Promise used to return the result. 7476 * @syscap SystemCapability.Multimedia.Audio.Renderer 7477 * @crossplatform 7478 * @since 12 7479 */ 7480 setVolume(volume: number): Promise<void>; 7481 7482 /** 7483 * Gets volume of this stream. 7484 * @returns { number } Returns one float value. 7485 * @syscap SystemCapability.Multimedia.Audio.Renderer 7486 * @since 12 7487 */ 7488 getVolume(): number; 7489 7490 /** 7491 * Changes the volume with ramp for a duration. 7492 * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. 7493 * @param { number } duration - Duration for volume ramp, in millisecond. 7494 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7495 * 1.Mandatory parameters are left unspecified; 7496 * 2.Incorrect parameter types. 7497 * @throws { BusinessError } 6800101 - Parameter verification failed. 7498 * @syscap SystemCapability.Multimedia.Audio.Renderer 7499 * @since 11 7500 */ 7501 /** 7502 * Changes the volume with ramp for a duration. 7503 * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. 7504 * @param { number } duration - Duration for volume ramp, in millisecond. 7505 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7506 * 1.Mandatory parameters are left unspecified; 7507 * 2.Incorrect parameter types. 7508 * @throws { BusinessError } 6800101 - Parameter verification failed. 7509 * @syscap SystemCapability.Multimedia.Audio.Renderer 7510 * @crossplatform 7511 * @since 12 7512 */ 7513 setVolumeWithRamp(volume: number, duration: number): void; 7514 7515 /** 7516 * Gets the min volume this stream can set. This method uses an asynchronous callback to return the result. 7517 * @param { AsyncCallback<number> } callback - Callback used to return the result. 7518 * @syscap SystemCapability.Multimedia.Audio.Renderer 7519 * @since 10 7520 */ 7521 /** 7522 * Gets the min volume this stream can set. This method uses an asynchronous callback to return the result. 7523 * @param { AsyncCallback<number> } callback - Callback used to return the result. 7524 * @syscap SystemCapability.Multimedia.Audio.Renderer 7525 * @crossplatform 7526 * @since 12 7527 */ 7528 getMinStreamVolume(callback: AsyncCallback<number>): void; 7529 /** 7530 * Gets the min volume this stream can set. This method uses a promise to return the result. 7531 * @returns { Promise<number> } Promise used to return the result. 7532 * @syscap SystemCapability.Multimedia.Audio.Renderer 7533 * @since 10 7534 */ 7535 /** 7536 * Gets the min volume this stream can set. This method uses a promise to return the result. 7537 * @returns { Promise<number> } Promise used to return the result. 7538 * @syscap SystemCapability.Multimedia.Audio.Renderer 7539 * @crossplatform 7540 * @since 12 7541 */ 7542 getMinStreamVolume(): Promise<number>; 7543 /** 7544 * Gets the min volume this stream can set. 7545 * @returns { number } Min stream volume. 7546 * @syscap SystemCapability.Multimedia.Audio.Renderer 7547 * @since 10 7548 */ 7549 /** 7550 * Gets the min volume this stream can set. 7551 * @returns { number } Min stream volume. 7552 * @syscap SystemCapability.Multimedia.Audio.Renderer 7553 * @crossplatform 7554 * @since 12 7555 */ 7556 getMinStreamVolumeSync(): number; 7557 7558 /** 7559 * Gets the max volume this stream can set. This method uses an asynchronous callback to return the result. 7560 * @param { AsyncCallback<number> } callback - Callback used to return the result. 7561 * @syscap SystemCapability.Multimedia.Audio.Renderer 7562 * @since 10 7563 */ 7564 /** 7565 * Gets the max volume this stream can set. This method uses an asynchronous callback to return the result. 7566 * @param { AsyncCallback<number> } callback - Callback used to return the result. 7567 * @syscap SystemCapability.Multimedia.Audio.Renderer 7568 * @crossplatform 7569 * @since 12 7570 */ 7571 getMaxStreamVolume(callback: AsyncCallback<number>): void; 7572 /** 7573 * Gets the max volume this stream can set. This method uses a promise to return the result. 7574 * @returns { Promise<number> } Promise used to return the result. 7575 * @syscap SystemCapability.Multimedia.Audio.Renderer 7576 * @since 10 7577 */ 7578 /** 7579 * Gets the max volume this stream can set. This method uses a promise to return the result. 7580 * @returns { Promise<number> } Promise used to return the result. 7581 * @syscap SystemCapability.Multimedia.Audio.Renderer 7582 * @crossplatform 7583 * @since 12 7584 */ 7585 getMaxStreamVolume(): Promise<number>; 7586 /** 7587 * Gets the max volume this stream can set. 7588 * @returns { number } Max stream volume. 7589 * @syscap SystemCapability.Multimedia.Audio.Renderer 7590 * @since 10 7591 */ 7592 /** 7593 * Gets the max volume this stream can set. 7594 * @returns { number } Max stream volume. 7595 * @syscap SystemCapability.Multimedia.Audio.Renderer 7596 * @crossplatform 7597 * @since 12 7598 */ 7599 getMaxStreamVolumeSync(): number; 7600 7601 /** 7602 * Gets buffer underflow count. This method uses an asynchronous callback to return the result. 7603 * @param { AsyncCallback<number> } callback - Callback used to return the result. 7604 * @syscap SystemCapability.Multimedia.Audio.Renderer 7605 * @since 10 7606 */ 7607 /** 7608 * Gets buffer underflow count. This method uses an asynchronous callback to return the result. 7609 * @param { AsyncCallback<number> } callback - Callback used to return the result. 7610 * @syscap SystemCapability.Multimedia.Audio.Renderer 7611 * @crossplatform 7612 * @since 12 7613 */ 7614 getUnderflowCount(callback: AsyncCallback<number>): void; 7615 /** 7616 * Gets buffer underflow count. This method uses a promise to return the result. 7617 * @returns { Promise<number> } Promise used to return the result. 7618 * @syscap SystemCapability.Multimedia.Audio.Renderer 7619 * @since 10 7620 */ 7621 /** 7622 * Gets buffer underflow count. This method uses a promise to return the result. 7623 * @returns { Promise<number> } Promise used to return the result. 7624 * @syscap SystemCapability.Multimedia.Audio.Renderer 7625 * @crossplatform 7626 * @since 12 7627 */ 7628 getUnderflowCount(): Promise<number>; 7629 /** 7630 * Gets buffer underflow count. 7631 * @returns { number } Underflow count number. 7632 * @syscap SystemCapability.Multimedia.Audio.Renderer 7633 * @since 10 7634 */ 7635 /** 7636 * Gets buffer underflow count. 7637 * @returns { number } Underflow count number. 7638 * @syscap SystemCapability.Multimedia.Audio.Renderer 7639 * @crossplatform 7640 * @since 12 7641 */ 7642 getUnderflowCountSync(): number; 7643 7644 /** 7645 * Gets the output device or devices for this stream. 7646 * This method uses an asynchronous callback to return the result. 7647 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the result. 7648 * @syscap SystemCapability.Multimedia.Audio.Device 7649 * @since 10 7650 */ 7651 /** 7652 * Gets the output device or devices for this stream. 7653 * This method uses an asynchronous callback to return the result. 7654 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the result. 7655 * @syscap SystemCapability.Multimedia.Audio.Device 7656 * @crossplatform 7657 * @since 12 7658 */ 7659 getCurrentOutputDevices(callback: AsyncCallback<AudioDeviceDescriptors>): void; 7660 /** 7661 * Gets the output device or devices for this stream. 7662 * This method uses a promise to return the result. 7663 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the result. 7664 * @syscap SystemCapability.Multimedia.Audio.Device 7665 * @since 10 7666 */ 7667 /** 7668 * Gets the output device or devices for this stream. 7669 * This method uses a promise to return the result. 7670 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the result. 7671 * @syscap SystemCapability.Multimedia.Audio.Device 7672 * @crossplatform 7673 * @since 12 7674 */ 7675 getCurrentOutputDevices(): Promise<AudioDeviceDescriptors>; 7676 /** 7677 * Gets the output device or devices for this stream. 7678 * @returns { AudioDeviceDescriptors } Output device or devices. 7679 * @syscap SystemCapability.Multimedia.Audio.Device 7680 * @since 10 7681 */ 7682 /** 7683 * Gets the output device or devices for this stream. 7684 * @returns { AudioDeviceDescriptors } Output device or devices. 7685 * @syscap SystemCapability.Multimedia.Audio.Device 7686 * @crossplatform 7687 * @since 12 7688 */ 7689 getCurrentOutputDevicesSync(): AudioDeviceDescriptors; 7690 7691 /** 7692 * Sets channel blend mode for this stream. 7693 * @param { ChannelBlendMode } mode - Target channel blend mode. 7694 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7695 * 1.Mandatory parameters are left unspecified; 7696 * 2.Incorrect parameter types. 7697 * @throws { BusinessError } 6800101 - Parameter verification failed. 7698 * @throws { BusinessError } 6800103 - Operation not permit at current state. 7699 * @syscap SystemCapability.Multimedia.Audio.Renderer 7700 * @since 11 7701 */ 7702 /** 7703 * Sets channel blend mode for this stream. 7704 * @param { ChannelBlendMode } mode - Target channel blend mode. 7705 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7706 * 1.Mandatory parameters are left unspecified; 7707 * 2.Incorrect parameter types. 7708 * @throws { BusinessError } 6800101 - Parameter verification failed. 7709 * @throws { BusinessError } 6800103 - Operation not permit at current state. 7710 * @syscap SystemCapability.Multimedia.Audio.Renderer 7711 * @crossplatform 7712 * @since 12 7713 */ 7714 setChannelBlendMode(mode: ChannelBlendMode): void; 7715 7716 /** 7717 * Sets silent and mix with other stream for this stream. 7718 * @param { boolean } on - Whether play silent and mix with other streams. 7719 * true: set the silent mode and mix with other streams. 7720 * false: unset the silent mode, current stream will trigger the audio focus internally. 7721 * @syscap SystemCapability.Multimedia.Audio.Renderer 7722 * @since 12 7723 */ 7724 setSilentModeAndMixWithOthers(on: boolean): void; 7725 7726 /** 7727 * Gets silent and mix with other stream status for this stream. 7728 * @returns { boolean } Returns silent and mix with other stream status. 7729 * true: current stream is in the silent mode and mix with other streams. 7730 * false: current stream in in the normal playback mode 7731 * @syscap SystemCapability.Multimedia.Audio.Renderer 7732 * @since 12 7733 */ 7734 getSilentModeAndMixWithOthers(): boolean; 7735 7736 /** 7737 * Temporarily changes the current audio device 7738 * This function applys on audiorenderers whose StreamUsage are 7739 * STREAM_USAGE_VOICE_COMMUNICATIN/STREAM_USAGE_VIDEO_COMMUNICATION/STREAM_USAGE_VOICE_MESSAGE. 7740 * Setting the device will only takes effect if no other accessory such as headphones are in use 7741 * @param { DeviceType } deviceType - the available deviceTypes are 7742 * EARPIECE: Built-in earpiece 7743 * SPEAKER: Built-in speaker 7744 * DEFAULT: System default output device 7745 * @returns { Promise<void> } Promise used to return the result. 7746 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7747 * 1.Mandatory parameters are left unspecified; 7748 * 2.Incorrect parameter types. 7749 * @throws { BusinessError } 6800101 - Parameter verification failed. 7750 * @throws { BusinessError } 6800103 - Operation not permit at current state. 7751 * @syscap SystemCapability.Multimedia.Audio.Renderer 7752 * @since 12 7753 */ 7754 setDefaultOutputDevice(deviceType: DeviceType): Promise<void>; 7755 7756 /** 7757 * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is 7758 * triggered when audio playback is interrupted. 7759 * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. 7760 * @param { Callback<InterruptEvent> } callback - Callback used to listen for interrupt callback. 7761 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7762 * 1.Mandatory parameters are left unspecified; 7763 * 2.Incorrect parameter types. 7764 * @throws { BusinessError } 6800101 - Parameter verification failed. 7765 * @syscap SystemCapability.Multimedia.Audio.Interrupt 7766 * @since 9 7767 */ 7768 /** 7769 * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is 7770 * triggered when audio playback is interrupted. 7771 * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. 7772 * @param { Callback<InterruptEvent> } callback - Callback used to listen for interrupt callback. 7773 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7774 * 1.Mandatory parameters are left unspecified; 7775 * 2.Incorrect parameter types. 7776 * @throws { BusinessError } 6800101 - Parameter verification failed. 7777 * @syscap SystemCapability.Multimedia.Audio.Interrupt 7778 * @crossplatform 7779 * @since 12 7780 */ 7781 on(type: 'audioInterrupt', callback: Callback<InterruptEvent>): void; 7782 7783 /** 7784 * Unsubscribes audio interrupt events. 7785 * @param { 'audioInterrupt' } type - Type of the event to listen for. 7786 * @param { Callback<InterruptEvent> } callback - Callback used to listen for interrupt callback. 7787 * @throws { BusinessError } 6800101 - Parameter verification failed. 7788 * @syscap SystemCapability.Multimedia.Audio.Interrupt 7789 * @since 18 7790 */ 7791 off(type: 'audioInterrupt', callback?: Callback<InterruptEvent>): void; 7792 7793 /** 7794 * Subscribes to mark reached events. When the number of frames rendered reaches the value of the frame parameter, 7795 * the callback is invoked. 7796 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 7797 * @param { number } frame - Number of frames to trigger the event. The value must be greater than 0. 7798 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 7799 * @syscap SystemCapability.Multimedia.Audio.Renderer 7800 * @since 8 7801 */ 7802 /** 7803 * Subscribes to mark reached events. When the number of frames rendered reaches the value of the frame parameter, 7804 * the callback is invoked. 7805 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 7806 * @param { number } frame - Number of frames to trigger the event. The value must be greater than 0. 7807 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 7808 * @syscap SystemCapability.Multimedia.Audio.Renderer 7809 * @crossplatform 7810 * @since 12 7811 */ 7812 on(type: 'markReach', frame: number, callback: Callback<number>): void; 7813 /** 7814 * Unsubscribes from mark reached events. 7815 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 7816 * @syscap SystemCapability.Multimedia.Audio.Renderer 7817 * @since 8 7818 */ 7819 /** 7820 * Unsubscribes from mark reached events. 7821 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 7822 * @syscap SystemCapability.Multimedia.Audio.Renderer 7823 * @crossplatform 7824 * @since 12 7825 */ 7826 /** 7827 * Unsubscribes from mark reached events. 7828 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 7829 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 7830 * @syscap SystemCapability.Multimedia.Audio.Renderer 7831 * @crossplatform 7832 * @since 18 7833 */ 7834 off(type: 'markReach', callback?: Callback<number>): void; 7835 7836 /** 7837 * Subscribes to period reached events. When the period of frame rendering reaches the value of frame parameter, 7838 * the callback is invoked. 7839 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 7840 * @param { number } frame - Period during which frame rendering is listened. The value must be greater than 0. 7841 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 7842 * @syscap SystemCapability.Multimedia.Audio.Renderer 7843 * @since 8 7844 */ 7845 /** 7846 * Subscribes to period reached events. When the period of frame rendering reaches the value of frame parameter, 7847 * the callback is invoked. 7848 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 7849 * @param { number } frame - Period during which frame rendering is listened. The value must be greater than 0. 7850 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 7851 * @syscap SystemCapability.Multimedia.Audio.Renderer 7852 * @crossplatform 7853 * @since 12 7854 */ 7855 on(type: 'periodReach', frame: number, callback: Callback<number>): void; 7856 /** 7857 * Unsubscribes from period reached events. 7858 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 7859 * @syscap SystemCapability.Multimedia.Audio.Renderer 7860 * @since 8 7861 */ 7862 /** 7863 * Unsubscribes from period reached events. 7864 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 7865 * @syscap SystemCapability.Multimedia.Audio.Renderer 7866 * @crossplatform 7867 * @since 12 7868 */ 7869 /** 7870 * Unsubscribes from period reached events. 7871 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 7872 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 7873 * @syscap SystemCapability.Multimedia.Audio.Renderer 7874 * @crossplatform 7875 * @since 18 7876 */ 7877 off(type: 'periodReach', callback?: Callback<number>): void; 7878 7879 /** 7880 * Subscribes audio state change event callback. 7881 * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. 7882 * @param { Callback<AudioState> } callback - Callback invoked when state change. 7883 * @syscap SystemCapability.Multimedia.Audio.Renderer 7884 * @since 8 7885 */ 7886 /** 7887 * Subscribes audio state change event callback. 7888 * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. 7889 * @param { Callback<AudioState> } callback - Callback invoked when state change. 7890 * @syscap SystemCapability.Multimedia.Audio.Renderer 7891 * @crossplatform 7892 * @since 12 7893 */ 7894 on(type: 'stateChange', callback: Callback<AudioState>): void; 7895 7896 /** 7897 * Unsubscribes audio state change event callback. 7898 * @param { 'stateChange' } type - Type of the event to listen for. 7899 * @param { Callback<AudioState> } callback - Callback invoked when state change. 7900 * @throws { BusinessError } 6800101 - Parameter verification failed. 7901 * @syscap SystemCapability.Multimedia.Audio.Renderer 7902 * @since 18 7903 */ 7904 off(type: 'stateChange', callback?: Callback<AudioState>): void; 7905 7906 /** 7907 * Subscribes output device change event callback. 7908 * The event is triggered when output device change for this stream. 7909 * @param { 'outputDeviceChange' } type - Type of the event to listen for. 7910 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to listen device change event. 7911 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7912 * 1.Mandatory parameters are left unspecified; 7913 * 2.Incorrect parameter types. 7914 * @throws { BusinessError } 6800101 - Parameter verification failed. 7915 * @syscap SystemCapability.Multimedia.Audio.Device 7916 * @since 10 7917 */ 7918 /** 7919 * Subscribes output device change event callback. 7920 * The event is triggered when output device change for this stream. 7921 * @param { 'outputDeviceChange' } type - Type of the event to listen for. 7922 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to listen device change event. 7923 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7924 * 1.Mandatory parameters are left unspecified; 7925 * 2.Incorrect parameter types. 7926 * @throws { BusinessError } 6800101 - Parameter verification failed. 7927 * @syscap SystemCapability.Multimedia.Audio.Device 7928 * @crossplatform 7929 * @since 12 7930 */ 7931 on(type: 'outputDeviceChange', callback: Callback<AudioDeviceDescriptors>): void; 7932 7933 /** 7934 * Subscribes output device change event callback. 7935 * The event is triggered when output device change for this stream. 7936 * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. 7937 * @param { Callback<AudioStreamDeviceChangeInfo> } callback - Callback used to listen device change event. 7938 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7939 * 1.Mandatory parameters are left unspecified; 7940 * 2.Incorrect parameter types. 7941 * @throws { BusinessError } 6800101 - Parameter verification failed. 7942 * @syscap SystemCapability.Multimedia.Audio.Device 7943 * @since 11 7944 */ 7945 /** 7946 * Subscribes output device change event callback. 7947 * The event is triggered when output device change for this stream. 7948 * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. 7949 * @param { Callback<AudioStreamDeviceChangeInfo> } callback - Callback used to listen device change event. 7950 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7951 * 1.Mandatory parameters are left unspecified; 7952 * 2.Incorrect parameter types. 7953 * @throws { BusinessError } 6800101 - Parameter verification failed. 7954 * @syscap SystemCapability.Multimedia.Audio.Device 7955 * @crossplatform 7956 * @since 12 7957 */ 7958 on(type: 'outputDeviceChangeWithInfo', callback: Callback<AudioStreamDeviceChangeInfo>): void; 7959 7960 /** 7961 * Unsubscribes output device change event callback. 7962 * @param { 'outputDeviceChange' } type - Type of the event to listen for. 7963 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used in subscribe. 7964 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7965 * 1.Mandatory parameters are left unspecified; 7966 * 2.Incorrect parameter types. 7967 * @throws { BusinessError } 6800101 - Parameter verification failed. 7968 * @syscap SystemCapability.Multimedia.Audio.Device 7969 * @since 10 7970 */ 7971 /** 7972 * Unsubscribes output device change event callback. 7973 * @param { 'outputDeviceChange' } type - Type of the event to listen for. 7974 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used in subscribe. 7975 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7976 * 1.Mandatory parameters are left unspecified; 7977 * 2.Incorrect parameter types. 7978 * @throws { BusinessError } 6800101 - Parameter verification failed. 7979 * @syscap SystemCapability.Multimedia.Audio.Device 7980 * @crossplatform 7981 * @since 12 7982 */ 7983 off(type: 'outputDeviceChange', callback?: Callback<AudioDeviceDescriptors>): void; 7984 7985 /** 7986 * Unsubscribes output device change event callback. 7987 * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. 7988 * @param { Callback<AudioStreamDeviceChangeInfo> } callback - Callback used in subscribe. 7989 * @throws { BusinessError } 401 - Parameter error. Possible causes: 7990 * 1.Mandatory parameters are left unspecified; 7991 * 2.Incorrect parameter types. 7992 * @throws { BusinessError } 6800101 - Parameter verification failed. 7993 * @syscap SystemCapability.Multimedia.Audio.Device 7994 * @since 11 7995 */ 7996 /** 7997 * Unsubscribes output device change event callback. 7998 * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. 7999 * @param { Callback<AudioStreamDeviceChangeInfo> } callback - Callback used in subscribe. 8000 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8001 * 1.Mandatory parameters are left unspecified; 8002 * 2.Incorrect parameter types. 8003 * @throws { BusinessError } 6800101 - Parameter verification failed. 8004 * @syscap SystemCapability.Multimedia.Audio.Device 8005 * @crossplatform 8006 * @since 12 8007 */ 8008 off(type: 'outputDeviceChangeWithInfo', callback?: Callback<AudioStreamDeviceChangeInfo>): void; 8009 8010 /** 8011 * Subscribes audio data callback. 8012 * The event is triggered when audio buffer is available for writing more data. 8013 * @param { 'writeData' } type - Type of the event to listen for. 8014 * @param { Callback<ArrayBuffer> } callback - Callback with buffer to write. 8015 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8016 * 1.Mandatory parameters are left unspecified; 8017 * 2.Incorrect parameter types. 8018 * @throws { BusinessError } 6800101 - Parameter verification failed. 8019 * @syscap SystemCapability.Multimedia.Audio.Renderer 8020 * @since 11 8021 */ 8022 /** 8023 * Subscribes audio data callback. 8024 * The event is triggered when audio buffer is available for writing more data. 8025 * @param { 'writeData' } type - Type of the event to listen for. 8026 * @param { AudioRendererWriteDataCallback } callback - Audio renderer write data callback. 8027 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8028 * 1.Mandatory parameters are left unspecified; 8029 * 2.Incorrect parameter types. 8030 * @throws { BusinessError } 6800101 - Parameter verification failed. 8031 * @syscap SystemCapability.Multimedia.Audio.Renderer 8032 * @crossplatform 8033 * @since 12 8034 */ 8035 on(type: 'writeData', callback: AudioRendererWriteDataCallback): void; 8036 8037 /** 8038 * Unsubscribes audio data callback. 8039 * @param { 'writeData' } type - Type of the event to listen for. 8040 * @param { Callback<ArrayBuffer> } callback - Callback used in subscribe. 8041 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8042 * 1.Mandatory parameters are left unspecified; 8043 * 2.Incorrect parameter types. 8044 * @throws { BusinessError } 6800101 - Parameter verification failed. 8045 * @syscap SystemCapability.Multimedia.Audio.Renderer 8046 * @since 11 8047 */ 8048 /** 8049 * Unsubscribes audio data callback. 8050 * @param { 'writeData' } type - Type of the event to listen for. 8051 * @param { AudioRendererWriteDataCallback } callback - Audio renderer write data callback. 8052 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8053 * 1.Mandatory parameters are left unspecified; 8054 * 2.Incorrect parameter types. 8055 * @throws { BusinessError } 6800101 - Parameter verification failed. 8056 * @syscap SystemCapability.Multimedia.Audio.Renderer 8057 * @crossplatform 8058 * @since 12 8059 */ 8060 off(type: 'writeData', callback?: AudioRendererWriteDataCallback): void; 8061 } 8062 8063 /** 8064 * Enumerates source types. 8065 * @enum { number } 8066 * @syscap SystemCapability.Multimedia.Audio.Core 8067 * @since 8 8068 */ 8069 /** 8070 * Enumerates source types. 8071 * @enum { number } 8072 * @syscap SystemCapability.Multimedia.Audio.Core 8073 * @crossplatform 8074 * @since 12 8075 */ 8076 enum SourceType { 8077 /** 8078 * Invalid source type. 8079 * @syscap SystemCapability.Multimedia.Audio.Core 8080 * @since 8 8081 */ 8082 SOURCE_TYPE_INVALID = -1, 8083 /** 8084 * Mic source type. 8085 * @syscap SystemCapability.Multimedia.Audio.Core 8086 * @since 8 8087 */ 8088 /** 8089 * Mic source type. 8090 * @syscap SystemCapability.Multimedia.Audio.Core 8091 * @crossplatform 8092 * @since 12 8093 */ 8094 SOURCE_TYPE_MIC = 0, 8095 /** 8096 * Voice recognition source type. 8097 * @syscap SystemCapability.Multimedia.Audio.Core 8098 * @since 9 8099 */ 8100 /** 8101 * Voice recognition source type. 8102 * @syscap SystemCapability.Multimedia.Audio.Core 8103 * @crossplatform 8104 * @since 12 8105 */ 8106 SOURCE_TYPE_VOICE_RECOGNITION = 1, 8107 /** 8108 * Playback capture source type. 8109 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 8110 * @since 10 8111 * @deprecated since 12 8112 * @useinstead OH_AVScreenCapture in native interface. 8113 */ 8114 SOURCE_TYPE_PLAYBACK_CAPTURE = 2, 8115 /** 8116 * Wakeup source type. 8117 * Permission ohos.permission.MANAGE_INTELLIGENT_VOICE is needed when calling createAudioCapturer with this type. 8118 * @syscap SystemCapability.Multimedia.Audio.Core 8119 * @systemapi 8120 * @since 10 8121 */ 8122 SOURCE_TYPE_WAKEUP = 3, 8123 8124 /** 8125 * Voice call source type. 8126 * Permission ohos.permission.RECORD_VOICE_CALL is needed when calling createAudioCapturer with this type. 8127 * @syscap SystemCapability.Multimedia.Audio.Core 8128 * @systemapi 8129 * @since 11 8130 */ 8131 SOURCE_TYPE_VOICE_CALL = 4, 8132 8133 /** 8134 * Voice communication source type. 8135 * @syscap SystemCapability.Multimedia.Audio.Core 8136 * @since 8 8137 */ 8138 /** 8139 * Voice communication source type. 8140 * @syscap SystemCapability.Multimedia.Audio.Core 8141 * @crossplatform 8142 * @since 12 8143 */ 8144 SOURCE_TYPE_VOICE_COMMUNICATION = 7, 8145 8146 /** 8147 * Voice message source type. 8148 * @syscap SystemCapability.Multimedia.Audio.Core 8149 * @since 12 8150 */ 8151 SOURCE_TYPE_VOICE_MESSAGE = 10, 8152 8153 /** 8154 * Source type for voice transcription and processing. 8155 * @syscap SystemCapability.Multimedia.Audio.Core 8156 * @systemapi 8157 * @since 18 8158 */ 8159 SOURCE_TYPE_VOICE_TRANSCRIPTION = 12, 8160 8161 /** 8162 * Camcorder source type. 8163 * @syscap SystemCapability.Multimedia.Audio.Core 8164 * @since 13 8165 */ 8166 SOURCE_TYPE_CAMCORDER = 13, 8167 8168 /** 8169 * Unprocessed source type. 8170 * @syscap SystemCapability.Multimedia.Audio.Core 8171 * @since 14 8172 */ 8173 SOURCE_TYPE_UNPROCESSED = 14 8174 } 8175 8176 /** 8177 * Describes audio capturer information. 8178 * @typedef AudioCapturerInfo 8179 * @syscap SystemCapability.Multimedia.Audio.Core 8180 * @since 8 8181 */ 8182 /** 8183 * Describes audio capturer information. 8184 * @typedef AudioCapturerInfo 8185 * @syscap SystemCapability.Multimedia.Audio.Core 8186 * @crossplatform 8187 * @since 12 8188 */ 8189 interface AudioCapturerInfo { 8190 /** 8191 * Audio source type. 8192 * @type { SourceType } 8193 * @syscap SystemCapability.Multimedia.Audio.Core 8194 * @since 8 8195 */ 8196 /** 8197 * Audio source type. 8198 * @type { SourceType } 8199 * @syscap SystemCapability.Multimedia.Audio.Core 8200 * @crossplatform 8201 * @since 12 8202 */ 8203 source: SourceType; 8204 /** 8205 * Audio capturer flags. 8206 * @type { number } 8207 * @syscap SystemCapability.Multimedia.Audio.Core 8208 * @since 8 8209 */ 8210 /** 8211 * Audio capturer flags. 8212 * @type { number } 8213 * @syscap SystemCapability.Multimedia.Audio.Core 8214 * @crossplatform 8215 * @since 12 8216 */ 8217 capturerFlags: number; 8218 } 8219 8220 /** 8221 * Describes audio capturer configuration options. 8222 * @typedef AudioCapturerOptions 8223 * @syscap SystemCapability.Multimedia.Audio.Capturer 8224 * @since 8 8225 */ 8226 /** 8227 * Describes audio capturer configuration options. 8228 * @typedef AudioCapturerOptions 8229 * @syscap SystemCapability.Multimedia.Audio.Capturer 8230 * @crossplatform 8231 * @since 12 8232 */ 8233 interface AudioCapturerOptions { 8234 /** 8235 * Stream information. 8236 * @type { AudioStreamInfo } 8237 * @syscap SystemCapability.Multimedia.Audio.Capturer 8238 * @since 8 8239 */ 8240 /** 8241 * Stream information. 8242 * @type { AudioStreamInfo } 8243 * @syscap SystemCapability.Multimedia.Audio.Capturer 8244 * @crossplatform 8245 * @since 12 8246 */ 8247 streamInfo: AudioStreamInfo; 8248 /** 8249 * Capturer information. 8250 * @type { AudioCapturerInfo } 8251 * @syscap SystemCapability.Multimedia.Audio.Capturer 8252 * @since 8 8253 */ 8254 /** 8255 * Capturer information. 8256 * @type { AudioCapturerInfo } 8257 * @syscap SystemCapability.Multimedia.Audio.Capturer 8258 * @crossplatform 8259 * @since 12 8260 */ 8261 capturerInfo: AudioCapturerInfo; 8262 /** 8263 * Playback capture config. 8264 * @type { ?AudioPlaybackCaptureConfig } 8265 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 8266 * @since 10 8267 * @deprecated since 12 8268 * @useinstead OH_AVScreenCapture in native interface. 8269 */ 8270 playbackCaptureConfig?: AudioPlaybackCaptureConfig; 8271 } 8272 8273 /** 8274 * Describe playback capture filtering options 8275 * @typedef CaptureFilterOptions 8276 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 8277 * @since 10 8278 * @deprecated since 12 8279 * @useinstead OH_AVScreenCapture in native interface. 8280 */ 8281 interface CaptureFilterOptions { 8282 /** 8283 * Filter by stream usages. If you want to capture voice streams, additional permission is needed. 8284 * @type { Array<StreamUsage> } 8285 * @permission ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO 8286 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 8287 * @since 10 8288 */ 8289 /** 8290 * Filter by stream usages. But not allow to capture voice streams. 8291 * @type { Array<StreamUsage> } 8292 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 8293 * @since 11 8294 * @deprecated since 12 8295 * @useinstead OH_AVScreenCapture in native interface. 8296 */ 8297 usages: Array<StreamUsage>; 8298 } 8299 8300 /** 8301 * Describe playback capture config object. 8302 * @typedef AudioPlaybackCaptureConfig 8303 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 8304 * @since 10 8305 * @deprecated since 12 8306 * @useinstead OH_AVScreenCapture in native interface. 8307 */ 8308 interface AudioPlaybackCaptureConfig { 8309 /** 8310 * Add filter options to decide which streams to be captured. 8311 * @type { CaptureFilterOptions } 8312 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 8313 * @since 10 8314 * @deprecated since 12 8315 * @useinstead OH_AVScreenCapture in native interface. 8316 */ 8317 filterOptions: CaptureFilterOptions; 8318 } 8319 8320 /** 8321 * Provides APIs for audio recording. 8322 * @typedef AudioCapturer 8323 * @syscap SystemCapability.Multimedia.Audio.Capturer 8324 * @since 8 8325 */ 8326 /** 8327 * Provides APIs for audio recording. 8328 * @typedef AudioCapturer 8329 * @syscap SystemCapability.Multimedia.Audio.Capturer 8330 * @crossplatform 8331 * @since 12 8332 */ 8333 interface AudioCapturer { 8334 /** 8335 * Defines the current capture state. 8336 * @type { AudioState } 8337 * @syscap SystemCapability.Multimedia.Audio.Capturer 8338 * @since 8 8339 */ 8340 /** 8341 * Defines the current capture state. 8342 * @type { AudioState } 8343 * @readonly 8344 * @syscap SystemCapability.Multimedia.Audio.Capturer 8345 * @crossplatform 8346 * @since 12 8347 */ 8348 readonly state: AudioState; 8349 8350 /** 8351 * Obtains the capturer information provided while creating a capturer instance. This method uses an asynchronous 8352 * callback to return the result. 8353 * @param { AsyncCallback<AudioCapturerInfo> } callback - Callback used to return the capturer information. 8354 * @syscap SystemCapability.Multimedia.Audio.Capturer 8355 * @since 8 8356 */ 8357 /** 8358 * Obtains the capturer information provided while creating a capturer instance. This method uses an asynchronous 8359 * callback to return the result. 8360 * @param { AsyncCallback<AudioCapturerInfo> } callback - Callback used to return the capturer information. 8361 * @syscap SystemCapability.Multimedia.Audio.Capturer 8362 * @crossplatform 8363 * @since 12 8364 */ 8365 getCapturerInfo(callback: AsyncCallback<AudioCapturerInfo>): void; 8366 /** 8367 * Obtains the capturer information provided while creating a capturer instance. This method uses a promise to 8368 * return the result. 8369 * @returns { Promise<AudioCapturerInfo> } Promise used to return the capturer information. 8370 * @syscap SystemCapability.Multimedia.Audio.Capturer 8371 * @since 8 8372 */ 8373 /** 8374 * Obtains the capturer information provided while creating a capturer instance. This method uses a promise to 8375 * return the result. 8376 * @returns { Promise<AudioCapturerInfo> } Promise used to return the capturer information. 8377 * @syscap SystemCapability.Multimedia.Audio.Capturer 8378 * @crossplatform 8379 * @since 12 8380 */ 8381 getCapturerInfo(): Promise<AudioCapturerInfo>; 8382 /** 8383 * Obtains the capturer information provided while creating a capturer instance. 8384 * @returns { AudioCapturerInfo } The capturer information. 8385 * @syscap SystemCapability.Multimedia.Audio.Capturer 8386 * @since 10 8387 */ 8388 /** 8389 * Obtains the capturer information provided while creating a capturer instance. 8390 * @returns { AudioCapturerInfo } The capturer information. 8391 * @syscap SystemCapability.Multimedia.Audio.Capturer 8392 * @crossplatform 8393 * @since 12 8394 */ 8395 getCapturerInfoSync(): AudioCapturerInfo; 8396 8397 /** 8398 * Obtains the capturer stream information. This method uses an asynchronous callback to return the result. 8399 * @param { AsyncCallback<AudioStreamInfo> } callback - Callback used to return the stream information. 8400 * @syscap SystemCapability.Multimedia.Audio.Capturer 8401 * @since 8 8402 */ 8403 /** 8404 * Obtains the capturer stream information. This method uses an asynchronous callback to return the result. 8405 * @param { AsyncCallback<AudioStreamInfo> } callback - Callback used to return the stream information. 8406 * @syscap SystemCapability.Multimedia.Audio.Capturer 8407 * @crossplatform 8408 * @since 12 8409 */ 8410 getStreamInfo(callback: AsyncCallback<AudioStreamInfo>): void; 8411 /** 8412 * Obtains the capturer stream information. This method uses a promise to return the result. 8413 * @returns { Promise<AudioStreamInfo> } Promise used to return the stream information. 8414 * @syscap SystemCapability.Multimedia.Audio.Capturer 8415 * @since 8 8416 */ 8417 /** 8418 * Obtains the capturer stream information. This method uses a promise to return the result. 8419 * @returns { Promise<AudioStreamInfo> } Promise used to return the stream information. 8420 * @syscap SystemCapability.Multimedia.Audio.Capturer 8421 * @crossplatform 8422 * @since 12 8423 */ 8424 getStreamInfo(): Promise<AudioStreamInfo>; 8425 /** 8426 * Obtains the capturer stream information. 8427 * @returns { AudioStreamInfo } The stream information. 8428 * @syscap SystemCapability.Multimedia.Audio.Capturer 8429 * @since 10 8430 */ 8431 /** 8432 * Obtains the capturer stream information. 8433 * @returns { AudioStreamInfo } The stream information. 8434 * @syscap SystemCapability.Multimedia.Audio.Capturer 8435 * @crossplatform 8436 * @since 12 8437 */ 8438 getStreamInfoSync(): AudioStreamInfo; 8439 8440 /** 8441 * Obtains the capturer stream id. This method uses an asynchronous callback to return the result. 8442 * @param { AsyncCallback<number> } callback - Callback used to return the stream id. 8443 * @syscap SystemCapability.Multimedia.Audio.Capturer 8444 * @since 9 8445 */ 8446 /** 8447 * Obtains the capturer stream id. This method uses an asynchronous callback to return the result. 8448 * @param { AsyncCallback<number> } callback - Callback used to return the stream id. 8449 * @syscap SystemCapability.Multimedia.Audio.Capturer 8450 * @crossplatform 8451 * @since 12 8452 */ 8453 getAudioStreamId(callback: AsyncCallback<number>): void; 8454 /** 8455 * Obtains the capturer stream id. This method uses a promise to return the result. 8456 * @returns { Promise<number> } Promise used to return the stream id. 8457 * @syscap SystemCapability.Multimedia.Audio.Capturer 8458 * @since 9 8459 */ 8460 /** 8461 * Obtains the capturer stream id. This method uses a promise to return the result. 8462 * @returns { Promise<number> } Promise used to return the stream id. 8463 * @syscap SystemCapability.Multimedia.Audio.Capturer 8464 * @crossplatform 8465 * @since 12 8466 */ 8467 getAudioStreamId(): Promise<number>; 8468 /** 8469 * Obtains the capturer stream id. 8470 * @returns { number } The stream id. 8471 * @syscap SystemCapability.Multimedia.Audio.Capturer 8472 * @since 10 8473 */ 8474 /** 8475 * Obtains the capturer stream id. 8476 * @returns { number } The stream id. 8477 * @syscap SystemCapability.Multimedia.Audio.Capturer 8478 * @crossplatform 8479 * @since 12 8480 */ 8481 getAudioStreamIdSync(): number; 8482 8483 /** 8484 * Starts capturing. 8485 * Success: This method uses an asynchronous callback to return the result. 8486 * Failure: This method uses an asynchronous callback to return the error instance. Possible causes: 8487 * 6800301: Unsupported state, Audio focus request failed, System error. 8488 * @param { AsyncCallback<void> } callback - Callback used to return the result. 8489 * @syscap SystemCapability.Multimedia.Audio.Capturer 8490 * @since 8 8491 */ 8492 /** 8493 * Starts capturing. This method uses an asynchronous callback to return the result. 8494 * @param { AsyncCallback<void> } callback - Callback used to return the result. 8495 * @syscap SystemCapability.Multimedia.Audio.Capturer 8496 * @crossplatform 8497 * @since 12 8498 */ 8499 start(callback: AsyncCallback<void>): void; 8500 /** 8501 * Starts capturing. 8502 * Success: This method uses a promise to return the result. 8503 * Failure: This method uses a promise to return the error instance. Possible causes: 8504 * 6800301: Unsupported state, Audio focus request failed, System error. 8505 * @returns { Promise<void> } Promise used to return the result. 8506 * @syscap SystemCapability.Multimedia.Audio.Capturer 8507 * @since 8 8508 */ 8509 /** 8510 * Starts capturing. This method uses a promise to return the result. 8511 * @returns { Promise<void> } Promise used to return the result. 8512 * @syscap SystemCapability.Multimedia.Audio.Capturer 8513 * @crossplatform 8514 * @since 12 8515 */ 8516 start(): Promise<void>; 8517 8518 /** 8519 * Reads the buffer from the audio capturer. This method uses an asynchronous callback to return the result. 8520 * @param { number } size - Number of bytes to read. 8521 * @param { boolean } isBlockingRead - Whether the read operation should be blocked. 8522 * @param { AsyncCallback<ArrayBuffer> } callback - Callback used to return the buffer. 8523 * @syscap SystemCapability.Multimedia.Audio.Capturer 8524 * @since 8 8525 * @deprecated since 11 8526 * @useinstead ohos.multimedia.audio.AudioCapturer#event:readData 8527 */ 8528 read(size: number, isBlockingRead: boolean, callback: AsyncCallback<ArrayBuffer>): void; 8529 /** 8530 * Reads the buffer from the audio capturer. This method uses a promise to return the result. 8531 * @param { number } size - Number of bytes to read. 8532 * @param { boolean } isBlockingRead - Whether the read operation should be blocked. 8533 * @returns { Promise<ArrayBuffer> } Returns the buffer data read if the operation is successful. 8534 * Returns an error code otherwise. 8535 * @syscap SystemCapability.Multimedia.Audio.Capturer 8536 * @since 8 8537 * @deprecated since 11 8538 * @useinstead ohos.multimedia.audio.AudioCapturer#event:readData 8539 */ 8540 read(size: number, isBlockingRead: boolean): Promise<ArrayBuffer>; 8541 8542 /** 8543 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an 8544 * asynchronous callback to return the result. 8545 * @param { AsyncCallback<number> } callback - Callback used to return the timestamp. 8546 * @syscap SystemCapability.Multimedia.Audio.Capturer 8547 * @since 8 8548 */ 8549 /** 8550 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an 8551 * asynchronous callback to return the result. 8552 * @param { AsyncCallback<number> } callback - Callback used to return the timestamp. 8553 * @syscap SystemCapability.Multimedia.Audio.Capturer 8554 * @crossplatform 8555 * @since 12 8556 */ 8557 getAudioTime(callback: AsyncCallback<number>): void; 8558 /** 8559 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a 8560 * promise to return the result. 8561 * @returns { Promise<number> } Promise used to return the timestamp. 8562 * @syscap SystemCapability.Multimedia.Audio.Capturer 8563 * @since 8 8564 */ 8565 /** 8566 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a 8567 * promise to return the result. 8568 * @returns { Promise<number> } Promise used to return the timestamp. 8569 * @syscap SystemCapability.Multimedia.Audio.Capturer 8570 * @crossplatform 8571 * @since 12 8572 */ 8573 getAudioTime(): Promise<number>; 8574 /** 8575 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. 8576 * @returns { number } The audio timestamp. 8577 * @syscap SystemCapability.Multimedia.Audio.Capturer 8578 * @since 10 8579 */ 8580 /** 8581 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. 8582 * @returns { number } The audio timestamp. 8583 * @syscap SystemCapability.Multimedia.Audio.Capturer 8584 * @crossplatform 8585 * @since 12 8586 */ 8587 getAudioTimeSync(): number; 8588 8589 /** 8590 * Stops capturing. This method uses an asynchronous callback to return the result. 8591 * @param { AsyncCallback<void> } callback - Callback used to return the result. 8592 * @syscap SystemCapability.Multimedia.Audio.Capturer 8593 * @since 8 8594 */ 8595 /** 8596 * Stops capturing. This method uses an asynchronous callback to return the result. 8597 * @param { AsyncCallback<void> } callback - Callback used to return the result. 8598 * @syscap SystemCapability.Multimedia.Audio.Capturer 8599 * @crossplatform 8600 * @since 12 8601 */ 8602 stop(callback: AsyncCallback<void>): void; 8603 /** 8604 * Stops capturing. This method uses a promise to return the result. 8605 * @returns { Promise<void> } Promise used to return the result. 8606 * @syscap SystemCapability.Multimedia.Audio.Capturer 8607 * @since 8 8608 */ 8609 /** 8610 * Stops capturing. This method uses a promise to return the result. 8611 * @returns { Promise<void> } Promise used to return the result. 8612 * @syscap SystemCapability.Multimedia.Audio.Capturer 8613 * @crossplatform 8614 * @since 12 8615 */ 8616 stop(): Promise<void>; 8617 8618 /** 8619 * Releases the capturer. This method uses an asynchronous callback to return the result. 8620 * @param { AsyncCallback<void> } callback - Callback used to return the result. 8621 * @syscap SystemCapability.Multimedia.Audio.Capturer 8622 * @since 8 8623 */ 8624 /** 8625 * Releases the capturer. This method uses an asynchronous callback to return the result. 8626 * @param { AsyncCallback<void> } callback - Callback used to return the result. 8627 * @syscap SystemCapability.Multimedia.Audio.Capturer 8628 * @crossplatform 8629 * @since 12 8630 */ 8631 release(callback: AsyncCallback<void>): void; 8632 /** 8633 * Releases the capturer. This method uses a promise to return the result. 8634 * @returns { Promise<void> } - Promise used to return the result. 8635 * @syscap SystemCapability.Multimedia.Audio.Capturer 8636 * @since 8 8637 */ 8638 /** 8639 * Releases the capturer. This method uses a promise to return the result. 8640 * @returns { Promise<void> } - Promise used to return the result. 8641 * @syscap SystemCapability.Multimedia.Audio.Capturer 8642 * @crossplatform 8643 * @since 12 8644 */ 8645 release(): Promise<void>; 8646 8647 /** 8648 * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses an asynchronous callback to 8649 * return the result. 8650 * @param { AsyncCallback<number> } callback - Callback used to return the buffer size. 8651 * @syscap SystemCapability.Multimedia.Audio.Capturer 8652 * @since 8 8653 */ 8654 /** 8655 * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses an asynchronous callback to 8656 * return the result. 8657 * @param { AsyncCallback<number> } callback - Callback used to return the buffer size. 8658 * @syscap SystemCapability.Multimedia.Audio.Capturer 8659 * @crossplatform 8660 * @since 12 8661 */ 8662 getBufferSize(callback: AsyncCallback<number>): void; 8663 /** 8664 * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses a promise to return the result. 8665 * @returns { Promise<number> } Promise used to return the buffer size. 8666 * @syscap SystemCapability.Multimedia.Audio.Capturer 8667 * @since 8 8668 */ 8669 /** 8670 * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses a promise to return the result. 8671 * @returns { Promise<number> } Promise used to return the buffer size. 8672 * @syscap SystemCapability.Multimedia.Audio.Capturer 8673 * @crossplatform 8674 * @since 12 8675 */ 8676 getBufferSize(): Promise<number>; 8677 /** 8678 * Obtains a reasonable minimum buffer size in bytes for capturing. 8679 * @returns { number } Promise used to return the buffer size. 8680 * @syscap SystemCapability.Multimedia.Audio.Capturer 8681 * @since 10 8682 */ 8683 /** 8684 * Obtains a reasonable minimum buffer size in bytes for capturing. 8685 * @returns { number } Promise used to return the buffer size. 8686 * @syscap SystemCapability.Multimedia.Audio.Capturer 8687 * @crossplatform 8688 * @since 12 8689 */ 8690 getBufferSizeSync(): number; 8691 8692 /** 8693 * Gets the input device or devices for this stream. 8694 * @returns { AudioDeviceDescriptors } Descriptors of input devices. 8695 * @syscap SystemCapability.Multimedia.Audio.Device 8696 * @since 11 8697 */ 8698 /** 8699 * Gets the input device or devices for this stream. 8700 * @returns { AudioDeviceDescriptors } Descriptors of input devices. 8701 * @syscap SystemCapability.Multimedia.Audio.Device 8702 * @crossplatform 8703 * @since 12 8704 */ 8705 getCurrentInputDevices(): AudioDeviceDescriptors; 8706 8707 /** 8708 * Gets full capturer info for this stream. 8709 * @returns { AudioCapturerChangeInfo } Full capture info. 8710 * @syscap SystemCapability.Multimedia.Audio.Device 8711 * @since 11 8712 */ 8713 /** 8714 * Gets full capturer info for this stream. 8715 * @returns { AudioCapturerChangeInfo } Full capture info. 8716 * @syscap SystemCapability.Multimedia.Audio.Device 8717 * @crossplatform 8718 * @since 12 8719 */ 8720 getCurrentAudioCapturerChangeInfo(): AudioCapturerChangeInfo; 8721 8722 /** 8723 * Gets overflow count. 8724 * @returns { Promise<number> } - Promise used to return the result. 8725 * @syscap SystemCapability.Multimedia.Audio.Capturer 8726 * @since 12 8727 */ 8728 getOverflowCount(): Promise<number> 8729 8730 /** 8731 * Gets overflow count. 8732 * @returns { number } Overflow count number. 8733 * @syscap SystemCapability.Multimedia.Audio.Capturer 8734 * @since 12 8735 */ 8736 getOverflowCountSync(): number; 8737 8738 /** 8739 * Subscribes to mark reached events. When the number of frames captured reaches the value of the frame parameter, 8740 * the callback is invoked. 8741 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 8742 * @param { number } frame - Number of frames to trigger the event. The value must be greater than 0. 8743 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 8744 * @syscap SystemCapability.Multimedia.Audio.Capturer 8745 * @since 8 8746 */ 8747 /** 8748 * Subscribes to mark reached events. When the number of frames captured reaches the value of the frame parameter, 8749 * the callback is invoked. 8750 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 8751 * @param { number } frame - Number of frames to trigger the event. The value must be greater than 0. 8752 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 8753 * @syscap SystemCapability.Multimedia.Audio.Capturer 8754 * @crossplatform 8755 * @since 12 8756 */ 8757 on(type: 'markReach', frame: number, callback: Callback<number>): void; 8758 /** 8759 * Unsubscribes from the mark reached events. 8760 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 8761 * @syscap SystemCapability.Multimedia.Audio.Capturer 8762 * @since 8 8763 */ 8764 /** 8765 * Unsubscribes from the mark reached events. 8766 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 8767 * @syscap SystemCapability.Multimedia.Audio.Capturer 8768 * @crossplatform 8769 * @since 12 8770 */ 8771 /** 8772 * Unsubscribes from the mark reached events. 8773 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 8774 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 8775 * @syscap SystemCapability.Multimedia.Audio.Capturer 8776 * @crossplatform 8777 * @since 18 8778 */ 8779 off(type: 'markReach', callback?: Callback<number>): void; 8780 8781 /** 8782 * Subscribes to period reached events. When the period of frame capturing reaches the value of frame parameter, 8783 * the callback is invoked. 8784 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 8785 * @param { number } frame - Period during which frame capturing is listened. The value must be greater than 0. 8786 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 8787 * @syscap SystemCapability.Multimedia.Audio.Capturer 8788 * @since 8 8789 */ 8790 /** 8791 * Subscribes to period reached events. When the period of frame capturing reaches the value of frame parameter, 8792 * the callback is invoked. 8793 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 8794 * @param { number } frame - Period during which frame capturing is listened. The value must be greater than 0. 8795 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 8796 * @syscap SystemCapability.Multimedia.Audio.Capturer 8797 * @crossplatform 8798 * @since 12 8799 */ 8800 on(type: 'periodReach', frame: number, callback: Callback<number>): void; 8801 /** 8802 * Unsubscribes from period reached events. 8803 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 8804 * @syscap SystemCapability.Multimedia.Audio.Capturer 8805 * @since 8 8806 */ 8807 /** 8808 * Unsubscribes from period reached events. 8809 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 8810 * @syscap SystemCapability.Multimedia.Audio.Capturer 8811 * @crossplatform 8812 * @since 12 8813 */ 8814 /** 8815 * Unsubscribes from period reached events. 8816 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 8817 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 8818 * @syscap SystemCapability.Multimedia.Audio.Capturer 8819 * @crossplatform 8820 * @since 18 8821 */ 8822 off(type: 'periodReach', callback?: Callback<number>): void; 8823 8824 /** 8825 * Subscribes audio state change event callback. 8826 * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. 8827 * @param { Callback<AudioState> } callback - Callback used to listen for the audio state change event. 8828 * @syscap SystemCapability.Multimedia.Audio.Capturer 8829 * @since 8 8830 */ 8831 /** 8832 * Subscribes audio state change event callback. 8833 * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. 8834 * @param { Callback<AudioState> } callback - Callback used to listen for the audio state change event. 8835 * @syscap SystemCapability.Multimedia.Audio.Capturer 8836 * @crossplatform 8837 * @since 12 8838 */ 8839 on(type: 'stateChange', callback: Callback<AudioState>): void; 8840 8841 /** 8842 * Unsubscribes audio state change event callback. 8843 * @param { 'stateChange' } type - Type of the event to listen for. 8844 * @param { Callback<AudioState> } callback - Callback used to listen for the audio state change event. 8845 * @throws { BusinessError } 6800101 - Parameter verification failed. 8846 * @syscap SystemCapability.Multimedia.Audio.Capturer 8847 * @since 18 8848 */ 8849 off(type: 'stateChange', callback?: Callback<AudioState>): void; 8850 8851 /** 8852 * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is 8853 * triggered when audio recording is interrupted. 8854 * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. 8855 * @param { Callback<InterruptEvent> } callback - Callback used to listen for interrupt callback. 8856 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8857 * 1.Mandatory parameters are left unspecified; 8858 * 2.Incorrect parameter types. 8859 * @throws { BusinessError } 6800101 - Parameter verification failed. 8860 * @syscap SystemCapability.Multimedia.Audio.Interrupt 8861 * @since 10 8862 */ 8863 /** 8864 * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is 8865 * triggered when audio recording is interrupted. 8866 * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. 8867 * @param { Callback<InterruptEvent> } callback - Callback used to listen for interrupt callback. 8868 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8869 * 1.Mandatory parameters are left unspecified; 8870 * 2.Incorrect parameter types. 8871 * @throws { BusinessError } 6800101 - Parameter verification failed. 8872 * @syscap SystemCapability.Multimedia.Audio.Interrupt 8873 * @crossplatform 8874 * @since 12 8875 */ 8876 on(type: 'audioInterrupt', callback: Callback<InterruptEvent>): void; 8877 8878 /** 8879 * UnSubscribes to audio interrupt events. 8880 * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. 8881 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8882 * 1.Mandatory parameters are left unspecified; 8883 * 2.Incorrect parameter types. 8884 * @throws { BusinessError } 6800101 - Parameter verification failed. 8885 * @syscap SystemCapability.Multimedia.Audio.Interrupt 8886 * @since 10 8887 */ 8888 /** 8889 * UnSubscribes to audio interrupt events. 8890 * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. 8891 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8892 * 1.Mandatory parameters are left unspecified; 8893 * 2.Incorrect parameter types. 8894 * @throws { BusinessError } 6800101 - Parameter verification failed. 8895 * @syscap SystemCapability.Multimedia.Audio.Interrupt 8896 * @crossplatform 8897 * @since 12 8898 */ 8899 off(type: 'audioInterrupt'): void; 8900 8901 /** 8902 * Subscribes input device change event callback. 8903 * The event is triggered when input device change for this stream. 8904 * @param { 'inputDeviceChange' } type - Type of the event to listen for. 8905 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to listen device change event. 8906 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8907 * 1.Mandatory parameters are left unspecified; 8908 * 2.Incorrect parameter types. 8909 * @throws { BusinessError } 6800101 - Parameter verification failed. 8910 * @syscap SystemCapability.Multimedia.Audio.Device 8911 * @since 11 8912 */ 8913 /** 8914 * Subscribes input device change event callback. 8915 * The event is triggered when input device change for this stream. 8916 * @param { 'inputDeviceChange' } type - Type of the event to listen for. 8917 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to listen device change event. 8918 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8919 * 1.Mandatory parameters are left unspecified; 8920 * 2.Incorrect parameter types. 8921 * @throws { BusinessError } 6800101 - Parameter verification failed. 8922 * @syscap SystemCapability.Multimedia.Audio.Device 8923 * @crossplatform 8924 * @since 12 8925 */ 8926 on(type: 'inputDeviceChange', callback: Callback<AudioDeviceDescriptors>): void; 8927 /** 8928 * Unsubscribes input device change event callback. 8929 * @param { 'inputDeviceChange' } type - Type of the event to listen for. 8930 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used in subscribe. 8931 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8932 * 1.Mandatory parameters are left unspecified; 8933 * 2.Incorrect parameter types. 8934 * @throws { BusinessError } 6800101 - Parameter verification failed. 8935 * @syscap SystemCapability.Multimedia.Audio.Device 8936 * @since 11 8937 */ 8938 /** 8939 * Unsubscribes input device change event callback. 8940 * @param { 'inputDeviceChange' } type - Type of the event to listen for. 8941 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used in subscribe. 8942 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8943 * 1.Mandatory parameters are left unspecified; 8944 * 2.Incorrect parameter types. 8945 * @throws { BusinessError } 6800101 - Parameter verification failed. 8946 * @syscap SystemCapability.Multimedia.Audio.Device 8947 * @crossplatform 8948 * @since 12 8949 */ 8950 off(type: 'inputDeviceChange', callback?: Callback<AudioDeviceDescriptors>): void; 8951 8952 /** 8953 * Subscribes audio capturer info change event callback. 8954 * The event is triggered when input device change for this stream. 8955 * @param { 'audioCapturerChange' } type - Type of the event to listen for. 8956 * @param { Callback<AudioCapturerChangeInfo> } callback - Callback used to listen device change event. 8957 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8958 * 1.Mandatory parameters are left unspecified; 8959 * 2.Incorrect parameter types. 8960 * @throws { BusinessError } 6800101 - Parameter verification failed. 8961 * @syscap SystemCapability.Multimedia.Audio.Capturer 8962 * @since 11 8963 */ 8964 /** 8965 * Subscribes audio capturer info change event callback. 8966 * The event is triggered when input device change for this stream. 8967 * @param { 'audioCapturerChange' } type - Type of the event to listen for. 8968 * @param { Callback<AudioCapturerChangeInfo> } callback - Callback used to listen device change event. 8969 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8970 * 1.Mandatory parameters are left unspecified; 8971 * 2.Incorrect parameter types. 8972 * @throws { BusinessError } 6800101 - Parameter verification failed. 8973 * @syscap SystemCapability.Multimedia.Audio.Capturer 8974 * @crossplatform 8975 * @since 12 8976 */ 8977 on(type: 'audioCapturerChange', callback: Callback<AudioCapturerChangeInfo>): void; 8978 /** 8979 * Unsubscribes audio capturer info change event callback. 8980 * @param { 'audioCapturerChange' } type - Type of the event to listen for. 8981 * @param { Callback<AudioCapturerChangeInfo> } callback - Callback used in subscribe. 8982 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8983 * 1.Mandatory parameters are left unspecified; 8984 * 2.Incorrect parameter types. 8985 * @throws { BusinessError } 6800101 - Parameter verification failed. 8986 * @syscap SystemCapability.Multimedia.Audio.Capturer 8987 * @since 11 8988 */ 8989 /** 8990 * Unsubscribes audio capturer info change event callback. 8991 * @param { 'audioCapturerChange' } type - Type of the event to listen for. 8992 * @param { Callback<AudioCapturerChangeInfo> } callback - Callback used in subscribe. 8993 * @throws { BusinessError } 401 - Parameter error. Possible causes: 8994 * 1.Mandatory parameters are left unspecified; 8995 * 2.Incorrect parameter types. 8996 * @throws { BusinessError } 6800101 - Parameter verification failed. 8997 * @syscap SystemCapability.Multimedia.Audio.Capturer 8998 * @crossplatform 8999 * @since 12 9000 */ 9001 off(type: 'audioCapturerChange', callback?: Callback<AudioCapturerChangeInfo>): void; 9002 9003 /** 9004 * Subscribes audio data callback. 9005 * The event is triggered when audio buffer is available for reading more data. 9006 * @param { 'readData' } type - Type of the event to listen for. 9007 * @param { Callback<ArrayBuffer> } callback - Callback with the buffer to read. 9008 * @throws { BusinessError } 401 - Parameter error. Possible causes: 9009 * 1.Mandatory parameters are left unspecified; 9010 * 2.Incorrect parameter types. 9011 * @throws { BusinessError } 6800101 - Parameter verification failed. 9012 * @syscap SystemCapability.Multimedia.Audio.Capturer 9013 * @since 11 9014 */ 9015 /** 9016 * Subscribes audio data callback. 9017 * The event is triggered when audio buffer is available for reading more data. 9018 * @param { 'readData' } type - Type of the event to listen for. 9019 * @param { Callback<ArrayBuffer> } callback - Callback with the buffer to read. 9020 * @throws { BusinessError } 401 - Parameter error. Possible causes: 9021 * 1.Mandatory parameters are left unspecified; 9022 * 2.Incorrect parameter types. 9023 * @throws { BusinessError } 6800101 - Parameter verification failed. 9024 * @syscap SystemCapability.Multimedia.Audio.Capturer 9025 * @crossplatform 9026 * @since 12 9027 */ 9028 on(type: 'readData', callback: Callback<ArrayBuffer>): void; 9029 9030 /** 9031 * Unsubscribes audio data callback. 9032 * @param { 'readData' } type - Type of the event to listen for. 9033 * @param { Callback<ArrayBuffer> } callback - Callback used in subscribe. 9034 * @throws { BusinessError } 401 - Parameter error. Possible causes: 9035 * 1.Mandatory parameters are left unspecified; 9036 * 2.Incorrect parameter types. 9037 * @throws { BusinessError } 6800101 - Parameter verification failed. 9038 * @syscap SystemCapability.Multimedia.Audio.Capturer 9039 * @since 11 9040 */ 9041 /** 9042 * Unsubscribes audio data callback. 9043 * @param { 'readData' } type - Type of the event to listen for. 9044 * @param { Callback<ArrayBuffer> } callback - Callback used in subscribe. 9045 * @throws { BusinessError } 401 - Parameter error. Possible causes: 9046 * 1.Mandatory parameters are left unspecified; 9047 * 2.Incorrect parameter types. 9048 * @throws { BusinessError } 6800101 - Parameter verification failed. 9049 * @syscap SystemCapability.Multimedia.Audio.Capturer 9050 * @crossplatform 9051 * @since 12 9052 */ 9053 off(type: 'readData', callback?: Callback<ArrayBuffer>): void; 9054 } 9055 9056 /** 9057 * ASR noise suppression mode. 9058 * @enum { number } 9059 * @syscap SystemCapability.Multimedia.Audio.Capturer 9060 * @systemapi 9061 * @since 12 9062 */ 9063 enum AsrNoiseSuppressionMode { 9064 /** 9065 * Bypass noise suppression. 9066 * @syscap SystemCapability.Multimedia.Audio.Capturer 9067 * @systemapi 9068 * @since 12 9069 */ 9070 BYPASS = 0, 9071 /** 9072 * Standard noise suppression. 9073 * @syscap SystemCapability.Multimedia.Audio.Capturer 9074 * @systemapi 9075 * @since 12 9076 */ 9077 STANDARD = 1, 9078 /** 9079 * Near field noise suppression. 9080 * @syscap SystemCapability.Multimedia.Audio.Capturer 9081 * @systemapi 9082 * @since 12 9083 */ 9084 NEAR_FIELD = 2, 9085 /** 9086 * Far field noise suppression. 9087 * @syscap SystemCapability.Multimedia.Audio.Capturer 9088 * @systemapi 9089 * @since 12 9090 */ 9091 FAR_FIELD = 3, 9092 } 9093 9094 /** 9095 * ASR AEC mode. 9096 * @enum { number } 9097 * @syscap SystemCapability.Multimedia.Audio.Capturer 9098 * @systemapi 9099 * @since 12 9100 */ 9101 enum AsrAecMode { 9102 /** 9103 * Bypass AEC. 9104 * @syscap SystemCapability.Multimedia.Audio.Capturer 9105 * @systemapi 9106 * @since 12 9107 */ 9108 BYPASS = 0, 9109 /** 9110 * Using standard AEC. 9111 * @syscap SystemCapability.Multimedia.Audio.Capturer 9112 * @systemapi 9113 * @since 12 9114 */ 9115 STANDARD = 1, 9116 } 9117 9118 /** 9119 * ASR voice control mode. 9120 * @enum { number } 9121 * @syscap SystemCapability.Multimedia.Audio.Capturer 9122 * @systemapi 9123 * @since 12 9124 */ 9125 enum AsrVoiceControlMode { 9126 /** 9127 * Send output stream to TX. 9128 * @syscap SystemCapability.Multimedia.Audio.Capturer 9129 * @systemapi 9130 * @since 12 9131 */ 9132 AUDIO_2_VOICE_TX = 0, 9133 /** 9134 * Send both output stream and MIC input to TX. 9135 * @syscap SystemCapability.Multimedia.Audio.Capturer 9136 * @systemapi 9137 * @since 12 9138 */ 9139 AUDIO_MIX_2_VOICE_TX = 1, 9140 /** 9141 * Based on the AUDIO_2_VOICE_TX, Send output stream to voice call record. 9142 * @syscap SystemCapability.Multimedia.Audio.Capturer 9143 * @systemapi 9144 * @since 12 9145 */ 9146 AUDIO_2_VOICE_TX_EX = 2, 9147 /** 9148 * Based on the AUDIO_MIX_2_VOICE_TX, Send output stream to voice call record. 9149 * @syscap SystemCapability.Multimedia.Audio.Capturer 9150 * @systemapi 9151 * @since 12 9152 */ 9153 AUDIO_MIX_2_VOICE_TX_EX = 3, 9154 } 9155 9156 /** 9157 * ASR voice mute mode. 9158 * @enum { number } 9159 * @syscap SystemCapability.Multimedia.Audio.Capturer 9160 * @systemapi 9161 * @since 12 9162 */ 9163 enum AsrVoiceMuteMode { 9164 /** 9165 * Mute the local output stream. 9166 * @syscap SystemCapability.Multimedia.Audio.Capturer 9167 * @systemapi 9168 * @since 12 9169 */ 9170 OUTPUT_MUTE = 0, 9171 /** 9172 * Mute the local MIC input stream. 9173 * @syscap SystemCapability.Multimedia.Audio.Capturer 9174 * @systemapi 9175 * @since 12 9176 */ 9177 INPUT_MUTE = 1, 9178 /** 9179 * Send tts output stream to TX and mute the local output stream. 9180 * @syscap SystemCapability.Multimedia.Audio.Capturer 9181 * @systemapi 9182 * @since 12 9183 */ 9184 TTS_MUTE = 2, 9185 /** 9186 * Mute the voice call stream. 9187 * @syscap SystemCapability.Multimedia.Audio.Capturer 9188 * @systemapi 9189 * @since 12 9190 */ 9191 CALL_MUTE = 3, 9192 /** 9193 * Based on the OUTPUT_MUTE, send output stream to voice call record. 9194 * @syscap SystemCapability.Multimedia.Audio.Capturer 9195 * @systemapi 9196 * @since 12 9197 */ 9198 OUTPUT_MUTE_EX = 4, 9199 } 9200 9201 /** 9202 * ASR whisper detection mode. 9203 * @enum { number } 9204 * @syscap SystemCapability.Multimedia.Audio.Capturer 9205 * @systemapi 9206 * @since 12 9207 */ 9208 enum AsrWhisperDetectionMode { 9209 /** 9210 * No operation. 9211 * @syscap SystemCapability.Multimedia.Audio.Capturer 9212 * @systemapi 9213 * @since 12 9214 */ 9215 BYPASS = 0, 9216 /** 9217 * Use standard whisper detection model. 9218 * @syscap SystemCapability.Multimedia.Audio.Capturer 9219 * @systemapi 9220 * @since 12 9221 */ 9222 STANDARD = 1, 9223 } 9224 9225 /** 9226 * ASR processing controller. 9227 * @typedef AsrProcessingController 9228 * @syscap SystemCapability.Multimedia.Audio.Capturer 9229 * @systemapi 9230 * @since 12 9231 */ 9232 interface AsrProcessingController { 9233 /** 9234 * Set ASR AEC mode. 9235 * @param { AsrAecMode } mode - ASR AEC Mode. 9236 * @returns { boolean } Indicates whether the mode has been successfully set. 9237 * @throws { BusinessError } 202 - Caller is not a system application. 9238 * @throws { BusinessError } 401 - Parameter error. Possible causes: 9239 * 1.Mandatory parameters are left unspecified; 9240 * 2.Incorrect parameter types. 9241 * @throws { BusinessError } 6800101 - Parameter verification failed. 9242 * @throws { BusinessError } 6800104 - Operation not allowed. 9243 * @syscap SystemCapability.Multimedia.Audio.Capturer 9244 * @systemapi 9245 * @since 12 9246 */ 9247 setAsrAecMode(mode: AsrAecMode): boolean; 9248 9249 /** 9250 * Get ASR AEC mode. 9251 * @returns { AsrAecMode } ASR AEC Mode. 9252 * @throws { BusinessError } 202 - Caller is not a system application. 9253 * @throws { BusinessError } 6800104 - Operation not allowed. 9254 * @syscap SystemCapability.Multimedia.Audio.Capturer 9255 * @systemapi 9256 * @since 12 9257 */ 9258 getAsrAecMode(): AsrAecMode; 9259 9260 /** 9261 * Set ASR noise suppression mode. 9262 * @param { AsrNoiseSuppressionMode } mode - ASR noise suppression mode. 9263 * @returns { boolean } Indicates whether the mode has been successfully set. 9264 * @throws { BusinessError } 202 - Caller is not a system application. 9265 * @throws { BusinessError } 401 - Parameter error. Possible causes: 9266 * 1.Mandatory parameters are left unspecified; 9267 * 2.Incorrect parameter types. 9268 * @throws { BusinessError } 6800101 - Parameter verification failed. 9269 * @throws { BusinessError } 6800104 - Operation not allowed. 9270 * @syscap SystemCapability.Multimedia.Audio.Capturer 9271 * @systemapi 9272 * @since 12 9273 */ 9274 setAsrNoiseSuppressionMode(mode: AsrNoiseSuppressionMode): boolean; 9275 9276 /** 9277 * Get ASR noise suppression mode. 9278 * @returns { AsrNoiseSuppressionMode } ASR noise suppression mode. 9279 * @throws { BusinessError } 202 - Caller is not a system application. 9280 * @throws { BusinessError } 6800104 - Operation not allowed. 9281 * @syscap SystemCapability.Multimedia.Audio.Capturer 9282 * @systemapi 9283 * @since 12 9284 */ 9285 getAsrNoiseSuppressionMode(): AsrNoiseSuppressionMode; 9286 9287 /** 9288 * Query whether user is whispering. 9289 * @returns { boolean } whether user is whispering. 9290 * @throws { BusinessError } 202 - Caller is not a system application. 9291 * @throws { BusinessError } 6800104 - Operation not allowed. 9292 * @syscap SystemCapability.Multimedia.Audio.Capturer 9293 * @systemapi 9294 * @since 12 9295 */ 9296 isWhispering(): boolean; 9297 9298 /** 9299 * Set ASR voice control mode. 9300 * @param { AsrVoiceControlMode } mode - ASR voice control mode. 9301 * @param { boolean } enable - Indicates whether to switch on/off this mode. 9302 * @returns { boolean } Indicates whether the mode has been successfully set. 9303 * @throws { BusinessError } 202 - Caller is not a system application. 9304 * @throws { BusinessError } 401 - Parameter error. Possible causes: 9305 * 1.Mandatory parameters unspecified. 9306 * 2.Incorrect parameter types. 9307 * @throws { BusinessError } 6800101 - Parameter verification failed. 9308 * @throws { BusinessError } 6800104 - Operation not allowed. 9309 * @syscap SystemCapability.Multimedia.Audio.Capturer 9310 * @systemapi 9311 * @since 12 9312 */ 9313 setAsrVoiceControlMode(mode: AsrVoiceControlMode, enable: boolean): boolean; 9314 9315 /** 9316 * Set ASR voice mute mode. 9317 * @param { AsrVoiceMuteMode } mode - ASR voice mute mode. 9318 * @param { boolean } enable - Indicates whether to switch on/off this mode. 9319 * @returns { boolean } Indicates whether the mode has been successfully set. 9320 * @throws { BusinessError } 202 - Caller is not a system application. 9321 * @throws { BusinessError } 401 - Parameter error. Possible causes: 9322 * 1.Mandatory parameters unspecified. 9323 * 2.Incorrect parameter types. 9324 * @throws { BusinessError } 6800101 - Parameter verification failed. 9325 * @throws { BusinessError } 6800104 - Operation not allowed. 9326 * @syscap SystemCapability.Multimedia.Audio.Capturer 9327 * @systemapi 9328 * @since 12 9329 */ 9330 setAsrVoiceMuteMode(mode: AsrVoiceMuteMode, enable: boolean): boolean; 9331 9332 /** 9333 * Set ASR whisper detection mode. 9334 * @param { AsrWhisperDetectionMode } mode - ASR whisper detection mode. 9335 * @returns { boolean } Indicates whether the mode has been successfully set. 9336 * @throws { BusinessError } 202 - Caller is not a system application. 9337 * @throws { BusinessError } 401 - Parameter error. Possible causes: 9338 * 1.Mandatory parameters unspecified. 9339 * 2.Incorrect parameter types. 9340 * @throws { BusinessError } 6800101 - Parameter verification failed. 9341 * @throws { BusinessError } 6800104 - Operation not allowed. 9342 * @syscap SystemCapability.Multimedia.Audio.Capturer 9343 * @systemapi 9344 * @since 12 9345 */ 9346 setAsrWhisperDetectionMode(mode: AsrWhisperDetectionMode): boolean; 9347 9348 /** 9349 * Get ASR whisper detection mode. 9350 * @returns { AsrWhisperDetectionMode } ASR whisper detection mode. 9351 * @throws { BusinessError } 202 - Caller is not a system application. 9352 * @throws { BusinessError } 6800104 - Operation not allowed. 9353 * @syscap SystemCapability.Multimedia.Audio.Capturer 9354 * @systemapi 9355 * @since 12 9356 */ 9357 getAsrWhisperDetectionMode(): AsrWhisperDetectionMode; 9358 } 9359 9360 /** 9361 * Create ASR processing controller on one audio capturer. 9362 * @param { AudioCapturer } audioCapturer - The audio capturer whose ASR processing will be controlled. The source 9363 * type of this capturer must be {@link SourceType#SOURCE_TYPE_VOICE_RECOGNITION}. 9364 * @returns { AsrProcessingController } ASR Processing Controller. 9365 * @throws { BusinessError } 202 - Caller is not a system application. 9366 * @throws { BusinessError } 401 - Parameter error. Possible causes: 9367 * 1.Mandatory parameters are left unspecified; 9368 * 2.Incorrect parameter types. 9369 * @throws { BusinessError } 6800101 - Parameter verification failed. 9370 * @throws { BusinessError } 6800104 - Operation not allowed. e.g. the source type of the input audio capturer is not 9371 * {@link SourceType#SOURCE_TYPE_VOICE_RECOGNITION} or {@link SourceType#SOURCE_TYPE_WAKEUP}, or this audio capturer 9372 * is already released. 9373 * @syscap SystemCapability.Multimedia.Audio.Capturer 9374 * @systemapi 9375 * @since 12 9376 */ 9377 function createAsrProcessingController(audioCapturer: AudioCapturer): AsrProcessingController; 9378 9379 /** 9380 * Enumerates tone types for player. 9381 * @enum { number } 9382 * @syscap SystemCapability.Multimedia.Audio.Tone 9383 * @systemapi 9384 * @since 9 9385 */ 9386 enum ToneType { 9387 /** 9388 * Dial tone for key 0. 9389 * @syscap SystemCapability.Multimedia.Audio.Tone 9390 * @systemapi 9391 * @since 9 9392 */ 9393 TONE_TYPE_DIAL_0 = 0, 9394 /** 9395 * Dial tone for key 1. 9396 * @syscap SystemCapability.Multimedia.Audio.Tone 9397 * @systemapi 9398 * @since 9 9399 */ 9400 TONE_TYPE_DIAL_1 = 1, 9401 /** 9402 * Dial tone for key 2. 9403 * @syscap SystemCapability.Multimedia.Audio.Tone 9404 * @systemapi 9405 * @since 9 9406 */ 9407 TONE_TYPE_DIAL_2 = 2, 9408 /** 9409 * Dial tone for key 3. 9410 * @syscap SystemCapability.Multimedia.Audio.Tone 9411 * @systemapi 9412 * @since 9 9413 */ 9414 TONE_TYPE_DIAL_3 = 3, 9415 /** 9416 * Dial tone for key 4. 9417 * @syscap SystemCapability.Multimedia.Audio.Tone 9418 * @systemapi 9419 * @since 9 9420 */ 9421 TONE_TYPE_DIAL_4 = 4, 9422 /** 9423 * Dial tone for key 5. 9424 * @syscap SystemCapability.Multimedia.Audio.Tone 9425 * @systemapi 9426 * @since 9 9427 */ 9428 TONE_TYPE_DIAL_5 = 5, 9429 /** 9430 * Dial tone for key 6. 9431 * @syscap SystemCapability.Multimedia.Audio.Tone 9432 * @systemapi 9433 * @since 9 9434 */ 9435 TONE_TYPE_DIAL_6 = 6, 9436 /** 9437 * Dial tone for key 7. 9438 * @syscap SystemCapability.Multimedia.Audio.Tone 9439 * @systemapi 9440 * @since 9 9441 */ 9442 TONE_TYPE_DIAL_7 = 7, 9443 /** 9444 * Dial tone for key 8. 9445 * @syscap SystemCapability.Multimedia.Audio.Tone 9446 * @systemapi 9447 * @since 9 9448 */ 9449 TONE_TYPE_DIAL_8 = 8, 9450 /** 9451 * Dial tone for key 9. 9452 * @syscap SystemCapability.Multimedia.Audio.Tone 9453 * @systemapi 9454 * @since 9 9455 */ 9456 TONE_TYPE_DIAL_9 = 9, 9457 /** 9458 * Dial tone for key *. 9459 * @syscap SystemCapability.Multimedia.Audio.Tone 9460 * @systemapi 9461 * @since 9 9462 */ 9463 TONE_TYPE_DIAL_S = 10, 9464 /** 9465 * Dial tone for key #. 9466 * @syscap SystemCapability.Multimedia.Audio.Tone 9467 * @systemapi 9468 * @since 9 9469 */ 9470 TONE_TYPE_DIAL_P = 11, 9471 /** 9472 * Dial tone for key A. 9473 * @syscap SystemCapability.Multimedia.Audio.Tone 9474 * @systemapi 9475 * @since 9 9476 */ 9477 TONE_TYPE_DIAL_A = 12, 9478 /** 9479 * Dial tone for key B. 9480 * @syscap SystemCapability.Multimedia.Audio.Tone 9481 * @systemapi 9482 * @since 9 9483 */ 9484 TONE_TYPE_DIAL_B = 13, 9485 /** 9486 * Dial tone for key C. 9487 * @syscap SystemCapability.Multimedia.Audio.Tone 9488 * @systemapi 9489 * @since 9 9490 */ 9491 TONE_TYPE_DIAL_C = 14, 9492 /** 9493 * Dial tone for key D. 9494 * @syscap SystemCapability.Multimedia.Audio.Tone 9495 * @systemapi 9496 * @since 9 9497 */ 9498 TONE_TYPE_DIAL_D = 15, 9499 /** 9500 * Supervisory tone for dial. 9501 * @syscap SystemCapability.Multimedia.Audio.Tone 9502 * @systemapi 9503 * @since 9 9504 */ 9505 TONE_TYPE_COMMON_SUPERVISORY_DIAL = 100, 9506 /** 9507 * Supervisory tone for busy. 9508 * @syscap SystemCapability.Multimedia.Audio.Tone 9509 * @systemapi 9510 * @since 9 9511 */ 9512 TONE_TYPE_COMMON_SUPERVISORY_BUSY = 101, 9513 /** 9514 * Supervisory tone for dial. 9515 * @syscap SystemCapability.Multimedia.Audio.Tone 9516 * @systemapi 9517 * @since 9 9518 */ 9519 TONE_TYPE_COMMON_SUPERVISORY_CONGESTION = 102, 9520 /** 9521 * Supervisory tone for radio path acknowledgment. 9522 * @syscap SystemCapability.Multimedia.Audio.Tone 9523 * @systemapi 9524 * @since 9 9525 */ 9526 TONE_TYPE_COMMON_SUPERVISORY_RADIO_ACK = 103, 9527 /** 9528 * Supervisory tone for radio path not available. 9529 * @syscap SystemCapability.Multimedia.Audio.Tone 9530 * @systemapi 9531 * @since 9 9532 */ 9533 TONE_TYPE_COMMON_SUPERVISORY_RADIO_NOT_AVAILABLE = 104, 9534 /** 9535 * Supervisory tone for call waiting. 9536 * @syscap SystemCapability.Multimedia.Audio.Tone 9537 * @systemapi 9538 * @since 9 9539 */ 9540 TONE_TYPE_COMMON_SUPERVISORY_CALL_WAITING = 106, 9541 /** 9542 * Supervisory tone for ringtone. 9543 * @syscap SystemCapability.Multimedia.Audio.Tone 9544 * @systemapi 9545 * @since 9 9546 */ 9547 TONE_TYPE_COMMON_SUPERVISORY_RINGTONE = 107, 9548 /** 9549 * Supervisory tone for call holding. 9550 * @syscap SystemCapability.Multimedia.Audio.Tone 9551 * @systemapi 9552 * @since 18 9553 */ 9554 TONE_TYPE_COMMON_SUPERVISORY_CALL_HOLDING = 108, 9555 /** 9556 * Proprietary tone for beep. 9557 * @syscap SystemCapability.Multimedia.Audio.Tone 9558 * @systemapi 9559 * @since 9 9560 */ 9561 TONE_TYPE_COMMON_PROPRIETARY_BEEP = 200, 9562 /** 9563 * Proprietary tone for positive acknowledgment. 9564 * @syscap SystemCapability.Multimedia.Audio.Tone 9565 * @systemapi 9566 * @since 9 9567 */ 9568 TONE_TYPE_COMMON_PROPRIETARY_ACK = 201, 9569 /** 9570 * Proprietary tone for prompt. 9571 * @syscap SystemCapability.Multimedia.Audio.Tone 9572 * @systemapi 9573 * @since 9 9574 */ 9575 TONE_TYPE_COMMON_PROPRIETARY_PROMPT = 203, 9576 /** 9577 * Proprietary tone for double beep. 9578 * @syscap SystemCapability.Multimedia.Audio.Tone 9579 * @systemapi 9580 * @since 9 9581 */ 9582 TONE_TYPE_COMMON_PROPRIETARY_DOUBLE_BEEP = 204, 9583 } 9584 9585 /** 9586 * Provides APIs for tone playing. 9587 * @typedef TonePlayer 9588 * @syscap SystemCapability.Multimedia.Audio.Tone 9589 * @systemapi 9590 * @since 9 9591 */ 9592 interface TonePlayer { 9593 /** 9594 * Loads tone. This method uses an asynchronous callback to return the result. 9595 * @param { ToneType } type - Tone type to play. 9596 * @param { AsyncCallback<void> } callback - Callback used to return the result. 9597 * @syscap SystemCapability.Multimedia.Audio.Tone 9598 * @systemapi 9599 * @since 9 9600 */ 9601 load(type: ToneType, callback: AsyncCallback<void>): void; 9602 /** 9603 * Loads tone. This method uses a promise to return the result. 9604 * @param { ToneType } type - Tone type to play. 9605 * @returns { Promise<void> } Promise used to return the result. 9606 * @syscap SystemCapability.Multimedia.Audio.Tone 9607 * @systemapi 9608 * @since 9 9609 */ 9610 load(type: ToneType): Promise<void>; 9611 9612 /** 9613 * Starts player. This method uses an asynchronous callback to return the result. 9614 * @param { AsyncCallback<void> } callback - Callback used to return the result. 9615 * @syscap SystemCapability.Multimedia.Audio.Tone 9616 * @systemapi 9617 * @since 9 9618 */ 9619 start(callback: AsyncCallback<void>): void; 9620 /** 9621 * Starts player. This method uses a promise to return the result. 9622 * @returns { Promise<void> }Promise used to return the result. 9623 * @syscap SystemCapability.Multimedia.Audio.Tone 9624 * @systemapi 9625 * @since 9 9626 */ 9627 start(): Promise<void>; 9628 9629 /** 9630 * Stops player. This method uses an asynchronous callback to return the result. 9631 * @param { AsyncCallback<void> } callback - Callback used to return the result. 9632 * @syscap SystemCapability.Multimedia.Audio.Tone 9633 * @systemapi 9634 * @since 9 9635 */ 9636 stop(callback: AsyncCallback<void>): void; 9637 /** 9638 * Stops player. This method uses a promise to return the result. 9639 * @returns { Promise<void> } Promise used to return the result. 9640 * @syscap SystemCapability.Multimedia.Audio.Tone 9641 * @systemapi 9642 * @since 9 9643 */ 9644 stop(): Promise<void>; 9645 9646 /** 9647 * Releases the player. This method uses an asynchronous callback to return the result. 9648 * @param { AsyncCallback<void> } callback - Callback used to return the result. 9649 * @syscap SystemCapability.Multimedia.Audio.Tone 9650 * @systemapi 9651 * @since 9 9652 */ 9653 release(callback: AsyncCallback<void>): void; 9654 /** 9655 * Releases the player. This method uses a promise to return the result. 9656 * @returns { Promise<void> } Promise used to return the result. 9657 * @syscap SystemCapability.Multimedia.Audio.Tone 9658 * @systemapi 9659 * @since 9 9660 */ 9661 release(): Promise<void>; 9662 } 9663 9664 /** 9665 * Array of AudioEffectMode, which is read-only. 9666 * @typedef { Array<Readonly<AudioEffectMode>> } AudioEffectInfoArray 9667 * @syscap SystemCapability.Multimedia.Audio.Renderer 9668 * @since 10 9669 */ 9670 type AudioEffectInfoArray = Array<Readonly<AudioEffectMode>>; 9671 9672 /** 9673 * Describes an audio effect mode group. 9674 * @enum { number } 9675 * @syscap SystemCapability.Multimedia.Audio.Renderer 9676 * @since 10 9677 */ 9678 /** 9679 * Describes an audio effect mode group. 9680 * @enum { number } 9681 * @syscap SystemCapability.Multimedia.Audio.Renderer 9682 * @atomicservice 9683 * @since 12 9684 */ 9685 enum AudioEffectMode { 9686 /** 9687 * Audio Effect Mode effect none. 9688 * @syscap SystemCapability.Multimedia.Audio.Renderer 9689 * @since 10 9690 */ 9691 /** 9692 * Audio Effect Mode effect none. 9693 * @syscap SystemCapability.Multimedia.Audio.Renderer 9694 * @atomicservice 9695 * @since 12 9696 */ 9697 EFFECT_NONE = 0, 9698 /** 9699 * Audio Effect Mode effect default. 9700 * @syscap SystemCapability.Multimedia.Audio.Renderer 9701 * @since 10 9702 */ 9703 /** 9704 * Audio Effect Mode effect default. 9705 * @syscap SystemCapability.Multimedia.Audio.Renderer 9706 * @atomicservice 9707 * @since 12 9708 */ 9709 EFFECT_DEFAULT = 1, 9710 } 9711 9712 /** 9713 * Describes spatial device state. 9714 * @typedef AudioSpatialDeviceState 9715 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9716 * @systemapi 9717 * @since 11 9718 */ 9719 interface AudioSpatialDeviceState { 9720 /** 9721 * Spatial device address. 9722 * @type { string } 9723 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9724 * @systemapi 9725 * @since 11 9726 */ 9727 address: string; 9728 9729 /** 9730 * Whether the spatial device supports spatial rendering. 9731 * @type { boolean } 9732 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9733 * @systemapi 9734 * @since 11 9735 */ 9736 isSpatializationSupported: boolean; 9737 9738 /** 9739 * Whether the spatial device supports head tracking. 9740 * @type { boolean } 9741 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9742 * @systemapi 9743 * @since 11 9744 */ 9745 isHeadTrackingSupported: boolean; 9746 9747 /** 9748 * Spatial device type. 9749 * @type { AudioSpatialDeviceType } 9750 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9751 * @systemapi 9752 * @since 11 9753 */ 9754 spatialDeviceType: AudioSpatialDeviceType; 9755 } 9756 9757 /** 9758 * Describes a spatial device type group. 9759 * @enum { number } 9760 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9761 * @systemapi 9762 * @since 11 9763 */ 9764 enum AudioSpatialDeviceType { 9765 /** 9766 * Audio Spatial Device Type none. 9767 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9768 * @systemapi 9769 * @since 11 9770 */ 9771 SPATIAL_DEVICE_TYPE_NONE = 0, 9772 /** 9773 * Audio Spatial Device Type in-ear headphone. 9774 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9775 * @systemapi 9776 * @since 11 9777 */ 9778 SPATIAL_DEVICE_TYPE_IN_EAR_HEADPHONE = 1, 9779 /** 9780 * Audio Spatial Device Type half-in-ear headphone. 9781 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9782 * @systemapi 9783 * @since 11 9784 */ 9785 SPATIAL_DEVICE_TYPE_HALF_IN_EAR_HEADPHONE = 2, 9786 /** 9787 * Audio Spatial Device Type over-ear headphone. 9788 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9789 * @systemapi 9790 * @since 11 9791 */ 9792 SPATIAL_DEVICE_TYPE_OVER_EAR_HEADPHONE = 3, 9793 /** 9794 * Audio Spatial Device Type glasses. 9795 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9796 * @systemapi 9797 * @since 11 9798 */ 9799 SPATIAL_DEVICE_TYPE_GLASSES = 4, 9800 /** 9801 * Audio Spatial Device Type others. 9802 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9803 * @systemapi 9804 * @since 11 9805 */ 9806 SPATIAL_DEVICE_TYPE_OTHERS = 5, 9807 } 9808 9809 /** 9810 * Describes a spatialization scene type group. 9811 * @enum { number } 9812 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9813 * @systemapi 9814 * @since 12 9815 */ 9816 enum AudioSpatializationSceneType { 9817 /** 9818 * Audio Spatialization Scene Type Default. 9819 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9820 * @systemapi 9821 * @since 12 9822 */ 9823 DEFAULT = 0, 9824 /** 9825 * Audio Spatialization Scene Type Music. 9826 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9827 * @systemapi 9828 * @since 12 9829 */ 9830 MUSIC = 1, 9831 /** 9832 * Audio Spatialization Scene Type Movie. 9833 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9834 * @systemapi 9835 * @since 12 9836 */ 9837 MOVIE = 2, 9838 /** 9839 * Audio Spatialization Scene Type Audio Book. 9840 * @syscap SystemCapability.Multimedia.Audio.Spatialization 9841 * @systemapi 9842 * @since 12 9843 */ 9844 AUDIOBOOK = 3, 9845 } 9846 9847 /** 9848 * Audio AudioChannel Layout 9849 * A 64-bit integer indicates that the appearance and order of the speakers for recording or playback. 9850 * @enum { number } 9851 * @syscap SystemCapability.Multimedia.Audio.Core 9852 * @since 11 9853 */ 9854 /** 9855 * Audio AudioChannel Layout 9856 * A 64-bit integer indicates that the appearance and order of the speakers for recording or playback. 9857 * @enum { number } 9858 * @syscap SystemCapability.Multimedia.Audio.Core 9859 * @crossplatform 9860 * @since 12 9861 */ 9862 enum AudioChannelLayout { 9863 /** 9864 * Unknown Channel Layout 9865 * @syscap SystemCapability.Multimedia.Audio.Core 9866 * @since 11 9867 */ 9868 /** 9869 * Unknown Channel Layout 9870 * @syscap SystemCapability.Multimedia.Audio.Core 9871 * @crossplatform 9872 * @since 12 9873 */ 9874 CH_LAYOUT_UNKNOWN = 0x0, 9875 /** 9876 * Channel Layout For Mono, 1 channel in total 9877 * Speaker layout: front center(FC) 9878 * @syscap SystemCapability.Multimedia.Audio.Core 9879 * @since 11 9880 */ 9881 /** 9882 * Channel Layout For Mono, 1 channel in total 9883 * Speaker layout: front center(FC) 9884 * @syscap SystemCapability.Multimedia.Audio.Core 9885 * @crossplatform 9886 * @since 12 9887 */ 9888 CH_LAYOUT_MONO = 0x4, 9889 /** 9890 * Channel Layout For Stereo, 2 channels in total 9891 * Speaker layout: front left(FL), front right(FR) 9892 * @syscap SystemCapability.Multimedia.Audio.Core 9893 * @since 11 9894 */ 9895 /** 9896 * Channel Layout For Stereo, 2 channels in total 9897 * Speaker layout: front left(FL), front right(FR) 9898 * @syscap SystemCapability.Multimedia.Audio.Core 9899 * @crossplatform 9900 * @since 12 9901 */ 9902 CH_LAYOUT_STEREO = 0x3, 9903 /** 9904 * Channel Layout For Stereo-Downmix, 2 channels in total 9905 * Speaker layout: Stereo left, stereo right 9906 * @syscap SystemCapability.Multimedia.Audio.Core 9907 * @since 11 9908 */ 9909 CH_LAYOUT_STEREO_DOWNMIX = 0x60000000, 9910 /** 9911 * Channel Layout For 2.1, 3 channels in total 9912 * Speaker layout: Stereo plus low-frequency effects(LFE) 9913 * @syscap SystemCapability.Multimedia.Audio.Core 9914 * @since 11 9915 */ 9916 /** 9917 * Channel Layout For 2.1, 3 channels in total 9918 * Speaker layout: Stereo plus low-frequency effects(LFE) 9919 * @syscap SystemCapability.Multimedia.Audio.Core 9920 * @crossplatform 9921 * @since 12 9922 */ 9923 CH_LAYOUT_2POINT1 = 0xB, 9924 /** 9925 * Channel Layout For 3.0, 3 channels in total 9926 * Speaker layout: Stereo plus back center(BC) 9927 * @syscap SystemCapability.Multimedia.Audio.Core 9928 * @since 11 9929 */ 9930 /** 9931 * Channel Layout For 3.0, 3 channels in total 9932 * Speaker layout: Stereo plus back center(BC) 9933 * @syscap SystemCapability.Multimedia.Audio.Core 9934 * @crossplatform 9935 * @since 12 9936 */ 9937 CH_LAYOUT_3POINT0 = 0x103, 9938 /** 9939 * Channel Layout For Surround, 3 channels in total 9940 * Speaker layout: Stereo plus FC 9941 * @syscap SystemCapability.Multimedia.Audio.Core 9942 * @since 11 9943 */ 9944 /** 9945 * Channel Layout For Surround, 3 channels in total 9946 * Speaker layout: Stereo plus FC 9947 * @syscap SystemCapability.Multimedia.Audio.Core 9948 * @crossplatform 9949 * @since 12 9950 */ 9951 CH_LAYOUT_SURROUND = 0x7, 9952 /** 9953 * Channel Layout For 3.1, 4 channels in total 9954 * Speaker layout: Surround plus LFE 9955 * @syscap SystemCapability.Multimedia.Audio.Core 9956 * @since 11 9957 */ 9958 /** 9959 * Channel Layout For 3.1, 4 channels in total 9960 * Speaker layout: Surround plus LFE 9961 * @syscap SystemCapability.Multimedia.Audio.Core 9962 * @crossplatform 9963 * @since 12 9964 */ 9965 CH_LAYOUT_3POINT1 = 0xF, 9966 /** 9967 * Channel Layout For 4.0, 4 channels in total 9968 * Speaker layout: Surround plus BC 9969 * @syscap SystemCapability.Multimedia.Audio.Core 9970 * @since 11 9971 */ 9972 /** 9973 * Channel Layout For 4.0, 4 channels in total 9974 * Speaker layout: Surround plus BC 9975 * @syscap SystemCapability.Multimedia.Audio.Core 9976 * @crossplatform 9977 * @since 12 9978 */ 9979 CH_LAYOUT_4POINT0 = 0x107, 9980 /** 9981 * Channel Layout For Quad, 4 channels in total 9982 * Speaker layout: Stereo plus left and right back speakers 9983 * @syscap SystemCapability.Multimedia.Audio.Core 9984 * @since 11 9985 */ 9986 /** 9987 * Channel Layout For Quad, 4 channels in total 9988 * Speaker layout: Stereo plus left and right back speakers 9989 * @syscap SystemCapability.Multimedia.Audio.Core 9990 * @crossplatform 9991 * @since 12 9992 */ 9993 CH_LAYOUT_QUAD = 0x33, 9994 /** 9995 * Channel Layout For Quad-Side, 4 channels in total 9996 * Speaker layout: Stereo plus left and right side speakers(SL, SR) 9997 * @syscap SystemCapability.Multimedia.Audio.Core 9998 * @since 11 9999 */ 10000 CH_LAYOUT_QUAD_SIDE = 0x603, 10001 /** 10002 * Channel Layout For 2.0.2, 4 channels in total 10003 * Speaker layout: Stereo plus left and right top side speakers 10004 * @syscap SystemCapability.Multimedia.Audio.Core 10005 * @since 11 10006 */ 10007 /** 10008 * Channel Layout For 2.0.2, 4 channels in total 10009 * Speaker layout: Stereo plus left and right top side speakers 10010 * @syscap SystemCapability.Multimedia.Audio.Core 10011 * @crossplatform 10012 * @since 12 10013 */ 10014 CH_LAYOUT_2POINT0POINT2 = 0x3000000003, 10015 /** 10016 * Channel Layout For ORDER1-ACN-N3D First Order Ambisonic(FOA), 4 channels in total 10017 * First order, Ambisonic Channel Number(ACN) format, Normalization of three-D(N3D) 10018 * @syscap SystemCapability.Multimedia.Audio.Core 10019 * @since 11 10020 */ 10021 CH_LAYOUT_AMB_ORDER1_ACN_N3D = 0x100000000001, 10022 /** 10023 * Channel Layout For ORDER1-ACN-SN3D FOA, 4 channels in total 10024 * First order, ACN format, Semi-Normalization of three-D(SN3D) 10025 * @syscap SystemCapability.Multimedia.Audio.Core 10026 * @since 11 10027 */ 10028 CH_LAYOUT_AMB_ORDER1_ACN_SN3D = 0x100000001001, 10029 /** 10030 * Channel Layout For ORDER1-FUMA FOA, 4 channels in total 10031 * First order, Furse-Malham(FuMa) format 10032 * @syscap SystemCapability.Multimedia.Audio.Core 10033 * @since 11 10034 */ 10035 CH_LAYOUT_AMB_ORDER1_FUMA = 0x100000000101, 10036 /** 10037 * Channel Layout For 4.1, 5 channels in total 10038 * Speaker layout: 4.0 plus LFE 10039 * @syscap SystemCapability.Multimedia.Audio.Core 10040 * @since 11 10041 */ 10042 /** 10043 * Channel Layout For 4.1, 5 channels in total 10044 * Speaker layout: 4.0 plus LFE 10045 * @syscap SystemCapability.Multimedia.Audio.Core 10046 * @crossplatform 10047 * @since 12 10048 */ 10049 CH_LAYOUT_4POINT1 = 0x10F, 10050 /** 10051 * Channel Layout For 5.0, 5 channels in total 10052 * Speaker layout: Surround plus two side speakers 10053 * @syscap SystemCapability.Multimedia.Audio.Core 10054 * @since 11 10055 */ 10056 /** 10057 * Channel Layout For 5.0, 5 channels in total 10058 * Speaker layout: Surround plus two side speakers 10059 * @syscap SystemCapability.Multimedia.Audio.Core 10060 * @crossplatform 10061 * @since 12 10062 */ 10063 CH_LAYOUT_5POINT0 = 0x607, 10064 /** 10065 * Channel Layout For 5.0-Back, 5 channels in total 10066 * Speaker layout: Surround plus two back speakers 10067 * @syscap SystemCapability.Multimedia.Audio.Core 10068 * @since 11 10069 */ 10070 CH_LAYOUT_5POINT0_BACK = 0x37, 10071 /** 10072 * Channel Layout For 2.1.2, 5 channels in total 10073 * Speaker layout: 2.0.2 plus LFE 10074 * @syscap SystemCapability.Multimedia.Audio.Core 10075 * @since 11 10076 */ 10077 CH_LAYOUT_2POINT1POINT2 = 0x300000000B, 10078 /** 10079 * Channel Layout For 3.0.2, 5 channels in total 10080 * Speaker layout: 2.0.2 plus FC 10081 * @syscap SystemCapability.Multimedia.Audio.Core 10082 * @since 11 10083 */ 10084 CH_LAYOUT_3POINT0POINT2 = 0x3000000007, 10085 /** 10086 * Channel Layout For 5.1, 6 channels in total 10087 * Speaker layout: 5.0 plus LFE 10088 * @syscap SystemCapability.Multimedia.Audio.Core 10089 * @since 11 10090 */ 10091 /** 10092 * Channel Layout For 5.1, 6 channels in total 10093 * Speaker layout: 5.0 plus LFE 10094 * @syscap SystemCapability.Multimedia.Audio.Core 10095 * @crossplatform 10096 * @since 12 10097 */ 10098 CH_LAYOUT_5POINT1 = 0x60F, 10099 /** 10100 * Channel Layout For 5.1-Back, 6 channels in total 10101 * Speaker layout: 5.0-Back plus LFE 10102 * @syscap SystemCapability.Multimedia.Audio.Core 10103 * @since 11 10104 */ 10105 CH_LAYOUT_5POINT1_BACK = 0x3F, 10106 /** 10107 * Channel Layout For 6.0, 6 channels in total 10108 * Speaker layout: 5.0 plus BC 10109 * @syscap SystemCapability.Multimedia.Audio.Core 10110 * @since 11 10111 */ 10112 /** 10113 * Channel Layout For 6.0, 6 channels in total 10114 * Speaker layout: 5.0 plus BC 10115 * @syscap SystemCapability.Multimedia.Audio.Core 10116 * @crossplatform 10117 * @since 12 10118 */ 10119 CH_LAYOUT_6POINT0 = 0x707, 10120 /** 10121 * Channel Layout For Hexagonal, 6 channels in total 10122 * Speaker layout: 5.0-Back plus BC 10123 * @syscap SystemCapability.Multimedia.Audio.Core 10124 * @since 11 10125 */ 10126 /** 10127 * Channel Layout For Hexagonal, 6 channels in total 10128 * Speaker layout: 5.0-Back plus BC 10129 * @syscap SystemCapability.Multimedia.Audio.Core 10130 * @crossplatform 10131 * @since 12 10132 */ 10133 CH_LAYOUT_HEXAGONAL = 0x137, 10134 /** 10135 * Channel Layout For 3.1.2, 6 channels in total 10136 * Speaker layout: 3.1 plus two top front speakers(TFL, TFR) 10137 * @syscap SystemCapability.Multimedia.Audio.Core 10138 * @since 11 10139 */ 10140 CH_LAYOUT_3POINT1POINT2 = 0x500F, 10141 /** 10142 * Channel Layout For 6.0-Front, 6 channels in total 10143 * Speaker layout: Quad-Side plus left and right front center speakers(FLC, FRC) 10144 * @syscap SystemCapability.Multimedia.Audio.Core 10145 * @since 11 10146 */ 10147 CH_LAYOUT_6POINT0_FRONT = 0x6C3, 10148 /** 10149 * Channel Layout For 6.1, 7 channels in total 10150 * Speaker layout: 5.1 plus BC 10151 * @syscap SystemCapability.Multimedia.Audio.Core 10152 * @since 11 10153 */ 10154 /** 10155 * Channel Layout For 6.1, 7 channels in total 10156 * Speaker layout: 5.1 plus BC 10157 * @syscap SystemCapability.Multimedia.Audio.Core 10158 * @crossplatform 10159 * @since 12 10160 */ 10161 CH_LAYOUT_6POINT1 = 0x70F, 10162 /** 10163 * Channel Layout For 6.1-Back, 7 channels in total 10164 * Speaker layout: 5.1-Back plus BC 10165 * @syscap SystemCapability.Multimedia.Audio.Core 10166 * @since 11 10167 */ 10168 CH_LAYOUT_6POINT1_BACK = 0x13F, 10169 /** 10170 * Channel Layout For 6.1-Front, 7 channels in total 10171 * Speaker layout: 6.0-Front plus LFE 10172 * @syscap SystemCapability.Multimedia.Audio.Core 10173 * @since 11 10174 */ 10175 CH_LAYOUT_6POINT1_FRONT = 0x6CB, 10176 /** 10177 * Channel Layout For 7.0, 7 channels in total 10178 * Speaker layout: 5.0 plus two back speakers 10179 * @syscap SystemCapability.Multimedia.Audio.Core 10180 * @since 11 10181 */ 10182 /** 10183 * Channel Layout For 7.0, 7 channels in total 10184 * Speaker layout: 5.0 plus two back speakers 10185 * @syscap SystemCapability.Multimedia.Audio.Core 10186 * @crossplatform 10187 * @since 12 10188 */ 10189 CH_LAYOUT_7POINT0 = 0x637, 10190 /** 10191 * Channel Layout For 7.0-Front, 7 channels in total 10192 * Speaker layout: 5.0 plus left and right front center speakers 10193 * @syscap SystemCapability.Multimedia.Audio.Core 10194 * @since 11 10195 */ 10196 /** 10197 * Channel Layout For 7.0-Front, 7 channels in total 10198 * Speaker layout: 5.0 plus left and right front center speakers 10199 * @syscap SystemCapability.Multimedia.Audio.Core 10200 * @crossplatform 10201 * @since 12 10202 */ 10203 CH_LAYOUT_7POINT0_FRONT = 0x6C7, 10204 /** 10205 * Channel Layout For 7.1, 8 channels in total 10206 * Speaker layout: 5.1 plus two back speakers 10207 * @syscap SystemCapability.Multimedia.Audio.Core 10208 * @since 11 10209 */ 10210 /** 10211 * Channel Layout For 7.1, 8 channels in total 10212 * Speaker layout: 5.1 plus two back speakers 10213 * @syscap SystemCapability.Multimedia.Audio.Core 10214 * @crossplatform 10215 * @since 12 10216 */ 10217 CH_LAYOUT_7POINT1 = 0x63F, 10218 /** 10219 * Channel Layout For Octagonal, 8 channels in total 10220 * Speaker layout: 5.0 plus BL, BR and BC. 10221 * @syscap SystemCapability.Multimedia.Audio.Core 10222 * @since 11 10223 */ 10224 /** 10225 * Channel Layout For Octagonal, 8 channels in total 10226 * Speaker layout: 5.0 plus BL, BR and BC. 10227 * @syscap SystemCapability.Multimedia.Audio.Core 10228 * @crossplatform 10229 * @since 12 10230 */ 10231 CH_LAYOUT_OCTAGONAL = 0x737, 10232 /** 10233 * Channel Layout For 5.1.2, 8 channels in total 10234 * Speaker layout: 5.1 plus two top side speakers. 10235 * @syscap SystemCapability.Multimedia.Audio.Core 10236 * @since 11 10237 */ 10238 /** 10239 * Channel Layout For 5.1.2, 8 channels in total 10240 * Speaker layout: 5.1 plus two top side speakers. 10241 * @syscap SystemCapability.Multimedia.Audio.Core 10242 * @crossplatform 10243 * @since 12 10244 */ 10245 CH_LAYOUT_5POINT1POINT2 = 0x300000060F, 10246 /** 10247 * Channel Layout For 7.1-Wide, 8 channels in total 10248 * Speaker layout: 5.1 plus left and right front center speakers. 10249 * @syscap SystemCapability.Multimedia.Audio.Core 10250 * @since 11 10251 */ 10252 CH_LAYOUT_7POINT1_WIDE = 0x6CF, 10253 /** 10254 * Channel Layout For 7.1-Wide, 8 channels in total 10255 * Speaker layout: 5.1-Back plus left and right front center speakers. 10256 * @syscap SystemCapability.Multimedia.Audio.Core 10257 * @since 11 10258 */ 10259 CH_LAYOUT_7POINT1_WIDE_BACK = 0xFF, 10260 /** 10261 * Channel Layout For ORDER2-ACN-N3D Higher Order Ambisonics(HOA), 9 channels in total 10262 * Second order, ACN format, N3D 10263 * @syscap SystemCapability.Multimedia.Audio.Core 10264 * @since 11 10265 */ 10266 CH_LAYOUT_AMB_ORDER2_ACN_N3D = 0x100000000002, 10267 /** 10268 * Channel Layout For ORDER2-ACN-SN3D HOA, 9 channels in total 10269 * Second order, ACN format, SN3D 10270 * @syscap SystemCapability.Multimedia.Audio.Core 10271 * @since 11 10272 */ 10273 CH_LAYOUT_AMB_ORDER2_ACN_SN3D = 0x100000001002, 10274 /** 10275 * Channel Layout For ORDER2-FUMA HOA, 9 channels in total 10276 * Second order, FuMa format 10277 * @syscap SystemCapability.Multimedia.Audio.Core 10278 * @since 11 10279 */ 10280 CH_LAYOUT_AMB_ORDER2_FUMA = 0x100000000102, 10281 /** 10282 * Channel Layout For 5.1.4, 10 channels in total 10283 * Speaker layout: 5.1 plus four top speakers(TFL, TFR, TBL, TBR) 10284 * @syscap SystemCapability.Multimedia.Audio.Core 10285 * @since 11 10286 */ 10287 /** 10288 * Channel Layout For 5.1.4, 10 channels in total 10289 * Speaker layout: 5.1 plus four top speakers(TFL, TFR, TBL, TBR) 10290 * @syscap SystemCapability.Multimedia.Audio.Core 10291 * @crossplatform 10292 * @since 12 10293 */ 10294 CH_LAYOUT_5POINT1POINT4 = 0x2D60F, 10295 /** 10296 * Channel Layout For 7.1.2, 10 channels in total 10297 * Speaker layout: 7.1 plus two top side speakers 10298 * @syscap SystemCapability.Multimedia.Audio.Core 10299 * @since 11 10300 */ 10301 /** 10302 * Channel Layout For 7.1.2, 10 channels in total 10303 * Speaker layout: 7.1 plus two top side speakers 10304 * @syscap SystemCapability.Multimedia.Audio.Core 10305 * @crossplatform 10306 * @since 12 10307 */ 10308 CH_LAYOUT_7POINT1POINT2 = 0x300000063F, 10309 /** 10310 * Channel Layout For 7.1.4, 12 channels in total 10311 * Speaker layout: 7.1 plus four top speakers 10312 * @syscap SystemCapability.Multimedia.Audio.Core 10313 * @since 11 10314 */ 10315 /** 10316 * Channel Layout For 7.1.4, 12 channels in total 10317 * Speaker layout: 7.1 plus four top speakers 10318 * @syscap SystemCapability.Multimedia.Audio.Core 10319 * @crossplatform 10320 * @since 12 10321 */ 10322 CH_LAYOUT_7POINT1POINT4 = 0x2D63F, 10323 /** 10324 * Channel Layout For 10.2, 12 channels in total 10325 * Speaker layout: FL, FR, FC, TFL, TFR, BL, BR, BC, SL, SR, wide left(WL), and wide right(WR) 10326 * @syscap SystemCapability.Multimedia.Audio.Core 10327 * @since 11 10328 */ 10329 /** 10330 * Channel Layout For 10.2, 12 channels in total 10331 * Speaker layout: FL, FR, FC, TFL, TFR, BL, BR, BC, SL, SR, wide left(WL), and wide right(WR) 10332 * @syscap SystemCapability.Multimedia.Audio.Core 10333 * @crossplatform 10334 * @since 12 10335 */ 10336 CH_LAYOUT_10POINT2 = 0x180005737, 10337 /** 10338 * Channel Layout For 9.1.4, 14 channels in total 10339 * Speaker layout: 7.1.4 plus two wide speakers(WL, WR) 10340 * @syscap SystemCapability.Multimedia.Audio.Core 10341 * @since 11 10342 */ 10343 CH_LAYOUT_9POINT1POINT4 = 0x18002D63F, 10344 /** 10345 * Channel Layout For 9.1.6, 16 channels in total 10346 * Speaker layout: 9.1.4 plus two top side speakers 10347 * @syscap SystemCapability.Multimedia.Audio.Core 10348 * @since 11 10349 */ 10350 /** 10351 * Channel Layout For 9.1.6, 16 channels in total 10352 * Speaker layout: 9.1.4 plus two top side speakers 10353 * @syscap SystemCapability.Multimedia.Audio.Core 10354 * @crossplatform 10355 * @since 12 10356 */ 10357 CH_LAYOUT_9POINT1POINT6 = 0x318002D63F, 10358 /** 10359 * Channel Layout For Hexadecagonal, 16 channels in total 10360 * Speaker layout: Octagonal plus two wide speakers, six top speakers(TFL, TFR, TFC, TBL, TBR, TBC) 10361 * @syscap SystemCapability.Multimedia.Audio.Core 10362 * @since 11 10363 */ 10364 /** 10365 * Channel Layout For Hexadecagonal, 16 channels in total 10366 * Speaker layout: Octagonal plus two wide speakers, six top speakers(TFL, TFR, TFC, TBL, TBR, TBC) 10367 * @syscap SystemCapability.Multimedia.Audio.Core 10368 * @crossplatform 10369 * @since 12 10370 */ 10371 CH_LAYOUT_HEXADECAGONAL = 0x18003F737, 10372 /** 10373 * Channel Layout For ORDER3-ACN-N3D HOA, 16 channels in total 10374 * Third order, ACN format, N3D 10375 * @syscap SystemCapability.Multimedia.Audio.Core 10376 * @since 11 10377 */ 10378 /** 10379 * Channel Layout For ORDER3-ACN-N3D HOA, 16 channels in total 10380 * Third order, ACN format, N3D 10381 * @syscap SystemCapability.Multimedia.Audio.Core 10382 * @crossplatform 10383 * @since 12 10384 */ 10385 CH_LAYOUT_AMB_ORDER3_ACN_N3D = 0x100000000003, 10386 /** 10387 * Channel Layout For ORDER3-ACN-SN3D HOA, 16 channels in total 10388 * Third order, ACN format, N3D 10389 * @syscap SystemCapability.Multimedia.Audio.Core 10390 * @since 11 10391 */ 10392 /** 10393 * Channel Layout For ORDER3-ACN-SN3D HOA, 16 channels in total 10394 * Third order, ACN format, N3D 10395 * @syscap SystemCapability.Multimedia.Audio.Core 10396 * @crossplatform 10397 * @since 12 10398 */ 10399 CH_LAYOUT_AMB_ORDER3_ACN_SN3D = 0x100000001003, 10400 /** 10401 * Channel Layout For ORDER3-FUMA HOA, 16 channels in total 10402 * Third order, FuMa format 10403 * @syscap SystemCapability.Multimedia.Audio.Core 10404 * @since 11 10405 */ 10406 CH_LAYOUT_AMB_ORDER3_FUMA = 0x100000000103 10407 } 10408 10409 /** 10410 * Enumerates audio effect flags. 10411 * @enum { number } 10412 * @syscap SystemCapability.Multimedia.Audio.Core 10413 * @systemapi 10414 * @since 18 10415 */ 10416 enum EffectFlag { 10417 /** 10418 * Audio render effect. 10419 * @syscap SystemCapability.Multimedia.Audio.Core 10420 * @systemapi 10421 * @since 18 10422 */ 10423 RENDER_EFFECT_FLAG = 0, 10424 10425 /** 10426 * Audio capture effect. 10427 * @syscap SystemCapability.Multimedia.Audio.Core 10428 * @systemapi 10429 * @since 18 10430 */ 10431 CAPTURE_EFFECT_FLAG = 1 10432 } 10433 10434 /** 10435 * Describes an audio effect property. 10436 * @typedef AudioEffectProperty 10437 * @syscap SystemCapability.Multimedia.Audio.Core 10438 * @systemapi 10439 * @since 18 10440 */ 10441 interface AudioEffectProperty { 10442 /** 10443 * Name of effect property. 10444 * @type { string } 10445 * @syscap SystemCapability.Multimedia.Audio.Core 10446 * @systemapi 10447 * @since 18 10448 */ 10449 name: string; 10450 10451 /** 10452 * Effect category this effect property belongs to. 10453 * @type { string } 10454 * @syscap SystemCapability.Multimedia.Audio.Core 10455 * @systemapi 10456 * @since 18 10457 */ 10458 category: string; 10459 10460 /** 10461 * Effect flag of this effect property. 10462 * @type { EffectFlag } 10463 * @syscap SystemCapability.Multimedia.Audio.Core 10464 * @systemapi 10465 * @since 18 10466 */ 10467 flag: EffectFlag; 10468 } 10469} 10470 10471export default audio; 10472