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