• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2021-2022 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
16import {ErrorCallback, AsyncCallback, Callback} from './basic';
17import {VideoPlayer, AudioPlayer} from './@ohos.multimedia.media'
18import Context from './@ohos.ability';
19/**
20 * @name audio
21 * @since 7
22 * @syscap SystemCapability.Multimedia.Audio
23 * @import import audio from '@ohos.multimedia.audio';
24 * @permission
25 */
26declare namespace audio {
27
28  /**
29   * Obtains an AudioManager instance.
30   * @since 7
31   * @syscap SystemCapability.Multimedia.Audio
32   */
33  function getAudioManager(): AudioManager;
34
35  /**
36   * Creates a AudioCapturer instance.
37   * @param options All options used for audio capturer.
38   * @return AudioCapturer instance.
39   * @since 8
40   * @syscap SystemCapability.Multimedia.Audio
41   */
42  function createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback<AudioCapturer>): void;
43  function createAudioCapturer(options: AudioCapturerOptions): Promise<AudioCapturer>;
44
45  /**
46   * Creates a AudioRenderer instance.
47   * @param options All options used for audio renderer.
48   * @return AudioRenderer instance.
49   * @since 8
50   * @syscap SystemCapability.Multimedia.Audio
51   */
52  function createAudioRenderer(options: AudioRendererOptions, callback: AsyncCallback<AudioRenderer>): void;
53  function createAudioRenderer(options: AudioRendererOptions): Promise<AudioRenderer>;
54
55  /**
56   * Enumerates the rendering states of the current device.
57   * @since 8
58   * @syscap SystemCapability.Multimedia.Audio
59   */
60  enum AudioState {
61    /**
62     * Invalid state.
63     * @since 8
64     */
65    STATE_INVALID = -1,
66    /**
67     * Create New instance state.
68     * @since 8
69     */
70    STATE_NEW,
71    /**
72     * Prepared state.
73     * @since 8
74     */
75    STATE_PREPARED,
76    /**
77     * Running state.
78     * @since 8
79     */
80    STATE_RUNNING,
81    /**
82     * Stopped state.
83     * @since 8
84     */
85    STATE_STOPPED,
86    /**
87     * Released state.
88     * @since 8
89     */
90    STATE_RELEASED,
91    /**
92     * Paused state.
93     * @since 8
94     */
95    STATE_PAUSED
96  }
97
98  /**
99   * Enumerates audio stream types.
100   * @since 7
101   * @syscap SystemCapability.Multimedia.Audio
102   */
103  enum AudioVolumeType {
104    /**
105     * Audio streams for voice calls
106     * @since 8
107     */
108    VOICE_CALL = 0,
109    /**
110     * Audio streams for ring tones
111     * @since 7
112     */
113    RINGTONE = 2,
114    /**
115     * Audio streams for media purpose
116     * @since 7
117     */
118    MEDIA = 3,
119    /**
120     * Audio stream for voice assistant
121     * @since 8
122     */
123    VOICE_ASSISTANT = 9,
124  }
125
126  /**
127   * Enumerates audio device flags.
128   * @since 7
129   * @syscap SystemCapability.Multimedia.Audio
130   */
131  enum DeviceFlag {
132    /**
133     * Output devices
134     * @since 7
135     */
136    OUTPUT_DEVICES_FLAG = 1,
137    /**
138     * Input devices
139     * @since 7
140     */
141    INPUT_DEVICES_FLAG = 2,
142    /**
143     * All devices
144     * @since 7
145     */
146    ALL_DEVICES_FLAG = 3,
147  }
148
149  /**
150   * Enumerates device roles.
151   * @since 7
152   * @syscap SystemCapability.Multimedia.Audio
153   */
154  enum DeviceRole {
155    /**
156     * Input role
157     * @since 7
158     */
159    INPUT_DEVICE = 1,
160    /**
161     * Output role
162     * @since 7
163     */
164    OUTPUT_DEVICE = 2,
165  }
166
167  /**
168   * Enumerates device types.
169   * @since 7
170   * @syscap SystemCapability.Multimedia.Audio
171   */
172  enum DeviceType {
173    /**
174     * Invalid device
175     * @since 7
176     */
177    INVALID = 0,
178    /**
179     * Speaker
180     * @since 7
181     */
182    SPEAKER = 2,
183    /**
184     * Wired headset
185     * @since 7
186     */
187    WIRED_HEADSET = 3,
188    /**
189     * Bluetooth device using the synchronous connection oriented link (SCO)
190     * @since 7
191     */
192    BLUETOOTH_SCO = 7,
193    /**
194     * Bluetooth device using advanced audio distribution profile (A2DP)
195     * @since 7
196     */
197    BLUETOOTH_A2DP = 8,
198    /**
199     * Microphone
200     * @since 7
201     */
202    MIC = 15,
203    /**
204     * USB audio headset.
205     * @since 7
206     */
207    USB_HEADSET = 22
208  }
209
210  /**
211   * Enumerates Active device types.
212   * @since 7
213   * @syscap SystemCapability.Multimedia.Audio
214   */
215   enum ActiveDeviceType {
216    /**
217     * Speaker
218     * @since 7
219     */
220    SPEAKER = 2,
221    /**
222     * Bluetooth device using the synchronous connection oriented link (SCO)
223     * @since 7
224     */
225    BLUETOOTH_SCO = 7,
226  }
227
228  /**
229   * Enumerates Audio Ringer modes
230   * @since 7
231   * @syscap SystemCapability.Multimedia.Audio
232   */
233  enum AudioRingMode {
234    /**
235     * Silent mode
236     * @since 7
237     */
238    RINGER_MODE_SILENT = 0,
239    /**
240     * Vibration mode
241     * @since 7
242     */
243    RINGER_MODE_VIBRATE,
244   /**
245     * Normal mode
246     * @since 7
247     */
248    RINGER_MODE_NORMAL,
249  }
250
251  /**
252   * Enumerates the sample format.
253   * @since 8
254   * @syscap SystemCapability.Multimedia.Audio
255   */
256  enum AudioSampleFormat {
257    SAMPLE_FORMAT_INVALID = -1,
258    SAMPLE_FORMAT_U8 = 0,
259    SAMPLE_FORMAT_S16LE = 1,
260    SAMPLE_FORMAT_S24LE = 2,
261    SAMPLE_FORMAT_S32LE = 3,
262  }
263
264  /**
265   * Enumerates the audio channel.
266   * @since 8
267   * @syscap SystemCapability.Multimedia.Audio
268   */
269  enum AudioChannel {
270    CHANNEL_1 = 0x1 << 0,
271    CHANNEL_2 = 0x1 << 1
272  }
273
274  /**
275   * Enumerates the audio sampling rate.
276   * @since 8
277   * @syscap SystemCapability.Multimedia.Audio
278   */
279  enum AudioSamplingRate {
280    SAMPLE_RATE_8000 = 8000,
281    SAMPLE_RATE_11025 = 11025,
282    SAMPLE_RATE_12000 = 12000,
283    SAMPLE_RATE_16000 = 16000,
284    SAMPLE_RATE_22050 = 22050,
285    SAMPLE_RATE_24000 = 24000,
286    SAMPLE_RATE_32000 = 32000,
287    SAMPLE_RATE_44100 = 44100,
288    SAMPLE_RATE_48000 = 48000,
289    SAMPLE_RATE_64000 = 64000,
290    SAMPLE_RATE_96000 = 96000
291  }
292
293  /**
294   * Enumerates the audio encoding type.
295   * @since 8
296   * @syscap SystemCapability.Multimedia.Audio
297   */
298  enum AudioEncodingType {
299    /**
300     * Invalid type.
301     * @since 8
302     */
303    ENCODING_TYPE_INVALID = -1,
304    /**
305     * Raw pcm type.
306     * @since 8
307     */
308    ENCODING_TYPE_RAW = 0
309  }
310
311  /**
312   * Enumerates the audio content type.
313   * @since 7
314   * @syscap SystemCapability.Multimedia.Audio
315   */
316  enum ContentType {
317    /**
318     * Unknown content.
319     * @since 7
320     */
321    CONTENT_TYPE_UNKNOWN = 0,
322    /**
323     * Speech content.
324     * @since 7
325     */
326    CONTENT_TYPE_SPEECH = 1,
327    /**
328     * Music content.
329     * @since 7
330     */
331    CONTENT_TYPE_MUSIC = 2,
332    /**
333     * Movie content.
334     * @since 7
335     */
336    CONTENT_TYPE_MOVIE = 3,
337    /**
338     * Notification content.
339     * @since 7
340     */
341    CONTENT_TYPE_SONIFICATION = 4,
342    /**
343     * Ringtone content.
344     * @since 8
345     */
346    CONTENT_TYPE_RINGTONE = 5,
347  }
348
349  /**
350   * Enumerates the stream usage.
351   * @since 7
352   * @syscap SystemCapability.Multimedia.Audio
353   */
354  enum StreamUsage {
355    /**
356     * Unkown usage.
357     * @since 7
358     */
359    STREAM_USAGE_UNKNOWN = 0,
360    /**
361     * Media usage.
362     * @since 7
363     */
364    STREAM_USAGE_MEDIA = 1,
365    /**
366     * Voice communication usage.
367     * @since 7
368     */
369    STREAM_USAGE_VOICE_COMMUNICATION = 2,
370    /**
371     * Notification or ringtone usage.
372     * @since 7
373     */
374    STREAM_USAGE_NOTIFICATION_RINGTONE = 6
375  }
376
377  /**
378   * Interface for audio stream info
379   * @since 8
380   * @syscap SystemCapability.Multimedia.Audio
381   */
382  interface AudioStreamInfo {
383    /**
384     * Audio sampling rate
385     * @since 8
386     * @syscap SystemCapability.Multimedia.Audio
387     */
388    samplingRate: AudioSamplingRate;
389    /**
390     * Audio channels
391     * @since 8
392     * @syscap SystemCapability.Multimedia.Audio
393     */
394    channels: AudioChannel;
395    /**
396     * Audio sample format
397     * @since 8
398     * @syscap SystemCapability.Multimedia.Audio
399     */
400    sampleFormat: AudioSampleFormat;
401    /**
402     * Audio encoding type
403     * @since 8
404     * @syscap SystemCapability.Multimedia.Audio
405     */
406    encodingType: AudioEncodingType;
407  }
408
409  /**
410   * Interface for audio renderer info
411   * @since 8
412   * @syscap SystemCapability.Multimedia.Audio
413   */
414  interface AudioRendererInfo {
415    /**
416     * Audio content type
417     * @since 8
418     * @syscap SystemCapability.Multimedia.Audio
419     */
420    content: ContentType;
421    /**
422     * Audio stream usage
423     * @since 8
424     * @syscap SystemCapability.Multimedia.Audio
425     */
426    usage: StreamUsage;
427    /**
428     * Audio renderer flags
429     * @since 8
430     * @syscap SystemCapability.Multimedia.Audio
431     */
432    rendererFlags: number;
433  }
434
435  /**
436   * Interface for audio renderer options
437   * @since 8
438   * @syscap SystemCapability.Multimedia.Audio
439   */
440  interface AudioRendererOptions {
441    /**
442     * Audio stream info
443     * @since 8
444     * @syscap SystemCapability.Multimedia.Audio
445     */
446    streamInfo: AudioStreamInfo;
447    /**
448     * Audio renderer info
449     * @since 8
450     * @syscap SystemCapability.Multimedia.Audio
451     */
452    rendererInfo: AudioRendererInfo;
453  }
454
455  /**
456   * Enum for audio renderer rate
457   * @since 8
458   * @syscap SystemCapability.Multimedia.Audio
459   */
460  enum AudioRendererRate {
461    /**
462     * Normal rate
463     * @since 8
464     */
465    RENDER_RATE_NORMAL = 0,
466    /**
467     * Double rate
468     * @since 8
469     */
470    RENDER_RATE_DOUBLE = 1,
471    /**
472     * Half rate
473     * @since 8
474     */
475    RENDER_RATE_HALF = 2
476  }
477
478  /**
479   * Enumerates audio interruption event types.
480   * @since 7
481   * @syscap SystemCapability.Multimedia.Audio
482   */
483  enum InterruptType {
484    /**
485     * An audio interruption event starts.
486     * @since 7
487     */
488    INTERRUPT_TYPE_BEGIN = 1,
489
490    /**
491     * An audio interruption event ends.
492     * @since 7
493     */
494    INTERRUPT_TYPE_END = 2
495  }
496
497  /**
498   * Enumerates the types of hints for audio interruption.
499   * @since 7
500   * @syscap SystemCapability.Multimedia.Audio
501   */
502  enum InterruptHint {
503    /**
504     * Audio no interrupt.
505     * @since 8
506     */
507    INTERRUPT_HINT_NONE = 0,
508    /**
509     * Audio resumed.
510     * @since 7
511     */
512    INTERRUPT_HINT_RESUME = 1,
513
514    /**
515     * Audio paused.
516     * @since 7
517     */
518    INTERRUPT_HINT_PAUSE = 2,
519
520    /**
521     * Audio stopped.
522     * @since 7
523     */
524    INTERRUPT_HINT_STOP = 3,
525
526    /**
527     * Audio ducking. (In ducking, the audio volume is reduced, but not silenced.)
528     * @since 7
529     */
530    INTERRUPT_HINT_DUCK = 4,
531
532    /**
533     * Audio unducking.
534     * @since 8
535     */
536    INTERRUPT_HINT_UNDUCK = 5,
537  }
538
539  /**
540   * Interrupt force type.
541   * @since 8
542   * @syscap SystemCapability.Multimedia.Audio
543   */
544  enum InterruptForceType {
545    /**
546     * Force type, system change audio state.
547     * @since 8
548     */
549    INTERRUPT_FORCE = 0,
550    /**
551     * Share type, application change audio state.
552     * @since 8
553     */
554    INTERRUPT_SHARE
555  }
556
557  /**
558   * Interrupt events
559   * @since 8
560   * @syscap SystemCapability.Multimedia.Audio
561   */
562  interface InterruptEvent {
563    /**
564     * Interrupt event type, begin or end
565     * @since 8
566     * @syscap SystemCapability.Multimedia.Audio
567     */
568    eventType: InterruptType;
569
570    /**
571     * Interrupt force type, force or share
572     * @since 8
573     * @syscap SystemCapability.Multimedia.Audio
574     */
575    forceType: InterruptForceType;
576
577    /**
578     * Interrupt hint type. In force type, the audio state already changed,
579     * but in share mode, only provide a hint for application to decide.
580     * @since 8
581     * @syscap SystemCapability.Multimedia.Audio
582     */
583    hintType: InterruptHint;
584  }
585
586  /**
587   * Enumerates interrupt action types.
588   * @since 7
589   * @syscap SystemCapability.Multimedia.Audio.Renderer
590   */
591  enum InterruptActionType {
592
593    /**
594     * Focus gain event.
595     * @since 7
596     * @syscap SystemCapability.Multimedia.Audio.Renderer
597     */
598    TYPE_ACTIVATED = 0,
599
600    /**
601     * Audio interruption event.
602     * @since 7
603     * @syscap SystemCapability.Multimedia.Audio.Renderer
604     */
605    TYPE_INTERRUPT = 1
606  }
607
608  /**
609   * Enumerates device change types.
610   * @since 7
611   * @syscap SystemCapability.Multimedia.Audio
612   */
613  enum DeviceChangeType {
614    /**
615     * Device connection.
616     * @since 7
617     */
618    CONNECT = 0,
619
620    /**
621     * Device disconnection.
622     * @since 7
623     */
624    DISCONNECT = 1,
625  }
626
627  /**
628   * Enumerates audio scenes.
629   * @since 8
630   * @syscap SystemCapability.Multimedia.Audio
631  */
632  enum AudioScene {
633    /**
634     * Default audio scene
635     * @since 8
636     */
637    AUDIO_SCENE_DEFAULT = 0,
638    /**
639     * Ringing audio scene
640     * Only available for system api.
641     * @since 8
642     */
643    AUDIO_SCENE_RINGING,
644    /**
645     * Phone call audio scene
646     * Only available for system api.
647     * @since 8
648     */
649    AUDIO_SCENE_PHONE_CALL,
650    /**
651     * Voice chat audio scene
652     * @since 8
653     */
654    AUDIO_SCENE_VOICE_CHAT
655  }
656
657  /**
658   * Manages audio volume and audio device information.
659   * @since 7
660   * @syscap SystemCapability.Multimedia.Audio
661   */
662  interface AudioManager {
663    /**
664     * Sets volume for a stream. This method uses an asynchronous callback to return the execution result.
665     * @since 7
666     * @syscap SystemCapability.Multimedia.Audio
667     */
668    setVolume(audioType: AudioVolumeType, volume: number, callback: AsyncCallback<void>): void;
669    /**
670     * Sets volume for a stream. This method uses a promise to return the execution result.
671     * @since 7
672     * @syscap SystemCapability.Multimedia.Audio
673     */
674    setVolume(audioType: AudioVolumeType, volume: number): Promise<void>;
675    /**
676     * Obtains volume of a stream. This method uses an asynchronous callback to return the execution result.
677     * @since 7
678     * @syscap SystemCapability.Multimedia.Audio
679     */
680    getVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void;
681    /**
682     * Obtains the volume of a stream. This method uses a promise to return the execution result.
683     * @since 7
684     * @syscap SystemCapability.Multimedia.Audio
685     */
686    getVolume(audioType: AudioVolumeType): Promise<number>;
687    /**
688     * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the execution result.
689     * @since 7
690     * @syscap SystemCapability.Multimedia.Audio
691     */
692    getMinVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void;
693    /**
694     * Obtains the minimum volume allowed for a stream. This method uses a promise to return the execution result.
695     * @since 7
696     * @syscap SystemCapability.Multimedia.Audio
697     */
698    getMinVolume(audioType: AudioVolumeType): Promise<number>;
699    /**
700     * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the execution result.
701     * @since 7
702     * @syscap SystemCapability.Multimedia.Audio
703     */
704    getMaxVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void;
705    /**
706     * Obtains the maximum volume allowed for a stream. This method uses a promise to return the execution result.
707     * @since 7
708     * @syscap SystemCapability.Multimedia.Audio
709     */
710    getMaxVolume(audioType: AudioVolumeType): Promise<number>;
711    /**
712     * Obtains the audio devices of a specified flag. This method uses an asynchronous callback to return the execution result.
713     * @since 7
714     * @syscap SystemCapability.Multimedia.Audio
715     */
716    getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors>): void;
717    /**
718     * Obtains the audio devices with a specified flag. This method uses a promise to return the execution result.
719     * @since 7
720     * @syscap SystemCapability.Multimedia.Audio
721     */
722    getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors>;
723    /**
724     * Sets the stream to mute. This method uses an asynchronous callback to return the execution result.
725     * @since 7
726     * @syscap SystemCapability.Multimedia.Audio
727     */
728    mute(audioType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void>): void;
729    /**
730     * Sets the stream to mute. This method uses a promise to return the execution result.
731     * @since 7
732     * @syscap SystemCapability.Multimedia.Audio
733     */
734    mute(audioType: AudioVolumeType, mute: boolean): Promise<void>;
735    /**
736     * Checks whether the stream is muted. This method uses an asynchronous callback to return the execution result.
737     * @since 7
738     * @syscap SystemCapability.Multimedia.Audio
739     */
740    isMute(audioType: AudioVolumeType, callback: AsyncCallback<boolean>): void;
741    /**
742     * Checks whether the stream is muted. This method uses a promise to return the execution result.
743     * @since 7
744     * @syscap SystemCapability.Multimedia.Audio
745     */
746    isMute(audioType: AudioVolumeType): Promise<boolean>;
747    /**
748     * Checks whether the stream is active. This method uses an asynchronous callback to return the execution result.
749     * @since 7
750     * @syscap SystemCapability.Multimedia.Audio
751     */
752    isActive(audioType: AudioVolumeType, callback: AsyncCallback<boolean>): void;
753    /**
754     * Checks whether the stream is active. This method uses a promise to return the execution result.
755     * @since 7
756     * @syscap SystemCapability.Multimedia.Audio
757     */
758    isActive(audioType: AudioVolumeType): Promise<boolean>;
759    /**
760     * Mute/Unmutes the microphone. This method uses an asynchronous callback to return the execution result.
761     * @since 7
762     * @syscap SystemCapability.Multimedia.Audio
763     */
764    setMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void;
765    /**
766     * Mute/Unmutes the microphone. This method uses a promise to return the execution result.
767     * @since 7
768     * @syscap SystemCapability.Multimedia.Audio
769     */
770    setMicrophoneMute(mute: boolean): Promise<void>;
771    /**
772     * Checks whether the microphone is muted. This method uses an asynchronous callback to return the execution result.
773     * @since 7
774     * @syscap SystemCapability.Multimedia.Audio
775     */
776    isMicrophoneMute(callback: AsyncCallback<boolean>): void;
777    /**
778     * Checks whether the microphone is muted. This method uses a promise to return the execution result.
779     * @since 7
780     * @syscap SystemCapability.Multimedia.Audio
781     */
782    isMicrophoneMute(): Promise<boolean>;
783    /**
784     * Sets the ringer mode. This method uses an asynchronous callback to return the execution result.
785     * @since 7
786     * @syscap SystemCapability.Multimedia.Audio
787     */
788    setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void;
789    /**
790     * Sets the ringer mode. This method uses a promise to return the execution result.
791     * @since 7
792     * @syscap SystemCapability.Multimedia.Audio
793     */
794    setRingerMode(mode: AudioRingMode): Promise<void>;
795    /**
796     * Gets the ringer mode. This method uses an asynchronous callback to return the execution result.
797     * @since 7
798     * @syscap SystemCapability.Multimedia.Audio
799     */
800    getRingerMode(callback: AsyncCallback<AudioRingMode>): void;
801    /**
802     * Gets the ringer mode. This method uses a promise to return the execution result.
803     * @since 7
804     * @syscap SystemCapability.Multimedia.Audio
805     */
806    getRingerMode(): Promise<AudioRingMode>;
807    /**
808     * Sets the audio parameter. This method uses an asynchronous callback to return the execution result.
809     * @since 7
810     * @syscap SystemCapability.Multimedia.Audio
811     */
812    setAudioParameter(key: string, value: string, callback: AsyncCallback<void>): void;
813    /**
814     * Sets the audio parameter. This method uses a promise to return the execution result.
815     * @since 7
816     * @syscap SystemCapability.Multimedia.Audio
817     */
818    setAudioParameter(key: string, value: string): Promise<void>;
819    /**
820     * Gets the audio parameter. This method uses an asynchronous callback to return the execution result.
821     * @since 7
822     * @syscap SystemCapability.Multimedia.Audio
823     */
824    getAudioParameter(key: string, callback: AsyncCallback<string>): void;
825    /**
826     * Gets the audio parameter. This method uses a promise to return the execution result.
827     * @since 7
828     * @syscap SystemCapability.Multimedia.Audio
829     */
830    getAudioParameter(key: string): Promise<string>;
831    /**
832     * Activates the device. This method uses an asynchronous callback to return the execution result.
833     * @since 7
834     * @syscap SystemCapability.Multimedia.Audio
835     */
836    setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback<void>): void;
837    /**
838     * Activates the device. This method uses a promise to return the execution result.
839     * @since 7
840     * @syscap SystemCapability.Multimedia.Audio
841     */
842    setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise<void>;
843    /**
844     * Checks whether the device is active. This method uses an asynchronous callback to return the execution result.
845     * @since 7
846     * @syscap SystemCapability.Multimedia.Audio
847     */
848    isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback<boolean>): void;
849    /**
850     * Checks whether the device is active. This method uses a promise to return the execution result.
851     * @since 7
852     * @syscap SystemCapability.Multimedia.Audio
853     */
854    isDeviceActive(deviceType: ActiveDeviceType): Promise<boolean>;
855    /**
856     * Subscribes volume change event callback, only for system
857     * @return VolumeEvent callback.
858     * @since 8
859     * @syscap SystemCapability.Multimedia.Audio
860     * @systemapi
861     */
862    on(type: 'volumeChange', callback: Callback<VolumeEvent>): void;
863    /**
864     * Monitors ringer mode change
865     * @since 8
866     * @syscap SystemCapability.Multimedia.Audio
867     * @systemapi
868     */
869    on(type: 'ringerModeChange', callback: Callback<AudioRingMode>): void;
870    /**
871     * Sets the audio scene mode to change audio strategy.
872     * This method uses an asynchronous callback to return the execution result.
873     * @since 8
874     * @syscap SystemCapability.Multimedia.Audio
875     */
876    setAudioScene(scene: AudioScene, callback: AsyncCallback<void> ): void;
877    /**
878     * Sets the audio scene mode to change audio strategy. This method uses a promise to return the execution result.
879     * @since 8
880     * @syscap SystemCapability.Multimedia.Audio
881     */
882    setAudioScene(scene: AudioScene): Promise<void>;
883    /**
884     * Obtains the system audio scene mode. This method uses an asynchronous callback to return the execution result.
885     * @since 8
886     * @syscap SystemCapability.Multimedia.Audio
887     */
888    getAudioScene(callback: AsyncCallback<AudioScene> ): void;
889    /**
890     * Obtains the system audio scene mode. This method uses a promise to return the execution result.
891     * @since 8
892     * @syscap SystemCapability.Multimedia.Audio
893     */
894    getAudioScene(): Promise<AudioScene>;
895    /**
896    * Monitors device changes
897    * @since 7
898    * @syscap SystemCapability.Multimedia.Audio
899    */
900    on(type: 'deviceChange', callback: Callback<DeviceChangeAction>): void;
901
902    /**
903     * UnSubscribes to device change events.
904     * @since 7
905     * @syscap SystemCapability.Multimedia.Audio.Device
906     */
907    off(type: 'deviceChange'): void;
908
909    /**
910     * Listens for audio interruption events. When the audio of an application is interrupted by another application,
911     * the callback is invoked to notify the former application.
912     * @param type Type of the event to listen for. Only the interrupt event is supported.
913     * @param interrupt Parameters of the audio interruption event type.
914     * @param callback Callback invoked for the audio interruption event.
915     * @since 7
916     * @syscap SystemCapability.Multimedia.Audio.Renderer
917     */
918    on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback<InterruptAction>): void;
919
920     /**
921      * Cancels the listening of audio interruption events.
922      * @param type Type of the event to listen for. Only the interrupt event is supported.
923      * @param interrupt Input parameters of the audio interruption event.
924      * @since 7
925      * @syscap SystemCapability.Multimedia.Audio.Renderer
926      */
927    off(type: 'interrupt', interrupt: AudioInterrupt): void;
928  }
929
930  /**
931   * Describes an audio device.
932   * @since 7
933   * @syscap SystemCapability.Multimedia.Audio
934   */
935  interface AudioDeviceDescriptor {
936    /**
937     * Audio device role
938     * @since 7
939     * @syscap SystemCapability.Multimedia.Audio
940     */
941    readonly deviceRole: DeviceRole;
942    /**
943     * Audio device type
944     * @since 7
945     * @syscap SystemCapability.Multimedia.Audio
946     */
947    readonly deviceType: DeviceType;
948  }
949
950  /**
951   * A queue of AudioDeviceDescriptor, which is read-only.
952   * @since 7
953   * @syscap SystemCapability.Multimedia.Audio
954   */
955  type AudioDeviceDescriptors = Array<Readonly<AudioDeviceDescriptor>>;
956
957  /**
958   * Audio volume event
959   * @since 8
960   * @syscap SystemCapability.Multimedia.Audio
961   * @systemapi
962   */
963  interface VolumeEvent {
964    /**
965     * volumeType of current stream
966     * @since 8
967     * @syscap SystemCapability.Multimedia.Audio
968     */
969    volumeType: AudioVolumeType;
970    /**
971     * volume level
972     * @since 8
973     * @syscap SystemCapability.Multimedia.Audio
974     */
975    volume: number;
976    /**
977     * updateUi show volume change in Ui
978     * @since 8
979     * @syscap SystemCapability.Multimedia.Audio
980     */
981    updateUi: boolean;
982  }
983
984  /**
985   * Describes the callback invoked for audio interruption or focus gain events.When the audio of an application
986   * is interrupted by another application, the callback is invoked to notify the former application.
987   * @since 7
988   * @syscap SystemCapability.Multimedia.Audio.Renderer
989   */
990  interface InterruptAction {
991
992    /**
993     * Event type.
994     * The value TYPE_ACTIVATED means the focus gain event, and TYPE_INTERRUPT means the audio interruption event.
995     * @since 7
996     * @syscap SystemCapability.Multimedia.Audio.Renderer
997     */
998    actionType: InterruptActionType;
999
1000    /**
1001     * Type of the audio interruption event.
1002     * @since 7
1003     * @syscap SystemCapability.Multimedia.Audio.Renderer
1004     */
1005    type?: InterruptType;
1006
1007    /**
1008     * Hint for the audio interruption event.
1009     * @since 7
1010     * @syscap SystemCapability.Multimedia.Audio.Renderer
1011     */
1012    hint?: InterruptHint;
1013
1014    /**
1015     * Whether the focus is gained or released. The value true means that the focus is gained or released,
1016     * and false means that the focus fails to be gained or released.
1017     * @since 7
1018     * @syscap SystemCapability.Multimedia.Audio.Renderer
1019     */
1020    activated?: boolean;
1021  }
1022
1023  /**
1024   * Describes input parameters of audio listening events.
1025   * @since 7
1026   * @syscap SystemCapability.Multimedia.Audio.Renderer
1027   */
1028  interface AudioInterrupt {
1029
1030    /**
1031     * Audio stream usage type.
1032     * @since 7
1033     * @syscap SystemCapability.Multimedia.Audio.Renderer
1034     */
1035    streamUsage: StreamUsage;
1036
1037    /**
1038     * Type of the media interrupted.
1039     * @since 7
1040     * @syscap SystemCapability.Multimedia.Audio.Renderer
1041     */
1042    contentType: ContentType;
1043
1044    /**
1045     * Whether audio playback can be paused when it is interrupted.
1046     * The value true means that audio playback can be paused when it is interrupted, and false means the opposite.
1047     * @since 7
1048     * @syscap SystemCapability.Multimedia.Audio.Renderer
1049     */
1050    pauseWhenDucked: boolean;
1051  }
1052
1053  /**
1054   * Describes the device change type and device information.
1055   * @since 7
1056   * @syscap SystemCapability.Multimedia.Audio
1057   */
1058  interface DeviceChangeAction {
1059    /**
1060     * Device change type.
1061     * @since 7
1062     * @syscap SystemCapability.Multimedia.Audio
1063     */
1064    type: DeviceChangeType;
1065
1066    /**
1067     * Device information.
1068     * @since 7
1069     * @syscap SystemCapability.Multimedia.Audio
1070     */
1071    deviceDescriptors: AudioDeviceDescriptors;
1072  }
1073
1074  /**
1075   * Provides functions for applications for audio playback.
1076   * @since 8
1077   * @syscap SystemCapability.Multimedia.Audio
1078   */
1079  interface AudioRenderer {
1080    /**
1081     * Gets audio state.
1082     * @since 8
1083     * @syscap SystemCapability.Multimedia.Audio
1084     */
1085    readonly state: AudioState;
1086    /**
1087     * Gets audio renderer info.
1088     * @return AudioRendererInfo value
1089     * @since 8
1090     * @syscap SystemCapability.Multimedia.Audio
1091     */
1092    getRendererInfo(callback: AsyncCallback<AudioRendererInfo>): void;
1093    getRendererInfo(): Promise<AudioRendererInfo>;
1094    /**
1095     * Gets audio stream info.
1096     * @return AudioStreamInfo value
1097     * @since 8
1098     * @syscap SystemCapability.Multimedia.Audio
1099     */
1100    getStreamInfo(callback: AsyncCallback<AudioStreamInfo>): void;
1101    getStreamInfo(): Promise<AudioStreamInfo>;
1102    /**
1103     * Starts audio rendering. This method uses an asynchronous callback to return the execution result.
1104     * @since 8
1105     * @syscap SystemCapability.Multimedia.Audio
1106     */
1107    start(callback: AsyncCallback<void>): void;
1108    /**
1109     * Starts audio rendering. This method uses a promise to return the execution result.
1110     * @since 8
1111     * @syscap SystemCapability.Multimedia.Audio
1112     */
1113    start(): Promise<void>;
1114    /**
1115     * Render audio data. This method uses an asynchronous callback to return the execution result.
1116     * @since 8
1117     * @syscap SystemCapability.Multimedia.Audio
1118     */
1119    write(buffer: ArrayBuffer, callback: AsyncCallback<number>): void;
1120    /**
1121     * Render audio data. This method uses a promise to return the execution result.
1122     * @since 8
1123     * @syscap SystemCapability.Multimedia.Audio
1124     */
1125    write(buffer: ArrayBuffer): Promise<number>;
1126    /**
1127     * Obtains the current timestamp. This method uses an asynchronous callback to return the execution result.
1128     * @since 8
1129     * @syscap SystemCapability.Multimedia.Audio
1130     */
1131    getAudioTime(callback: AsyncCallback<number>): void;
1132    /**
1133     * Obtains the current timestamp. This method uses a promise to return the execution result.
1134     * @since 8
1135     * @syscap SystemCapability.Multimedia.Audio
1136     */
1137    getAudioTime(): Promise<number>;
1138    /**
1139     * Drain renderer buffer. This method uses an asynchronous callback to return the execution result.
1140     * @since 8
1141     * @syscap SystemCapability.Multimedia.Audio
1142     */
1143    drain(callback: AsyncCallback<void>): void;
1144    /**
1145     * Drain renderer buffer. This method uses a promise to return the execution result.
1146     * @since 8
1147     * @syscap SystemCapability.Multimedia.Audio
1148     */
1149    drain(): Promise<void>;
1150    /**
1151     * Pauses audio rendering. This method uses an asynchronous callback to return the execution result.
1152     * @since 8
1153     * @syscap SystemCapability.Multimedia.Audio
1154     */
1155    pause(callback: AsyncCallback<void>): void;
1156    /**
1157     * Pauses audio rendering. This method uses a promise to return the execution result.
1158     * @since 8
1159     * @syscap SystemCapability.Multimedia.Audio
1160     */
1161    pause(): Promise<void>;
1162    /**
1163     * Stops audio rendering. This method uses an asynchronous callback to return the execution result.
1164     * @since 8
1165     * @syscap SystemCapability.Multimedia.Audio
1166     */
1167    stop(callback: AsyncCallback<void>): void;
1168    /**
1169     * Stops audio rendering. This method uses a promise to return the execution result.
1170     * @since 8
1171     * @syscap SystemCapability.Multimedia.Audio
1172     */
1173    stop(): Promise<void>;
1174    /**
1175     * Releases resources. This method uses an asynchronous callback to return the execution result.
1176     * @since 8
1177     * @syscap SystemCapability.Multimedia.Audio
1178     */
1179    release(callback: AsyncCallback<void>): void;
1180    /**
1181     * Releases resources. This method uses a promise to return the execution result.
1182     * @since 8
1183     * @syscap SystemCapability.Multimedia.Audio
1184     */
1185    release(): Promise<void>;
1186    /**
1187     * Obtains a reasonable minimum buffer size for renderer, however, the renderer can
1188     * accept other read sizes as well. This method uses an asynchronous callback to return the execution result.
1189     * @since 8
1190     * @syscap SystemCapability.Multimedia.Audio
1191     */
1192    getBufferSize(callback: AsyncCallback<number>): void;
1193    /**
1194     * Obtains a reasonable minimum buffer size for renderer, however, the renderer can
1195     * accept other read sizes as well. This method uses a promise to return the execution result.
1196     * @since 8
1197     * @syscap SystemCapability.Multimedia.Audio
1198     */
1199    getBufferSize(): Promise<number>;
1200    /**
1201     * Set the render rate. This method uses an asynchronous callback to return the execution result.
1202     * @since 8
1203     * @syscap SystemCapability.Multimedia.Audio
1204     */
1205    setRenderRate(rate: AudioRendererRate, callback: AsyncCallback<void>): void;
1206    /**
1207     * Set the render rate. This method uses a promise to return the execution result.
1208     * @since 8
1209     * @syscap SystemCapability.Multimedia.Audio
1210     */
1211    setRenderRate(rate: AudioRendererRate): Promise<void>;
1212    /**
1213     * Obtains the current render rate. This method uses an asynchronous callback to return the execution result.
1214     * @since 8
1215     * @syscap SystemCapability.Multimedia.Audio
1216     */
1217    getRenderRate(callback: AsyncCallback<AudioRendererRate>): void;
1218    /**
1219     * Obtains the current render rate. This method uses a promise to return the execution result.
1220     * @since 8
1221     * @syscap SystemCapability.Multimedia.Audio
1222     */
1223    getRenderRate(): Promise<AudioRendererRate>;
1224    /**
1225     * Subscribes interrupt event callback.
1226     * @param type Event type.
1227     * @return InterruptEvent callback.
1228     * @since 8
1229     * @syscap SystemCapability.Multimedia.Audio
1230     */
1231    on(type: 'interrupt', callback: Callback<InterruptEvent>): void;
1232    /**
1233     * Subscribes mark reach event callback.
1234     * @param type Event type.
1235     * @param frame Mark reach frame count.
1236     * @return Mark reach event callback.
1237     * @since 8
1238     * @syscap SystemCapability.Multimedia.Audio
1239     * @initial
1240     */
1241    on(type: "markReach", frame: number, callback: (position: number) => {}): void;
1242    /**
1243     * Unsubscribes mark reach event callback.
1244     * @since 8
1245     * @syscap SystemCapability.Multimedia.Audio
1246     * @initial
1247     */
1248    off(type: "markReach"): void;
1249    /**
1250     * Subscribes period reach event callback.
1251     * @param type Event type.
1252     * @param frame Period reach frame count.
1253     * @return Period reach event callback.
1254     * @since 8
1255     * @syscap SystemCapability.Multimedia.Audio
1256     * @initial
1257     */
1258    on(type: "periodReach", frame: number, callback: (position: number) => {}): void;
1259    /**
1260     * Unsubscribes period reach event callback.
1261     * @since 8
1262     * @syscap SystemCapability.Multimedia.Audio
1263     * @initial
1264     */
1265    off(type: "periodReach"): void;
1266    /**
1267     * Subscribes audio state change event callback.
1268     * @param type Event type.
1269     * @param callback Callback used to listen for the audio state change event.
1270     * @return AudioState
1271     * @since 8
1272     * @syscap SystemCapability.Multimedia.Audio
1273     * @initial
1274     */
1275    on(type: "stateChange", callback: Callback<AudioState>): void;
1276  }
1277
1278  /**
1279   * Enum for source type.
1280   * @since 8
1281   * @syscap SystemCapability.Multimedia.Audio
1282   */
1283  enum SourceType {
1284    /**
1285     * Invalid source type.
1286     * @since 8
1287     */
1288    SOURCE_TYPE_INVALID = -1,
1289    /**
1290     * Mic source type.
1291     * @since 8
1292     */
1293    SOURCE_TYPE_MIC = 0,
1294    /**
1295     * Voice communication source type.
1296     * @since 8
1297     */
1298    SOURCE_TYPE_VOICE_COMMUNICATION = 7
1299  }
1300
1301  /**
1302   * Interface for audio capturer info.
1303   * @since 8
1304   * @syscap SystemCapability.Multimedia.Audio
1305   */
1306  interface AudioCapturerInfo {
1307    /**
1308     * Audio source type
1309     * @since 8
1310     * @syscap SystemCapability.Multimedia.Audio
1311     */
1312    source: SourceType;
1313    /**
1314     * Audio capturer flags
1315     * @since 8
1316     * @syscap SystemCapability.Multimedia.Audio
1317     */
1318    capturerFlags: number;
1319  }
1320
1321  /**
1322   * Interface for audio capturer options.
1323   * @since 8
1324   * @syscap SystemCapability.Multimedia.Audio
1325   */
1326  interface AudioCapturerOptions {
1327    /**
1328     * Audio stream info.
1329     * @since 8
1330     * @syscap SystemCapability.Multimedia.Audio
1331     */
1332    streamInfo: AudioStreamInfo;
1333    /**
1334     * Audio capturer info.
1335     * @since 8
1336     * @syscap SystemCapability.Multimedia.Audio
1337     */
1338    capturerInfo: AudioCapturerInfo;
1339  }
1340
1341  /**
1342   * Provides functions for applications to manage audio capturing.
1343   * @since 8
1344   * @syscap SystemCapability.Multimedia.Audio
1345   */
1346  interface AudioCapturer {
1347    /**
1348     * Gets capture state.
1349     * @since 8
1350     * @syscap SystemCapability.Multimedia.Audio
1351     */
1352    readonly state: AudioState;
1353    /**
1354     * Gets audio capturer info.
1355     * @return AudioCapturerInfo value
1356     * @since 8
1357     * @syscap SystemCapability.Multimedia.Audio
1358     */
1359    getCapturerInfo(callback: AsyncCallback<AudioCapturerInfo>): void;
1360    getCapturerInfo(): Promise<AudioCapturerInfo>;
1361
1362    /**
1363     * Gets audio stream info.
1364     * @return AudioStreamInfo value
1365     * @since 8
1366     * @syscap SystemCapability.Multimedia.Audio
1367     */
1368    getStreamInfo(callback: AsyncCallback<AudioStreamInfo>): void;
1369    getStreamInfo(): Promise<AudioStreamInfo>;
1370
1371    /**
1372     * Starts audio capturing. This method uses an asynchronous callback to return the execution result.
1373     * @since 8
1374     * @syscap SystemCapability.Multimedia.Audio
1375     */
1376    start(callback: AsyncCallback<void>): void;
1377    /**
1378     * Starts audio capturing. This method uses a promise to return the execution result.
1379     * @since 8
1380     * @syscap SystemCapability.Multimedia.Audio
1381     */
1382    start(): Promise<void>;
1383
1384    /**
1385     * Capture audio data. This method uses an asynchronous callback to return the execution result.
1386     * @since 8
1387     * @syscap SystemCapability.Multimedia.Audio
1388     */
1389    read(size: number, isBlockingRead: boolean, callback: AsyncCallback<ArrayBuffer>): void;
1390    /**
1391     * Capture audio data. This method uses a promise to return the execution result.
1392     * @since 8
1393     * @syscap SystemCapability.Multimedia.Audio
1394     */
1395    read(size: number, isBlockingRead: boolean): Promise<ArrayBuffer>;
1396
1397    /**
1398     * Obtains the current timestamp. This method uses an asynchronous callback to return the execution result.
1399     * @since 8
1400     * @syscap SystemCapability.Multimedia.Audio
1401     */
1402    getAudioTime(callback: AsyncCallback<number>): void;
1403    /**
1404     * Obtains the current timestamp. This method uses a promise to return the execution result.
1405     * @since 8
1406     * @syscap SystemCapability.Multimedia.Audio
1407     */
1408    getAudioTime(): Promise<number>;
1409
1410    /**
1411     * Stops audio capturing. This method uses an asynchronous callback to return the execution result.
1412     * @since 8
1413     * @syscap SystemCapability.Multimedia.Audio
1414     */
1415    stop(callback: AsyncCallback<void>): void;
1416    /**
1417     * Stops audio capturing. This method uses a promise to return the execution result.
1418     * @since 8
1419     * @syscap SystemCapability.Multimedia.Audio
1420     */
1421    stop(): Promise<void>;
1422
1423    /**
1424     * Releases a capture resources. This method uses an asynchronous callback to return the execution result.
1425     * @since 8
1426     * @syscap SystemCapability.Multimedia.Audio
1427     */
1428    release(callback: AsyncCallback<void>): void;
1429    /**
1430     * Releases a capture resources. This method uses a promise to return the execution result.
1431     * @since 8
1432     * @syscap SystemCapability.Multimedia.Audio
1433     */
1434    release(): Promise<void>;
1435
1436    /**
1437     * Obtains a reasonable minimum buffer size for capturer, however, the capturer can
1438     * accept other read sizes as well. This method uses an asynchronous callback to return the execution result.
1439     * @since 8
1440     * @syscap SystemCapability.Multimedia.Audio
1441     */
1442    getBufferSize(callback: AsyncCallback<number>): void;
1443    /**
1444     * Obtains a reasonable minimum buffer size for capturer, however, the capturer can
1445     * accept other read sizes as well. This method uses a promise to return the execution result.
1446     * @since 8
1447     * @syscap SystemCapability.Multimedia.Audio
1448     */
1449    getBufferSize(): Promise<number>;
1450
1451    /**
1452     * Subscribes mark reach event callback.
1453     * @param type Event type.
1454     * @param frame Mark reach frame count.
1455     * @return Mark reach event callback.
1456     * @since 8
1457     * @syscap SystemCapability.Multimedia.Audio
1458     * @initial
1459     */
1460    on(type: "markReach", frame: number, callback: (position: number) => {}): void;
1461    /**
1462     * Unsubscribes mark reach event callback.
1463     * @since 8
1464     * @syscap SystemCapability.Multimedia.Audio
1465     * @initial
1466     */
1467    off(type: "markReach"): void;
1468
1469    /**
1470     * Subscribes period reach event callback.
1471     * @param type Event type.
1472     * @param frame Period reach frame count.
1473     * @return Period reach event callback.
1474     * @since 8
1475     * @syscap SystemCapability.Multimedia.Audio
1476     * @initial
1477     */
1478    on(type: "periodReach", frame: number, callback: (position: number) => {}): void;
1479    /**
1480     * Unsubscribes period reach event callback.
1481     * @since 8
1482     * @syscap SystemCapability.Multimedia.Audio
1483     * @initial
1484     */
1485    off(type: "periodReach"): void;
1486    /**
1487     * Subscribes audio state change event callback.
1488     * @param type Event type.
1489     * @param callback Callback used to listen for the audio state change event.
1490     * @return AudioState
1491     * @since 8
1492     * @syscap SystemCapability.Multimedia.Audio
1493     * @initial
1494     */
1495    on(type: "stateChange", callback: Callback<AudioState>): void;
1496
1497  }
1498
1499  /**
1500   * Enum for ringtone type.
1501   * @since 8
1502   */
1503  enum RingtoneType {
1504    /**
1505     * Default type.
1506     * @since 8
1507     */
1508    RINGTONE_TYPE_DEFAULT = 0,
1509    /**
1510     * Multi-sim type.
1511     * @since 8
1512     */
1513    RINGTONE_TYPE_MULTISIM
1514  }
1515
1516  /**
1517   * Interface for ringtone options.
1518   * @since 8
1519   */
1520  interface RingtoneOptions {
1521    /**
1522     * Ringtone volume.
1523     * @since 8
1524     */
1525    volume: number;
1526    /**
1527     * Loop value.
1528     * @since 8
1529     */
1530    loop: boolean;
1531  }
1532
1533  interface RingtonePlayer {
1534    /**
1535     * Gets render state of ringtone.
1536     * @syscap SystemCapability.Multimedia.Audio
1537     */
1538    readonly state: AudioState;
1539
1540    /**
1541     * Gets the title of ringtone.
1542     * @since 1.0
1543     */
1544    getTitle(callback: AsyncCallback<string>): void;
1545    getTitle(): Promise<string>;
1546
1547    /**
1548     * Gets audio renderer info.
1549     * @return AudioRendererInfo value
1550     * @since 1.0
1551     */
1552    getAudioRendererInfo(callback: AsyncCallback<AudioRendererInfo>): void;
1553    getAudioRendererInfo(): Promise<AudioRendererInfo>;
1554
1555    /**
1556     * Sets ringtone parameters.
1557     * @param option Set RingtoneOption for ringtone like volume & loop
1558     * @param callback Callback object to be passed along with request
1559     * @since 1.0
1560     * @version 1.0
1561     */
1562    configure(option: RingtoneOptions, callback: AsyncCallback<void>): void;
1563    configure(option: RingtoneOptions): Promise<void>;
1564    /**
1565     * Starts playing ringtone.
1566     * @param callback Callback object to be passed along with request
1567     * @since 1.0
1568     * @version 1.0
1569     */
1570    start(callback: AsyncCallback<void>): void;
1571    start(): Promise<void>;
1572    /**
1573     * Stops playing ringtone.
1574     * @param callback Callback object to be passed along with request
1575     * @since 1.0
1576     * @version 1.0
1577     */
1578    stop(callback: AsyncCallback<void>): void;
1579    stop(): Promise<void>;
1580    /**
1581     * Release ringtone player resource.
1582     * @param callback Callback object to be passed along with request
1583     * @since 1.0
1584     * @version 1.0
1585     */
1586    release(callback: AsyncCallback<void>): void;
1587    release(): Promise<void>;
1588  }
1589  function getSystemSoundManager(): SystemSoundManager;
1590  interface SystemSoundManager {
1591    /**
1592     * Sets the ringtone uri.
1593     * @param context Indicates the Context object on OHOS
1594     * @param uri Indicated which uri to be set for the tone type
1595     * @param type Indicats the type of the tone
1596     * @param callback Callback object to be passed along with request
1597     * @since 1.0
1598     * @version 1.0
1599     */
1600    setSystemRingtoneUri(context: Context, uri: string, type: RingtoneType, callback: AsyncCallback<void>): void;
1601    setSystemRingtoneUri(context: Context, uri: string, type: RingtoneType): Promise<void>;
1602    /**
1603     * Sets the ringtone uri.
1604     * @param context Indicates the Context object on OHOS
1605     * @param type Indicats the type of the tone
1606     * @param callback Callback object to be passed along with request
1607     * @return Returns uri of the ringtone
1608     * @since 1.0
1609     * @version 1.0
1610     */
1611    getSystemRingtoneUri(context: Context, type: RingtoneType, callback: AsyncCallback<string>): void;
1612    getSystemRingtoneUri(context: Context, type: RingtoneType): Promise<string>;
1613    /**
1614     * Gets the ringtone player.
1615     * @param context Indicates the Context object on OHOS
1616     * @param type Indicats the type of the tone
1617     * @param callback Callback object to be passed along with request
1618     * @return Returns ringtone player object
1619     * @since 1.0
1620     * @version 1.0
1621     */
1622    getSystemRingtonePlayer(context: Context, type: RingtoneType, callback: AsyncCallback<RingtonePlayer>): void;
1623    getSystemRingtonePlayer(context: Context, type: RingtoneType): Promise<RingtonePlayer>;
1624    /**
1625     * Sets the notification uri.
1626     * @param context Indicates the Context object on OHOS
1627     * @param uri Indicats the uri of the notification
1628     * @param callback Callback object to be passed along with request
1629     * @since 1.0
1630     * @version 1.0
1631     */
1632    setSystemNotificationUri(context: Context, uri: string, callback: AsyncCallback<void>): void;
1633    setSystemNotificationUri(context: Context, uri: string): Promise<void>;
1634    /**
1635     * Gets the notification uri.
1636     * @param context Indicates the Context object on OHOS
1637     * @param callback Callback object to be passed along with request
1638     * @return Returns the uri of the notification
1639     * @since 1.0
1640     * @version 1.0
1641     */
1642    getSystemNotificationUri(context: Context, callback: AsyncCallback<string>): void;
1643    getSystemNotificationUri(context: Context): Promise<string>;
1644    /**
1645     * Sets the alarm uri.
1646     * @param context Indicates the Context object on OHOS
1647     * @param uri Indicats the uri of the alarm
1648     * @param callback Callback object to be passed along with request
1649     * @since 1.0
1650     * @version 1.0
1651     */
1652    setSystemAlarmUri(context: Context, uri: string, callback: AsyncCallback<void>): void;
1653    setSystemAlarmUri(context: Context, uri: string): Promise<void>;
1654    /**
1655     * Gets the alarm uri.
1656     * @param context Indicates the Context object on OHOS
1657     * @param callback Callback object to be passed along with request
1658     * @return Returns the uri of the alarm
1659     * @since 1.0
1660     * @version 1.0
1661     */
1662    getSystemAlarmUri(context: Context, callback: AsyncCallback<string>): void;
1663    getSystemAlarmUri(context: Context): Promise<string>;
1664  }
1665}
1666
1667export default audio;
1668