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