diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index 8b0980542e330ef7c5ed5e8070665ab414c23ce1..e1fd9b4fa3ffaa72b60528ade5962665534086a8 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -197,11 +197,21 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the audio capturer instance. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback): void; + /** + * Obtains an {@link AudioCapturer} instance. This method uses an asynchronous callback to return the capturer instance. + * @param { AudioCapturerOptions } options - Capturer configurations. + * @param { AsyncCallback } callback - Callback used to return the audio capturer instance. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + function createAudioCapturerWithCallback(options: AudioCapturerOptions, callback: AsyncCallback): void; + /** * Obtains an {@link AudioCapturer} instance. * Success: This method uses a promise to return the capturer instance. @@ -219,11 +229,27 @@ declare namespace audio { * @returns { Promise } Promise used to return the audio capturer instance. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAudioCapturer(options: AudioCapturerOptions): Promise; + /** + * Obtains an {@link AudioCapturer} instance. This method uses a promise to return the capturer instance. + * @param { AudioCapturerOptions } options - Capturer configurations. + * @returns { Promise } Promise used to return the audio capturer instance. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + function createAudioCapturerReturnsPromise(options: AudioCapturerOptions): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload createAudioCapturer { createAudioCapturerWithCallback, createAudioCapturerReturnsPromise }; + /** * Obtains an {@link AudioRenderer} instance. * This method uses an asynchronous callback to return the renderer instance. @@ -3668,10 +3694,19 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the device list. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback): void; + /** + * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. + * @param { DeviceFlag } deviceFlag - Audio device flag. + * @param { AsyncCallback } callback - Callback used to return the device list. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getDevicesWithCallback(deviceFlag: DeviceFlag, callback: AsyncCallback): void; /** * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. * @param { DeviceFlag } deviceFlag - Audio device flag. @@ -3685,10 +3720,24 @@ declare namespace audio { * @returns { Promise } Promise used to return the device list. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getDevices(deviceFlag: DeviceFlag): Promise; + /** + * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. + * @param { DeviceFlag } deviceFlag - Audio device flag. + * @returns { Promise } Promise used to return the device list. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getDevicesReturnsPromise(deviceFlag: DeviceFlag): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getDevices { getDevicesWithCallback, getDevicesReturnsPromise }; /** * Obtains the audio devices with a specific flag. * @param { DeviceFlag } deviceFlag - Audio device flag. @@ -3740,11 +3789,24 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback): void; + /** + * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive + * the callback. + * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. + * @param { DeviceFlag } deviceFlag - Audio device flag. + * @param { Callback } callback - Callback used to obtain the device update details. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onDeviceChange(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback): void; + /** * UnSubscribes to device change events. * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. @@ -3766,11 +3828,22 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'deviceChange', callback?: Callback): void; + /** + * UnSubscribes to device change events. + * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. + * @param { Callback } callback - Callback used to obtain the device update details. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offDeviceChange(type: 'deviceChange', callback?: Callback): void; + /** * Obtains all the available audio devices with a specific device usage. * @param { DeviceUsage } deviceUsage - Audio device usage. @@ -3796,11 +3869,26 @@ declare namespace audio { * 2.Incorrect parameter types. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'availableDeviceChange', deviceUsage: DeviceUsage, callback: Callback): void; + /** + * Subscribes to available device change events. When a device is connected/disconnected, registered clients will receive + * the callback. + * @param { 'availableDeviceChange' } type - Type of the event to listen for. Only the availableDeviceChange event is supported. + * @param { DeviceUsage } deviceUsage - Audio device usage. + * @param { Callback } callback - Callback used to obtain the device update details. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 20 + * @arkts 1.2 + */ + onAvailableDeviceChange( + type: 'availableDeviceChange', + deviceUsage: DeviceUsage, + callback: Callback): void; + /** * UnSubscribes to available device change events. * @param { 'availableDeviceChange' } type - Type of the event to listen for. Only the availableDeviceChange event is supported. @@ -3810,11 +3898,21 @@ declare namespace audio { * 2.Incorrect parameter types. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'availableDeviceChange', callback?: Callback): void; + /** + * UnSubscribes to available device change events. + * @param { 'availableDeviceChange' } type - Type of the event to listen for. Only the availableDeviceChange event is supported. + * @param { Callback } callback - Callback used to obtain the device update details. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 20 + * @arkts 1.2 + */ + offAvailableDeviceChange(type: 'availableDeviceChange', callback?: Callback): void; + /** * Sets a device to the active state. This method uses an asynchronous callback to return the result. * @param { CommunicationDeviceType } deviceType - Audio device type. @@ -3926,21 +4024,46 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback): void; + /** + * Select the output device. This method uses an asynchronous callback to return the result. + * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @systemapi + * @since 20 + * @arkts 1.2 + */ + selectOutputDeviceWithCallback(outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback): void; /** * Select the output device. This method uses a promise to return the result. * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors): Promise; + /** + * Select the output device. This method uses a promise to return the result. + * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @systemapi + * @since 20 + * @arkts 1.2 + */ + selectOutputDeviceReturnsPromise(outputAudioDevices: AudioDeviceDescriptors): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload selectOutputDevice { selectOutputDeviceWithCallback, selectOutputDeviceReturnsPromise }; + /** * Select the output device with desired AudioRenderer. This method uses an asynchronous callback to return the result. * @param { AudioRendererFilter } filter - Filter for AudioRenderer. @@ -3948,10 +4071,25 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback): void; + + /** + * Select the output device with desired AudioRenderer. This method uses an asynchronous callback to return the result. + * @param { AudioRendererFilter } filter - Filter for AudioRenderer. + * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @systemapi + * @since 20 + * @arkts 1.2 + */ + selectOutputDeviceByFilterWithCallback( + filter: AudioRendererFilter, + outputAudioDevices: AudioDeviceDescriptors, + callback: AsyncCallback): void; + /** * Select the output device with desired AudioRenderer. This method uses a promise to return the result. * @param { AudioRendererFilter } filter - Filter for AudioRenderer. @@ -3959,32 +4097,75 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise; + /** + * Select the output device with desired AudioRenderer. This method uses a promise to return the result. + * @param { AudioRendererFilter } filter - Filter for AudioRenderer. + * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @systemapi + * @since 20 + * @arkts 1.2 + */ + selectOutputDeviceByFilterReturnsPromise(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload selectOutputDeviceByFilter { selectOutputDeviceByFilterWithCallback, selectOutputDeviceByFilterReturnsPromise }; + /** * Select the input device. This method uses an asynchronous callback to return the result. * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device description * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ selectInputDevice(inputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback): void; + + /** + * Select the input device. This method uses an asynchronous callback to return the result. + * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device description + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @systemapi + * @since 20 + * @arkts 1.2 + */ + selectInputDeviceWithCallback(inputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback): void; /** * Select the input device. This method uses a promise to return the result. * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device description * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ selectInputDevice(inputAudioDevices: AudioDeviceDescriptors): Promise; + /** + * Select the input device. This method uses a promise to return the result. + * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device description + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @systemapi + * @since 20 + * @arkts 1.2 + */ + selectInputDeviceReturnsPromise(inputAudioDevices: AudioDeviceDescriptors): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload selectInputDevice { selectInputDeviceWithCallback, selectInputDeviceReturnsPromise }; + /** * Select the input device with desired AudioCapturer. This method uses a promise to return the result. * @param { AudioCapturerFilter } filter - Filter for AudioCapturer. @@ -4022,10 +4203,23 @@ declare namespace audio { * @throws { BusinessError } 6800301 - System error. Return by callback. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo, callback: AsyncCallback): void; + /** + * Get output device for target audio renderer info. + * @param { AudioRendererInfo } rendererInfo - Audio renderer information + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. + * @throws { BusinessError } 6800301 - System error. Return by callback. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getPreferOutputDeviceForRendererInfoWithCallback( + rendererInfo: AudioRendererInfo, + callback: AsyncCallback): void; /** * Get output device for target audio renderer info. * @param { AudioRendererInfo } rendererInfo - Audio renderer information. @@ -4049,10 +4243,29 @@ declare namespace audio { * @throws { BusinessError } 6800301 - System error. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo): Promise; + /** + * Get output device for target audio renderer info. + * @param { AudioRendererInfo } rendererInfo - Audio renderer information. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. + * @throws { BusinessError } 6800301 - System error. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getPreferOutputDeviceForRendererInfoReturnsPromise( + rendererInfo: AudioRendererInfo): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getPreferOutputDeviceForRendererInfo { + getPreferOutputDeviceForRendererInfoWithCallback, + getPreferOutputDeviceForRendererInfoReturnsPromise }; /** * Gets preferred output device for target audio renderer info. @@ -4120,10 +4333,27 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'preferOutputDeviceChangeForRendererInfo', rendererInfo: AudioRendererInfo, callback: Callback): void; + + /** + * Subscribes to prefer output device change events. When prefer device for target audio renderer info changes, + * registered clients will receive the callback. + * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the + * preferOutputDeviceChangeForRendererInfo event is supported. + * @param { AudioRendererInfo } rendererInfo - Audio renderer information. + * @param { Callback } callback - Callback used to obtain the changed prefer devices information. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onPreferOutputDeviceChangeForRendererInfo( + type: 'preferOutputDeviceChangeForRendererInfo', + rendererInfo: AudioRendererInfo, + callback: Callback): void; /** * UnSubscribes to prefer output device change events. * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the @@ -4147,11 +4377,25 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'preferOutputDeviceChangeForRendererInfo', callback?: Callback): void; + /** + * UnSubscribes to prefer output device change events. + * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the + * preferOutputDeviceChangeForRendererInfo event is supported. + * @param { Callback } callback - Callback used to obtain the changed prefer devices in subscribe. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offPreferOutputDeviceChangeForRendererInfo( + type: 'preferOutputDeviceChangeForRendererInfo', + callback?: Callback): void; + /** * Get input device for target audio capturer info. * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. @@ -4175,10 +4419,23 @@ declare namespace audio { * @throws { BusinessError } 6800301 - System error. Return by callback. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo, callback: AsyncCallback): void; + /** + * Get input device for target audio capturer info. + * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. + * @throws { BusinessError } 6800301 - System error. Return by callback. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getPreferredInputDeviceForCapturerInfoWithCallback( + capturerInfo: AudioCapturerInfo, + callback: AsyncCallback): void; /** * Get input device for target audio capturer info. * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. @@ -4202,10 +4459,29 @@ declare namespace audio { * @throws { BusinessError } 6800301 - System error. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo): Promise; + /** + * Get input device for target audio capturer info. + * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. + * @throws { BusinessError } 6800301 - System error. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getPreferredInputDeviceForCapturerInfoReturnsPromise( + capturerInfo: AudioCapturerInfo): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getPreferredInputDeviceForCapturerInfo { + getPreferredInputDeviceForCapturerInfoWithCallback, + getPreferredInputDeviceForCapturerInfoReturnsPromise }; /** * Get the preferred input device for the target audio capturer filter. @@ -4245,10 +4521,25 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'preferredInputDeviceChangeForCapturerInfo', capturerInfo: AudioCapturerInfo, callback: Callback): void; + /** + * Subscribes to preferred input device change events. When preferred device for target audio capturer info changes, + * registered clients will receive the callback. + * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. + * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. + * @param { Callback } callback - Callback used to obtain the changed preferred devices information. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onPreferredInputDeviceChangeForCapturerInfo( + type: 'preferredInputDeviceChangeForCapturerInfo', + capturerInfo: AudioCapturerInfo, + callback: Callback): void; /** * Unsubscribes to preferred input device change events. * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. @@ -4270,11 +4561,24 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'preferredInputDeviceChangeForCapturerInfo', callback?: Callback): void; + /** + * Unsubscribes to preferred input device change events. + * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to obtain the changed preferred devices in subscribe. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offPreferredInputDeviceChangeForCapturerInfo( + type: 'preferredInputDeviceChangeForCapturerInfo', + callback?: Callback): void; + /** * Gets preferred input device for target audio capturer info. * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. @@ -4322,11 +4626,36 @@ declare namespace audio { * 2.Incorrect parameter types. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 + * @since 13 */ on(type: 'micBlockStatusChanged', callback: Callback): void; + /** + * Subscribes microphone blocked events. Before subscribing, users should query whether block detection is supported + * on current device. The caller will receive the callback only when it is recording and the used + * microphones' block status have changed. Currently, block detecting is only support for microphones located on + * the local device. + * @param { 'micBlockStatusChanged' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to obtain the microphone block status. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 20 + * @arkts 1.2 + */ + onMicBlockStatusChanged(type: 'micBlockStatusChanged', callback: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload on { + onDeviceChange, + onAvailableDeviceChange, + onPreferOutputDeviceChangeForRendererInfo, + onPreferredInputDeviceChangeForCapturerInfo, + onMicBlockStatusChanged + }; + /** * Unsubscribes microphone blocked events. * @param { 'microphoneBlockStatusChanged' } type - Type of the event to listen for. @@ -4336,10 +4665,32 @@ declare namespace audio { * 2.Incorrect parameter types. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 + * @since 13 + */ + off(type: 'micBlockStatusChanged', callback?: Callback): void; + + /** + * Unsubscribes microphone blocked events. + * @param { 'microphoneBlockStatusChanged' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to obtain the microphone block status. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 20 + * @arkts 1.2 + */ + offMicBlockStatusChanged(type: 'micBlockStatusChanged', callback?: Callback): void; + + /** + * @since 20 + * @arkts 1.2 */ - off(type: 'micBlockStatusChanged', callback?: Callback): void; + overload off { + offDeviceChange, + offAvailableDeviceChange, + offPreferOutputDeviceChangeForRendererInfo, + offPreferredInputDeviceChangeForCapturerInfo, + offMicBlockStatusChanged + }; /** * Exclude output devices. After calling this function successfully, audio will not be played on the specified @@ -4432,11 +4783,21 @@ declare namespace audio { * of current existing audio renderers. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getCurrentAudioRendererInfoArray(callback: AsyncCallback): void; + /** + * Get information of current existing audio renderers. + * @param { AsyncCallback } callback - Callback used to return the information + * of current existing audio renderers. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getCurrentAudioRendererInfoArrayWithCallback(callback: AsyncCallback): void; + /** * Get information of current existing audio renderers. * @returns { Promise } Promise used to return the information of current @@ -4450,11 +4811,29 @@ declare namespace audio { * existing audio renderers. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getCurrentAudioRendererInfoArray(): Promise; + /** + * Get information of current existing audio renderers. + * @returns { Promise } Promise used to return the information of current + * existing audio renderers. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getCurrentAudioRendererInfoArrayRetrunsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getCurrentAudioRendererInfoArray { + getCurrentAudioRendererInfoArrayWithCallback, + getCurrentAudioRendererInfoArrayRetrunsPromise }; + /** * Get information of current existing audio renderers. * @returns { AudioRendererChangeInfoArray } The information of current existing audio renderers. @@ -4484,11 +4863,21 @@ declare namespace audio { * of current existing audio capturers. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getCurrentAudioCapturerInfoArray(callback: AsyncCallback): void; + /** + * Get information of current existing audio capturers. + * @param { AsyncCallback } callback - Callback used to return the information + * of current existing audio capturers. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getCurrentAudioCapturerInfoArrayWithCallback(callback: AsyncCallback): void; + /** * Get information of current existing audio capturers. * @returns { Promise } Promise used to return the information of current existing @@ -4502,11 +4891,29 @@ declare namespace audio { * audio capturers. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getCurrentAudioCapturerInfoArray(): Promise; + /** + * Get information of current existing audio capturers. + * @returns { Promise } Promise used to return the information of current existing + * audio capturers. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getCurrentAudioCapturerInfoArrayReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getCurrentAudioCapturerInfoArray { + getCurrentAudioCapturerInfoArrayWithCallback, + getCurrentAudioCapturerInfoArrayReturnsPromise }; + /** * Get information of current existing audio capturers. * @returns { AudioCapturerChangeInfoArray } The information of current existing audio capturers. @@ -4588,11 +4995,23 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'audioRendererChange', callback: Callback): void; + /** + * Listens for audio renderer change events. When there is any audio renderer change, + * registered clients will receive the callback. + * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. + * @param { Callback } callback - Callback invoked for the audio renderer change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onAudioRendererChange(type: 'audioRendererChange', callback: Callback): void; + /** * UnSubscribes to audio renderer change events. * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. @@ -4621,11 +5040,22 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'audioRendererChange', callback?: Callback): void; + /** + * Unsubscribes to audio renderer change events. + * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. + * @param { Callback } callback - Callback invoked for the audio renderer change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offAudioRendererChange(type: 'audioRendererChange', callback?: Callback): void; + /** * Listens for audio capturer change events. When there is any audio capturer change, * registered clients will receive the callback. @@ -4649,11 +5079,29 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'audioCapturerChange', callback: Callback): void; + /** + * Listens for audio capturer change events. When there is any audio capturer change, + * registered clients will receive the callback. + * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. + * @param { Callback } callback - Callback invoked for the audio capturer change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onAudioCapturerChange(type: 'audioCapturerChange', callback: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload on { onAudioRendererChange, onAudioCapturerChange }; + /** * UnSubscribes to audio capturer change events. * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. @@ -4682,11 +5130,28 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'audioCapturerChange', callback?: Callback): void; + /** + * Unsubscribes to audio capturer change events. + * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. + * @param { Callback } callback - Callback invoked for the audio capturer change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offAudioCapturerChange(type: 'audioCapturerChange', callback?: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload off { offAudioRendererChange, offAudioCapturerChange }; + /** * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -4702,12 +5167,24 @@ declare namespace audio { * The value true means that the stream is active, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioStreamManager#isStreamActive - * @arkts 1.1&1.2 */ isActive(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the active status of the stream. + * The value true means that the stream is active, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioStreamManager#isStreamActive + * @arkts 1.2 + */ + isActiveWithCallback(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Checks whether a stream is active. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -4723,12 +5200,29 @@ declare namespace audio { * true means that the stream is active, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioStreamManager#isStreamActive - * @arkts 1.1&1.2 */ isActive(volumeType: AudioVolumeType): Promise; + /** + * Checks whether a stream is active. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the active status of the stream. The value + * true means that the stream is active, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioStreamManager#isStreamActive + * @arkts 1.2 + */ + isActiveReturnsPromise(volumeType: AudioVolumeType): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload isActive { isActiveWithCallback, isActiveReturnsPromise }; /** * Checks whether a stream is active. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -5060,10 +5554,19 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getVolumeGroupManager(groupId: int, callback: AsyncCallback): void; + /** + * Obtains an AudioVolumeGroupManager instance. This method uses an asynchronous callback to return the result. + * @param { int } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getVolumeGroupManagerWithCallback(groupId: int, callback: AsyncCallback): void; /** * Obtains an AudioVolumeGroupManager instance. This method uses a promise to return the result. * @param { int } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default @@ -5077,18 +5580,35 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getVolumeGroupManager(groupId: int): Promise; /** - * Obtains an AudioVolumeGroupManager instance. - * @param { int } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default - * @returns { AudioVolumeGroupManager } The audio volume group manager instance. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. - * @throws { BusinessError } 6800101 - Parameter verification failed. + * Obtains an AudioVolumeGroupManager instance. This method uses a promise to return the result. + * @param { int } groupId - volume group id, use {@link DEFAULT_VOLUME_GROUP_ID} in default + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getVolumeGroupManagerReturnsPromise(groupId: int): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getVolumeGroupManager { + getVolumeGroupManagerWithCallback, + getVolumeGroupManagerReturnsPromise + }; + /** + * Obtains an AudioVolumeGroupManager instance. + * @param { int } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default + * @returns { AudioVolumeGroupManager } The audio volume group manager instance. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ @@ -5222,13 +5742,29 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioVolumeManager#event:streamVolumeChange - * @arkts 1.1&1.2 */ on(type: 'volumeChange', callback: Callback): void; + /** + * Listens for system volume change events. This method uses a callback to get volume change events. + * @param { 'volumeChange' } type - Type of the event to listen for. Only the volumeChange event is supported. + * @param { Callback } callback - Callback used to get the system volume change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#event:streamVolumeChange + * @arkts 1.2 + */ + onVolumeChange(type: 'volumeChange', callback: Callback): void; + /** * Unsubscribes to the volume change events.. * @param { 'volumeChange' } type - Type of the event to be unregistered. Only the volumeChange event is supported. @@ -5238,13 +5774,28 @@ declare namespace audio { * 2.Incorrect parameter types. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioVolumeManager#event:streamVolumeChange - * @arkts 1.1&1.2 */ off(type: 'volumeChange', callback?: Callback): void; + /** + * Unsubscribes to the volume change events.. + * @param { 'volumeChange' } type - Type of the event to be unregistered. Only the volumeChange event is supported. + * @param { Callback } callback - Callback used to obtain the invoking volume change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters missing; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#event:streamVolumeChange + * @arkts 1.2 + */ + offVolumeChange(type: 'volumeChange', callback?: Callback): void; + /** * Listens for specified app volume change events. * The app volume may changed by {@link setAppVolumePercentageForUid}. @@ -5258,11 +5809,28 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi - * @since arkts {'1.1':'19','1.2':'20'} - * @arkts 1.1&1.2 + * @since 19 */ on(type: 'appVolumeChangeForUid', uid: int, callback: Callback): void; + /** + * Listens for specified app volume change events. + * The app volume may changed by {@link setAppVolumePercentageForUid}. + * @permission ohos.permission.MANAGE_AUDIO_CONFIG + * @param { 'appVolumeChangeForUid' } type - Type of the event to listen for. Only the + * appVolumeChangeForUid event is supported. + * @param { int } uid - The app's uid. + * @param { Callback } callback - Callback used to get the app volume change event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + * @since 20 + * @arkts 1.2 + */ + onAppVolumeChangeForUid(type: 'appVolumeChangeForUid', uid: int, callback: Callback): void; + /** * Unsubscribes to the app volume change events.. * @permission ohos.permission.MANAGE_AUDIO_CONFIG @@ -5274,11 +5842,26 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi - * @since arkts {'1.1':'19','1.2':'20'} - * @arkts 1.1&1.2 + * @since 19 */ off(type: 'appVolumeChangeForUid', callback?: Callback): void; + /** + * Unsubscribes to the app volume change events.. + * @permission ohos.permission.MANAGE_AUDIO_CONFIG + * @param { 'appVolumeChangeForUid' } type - Type of the event to be unregistered. Only the appVolumeChangeForUid + * event is supported. + * @param { Callback } callback - Callback used to obtain the invoking volume change event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + * @since 20 + * @arkts 1.2 + */ + offAppVolumeChangeForUid(type: 'appVolumeChangeForUid', callback?: Callback): void; + /** * Listens for app volume change events. The app volume may changed by your called {@link setAppVolumePercentage} * or other system settings. @@ -5286,11 +5869,28 @@ declare namespace audio { * @param { Callback } callback - Callback used to get the app volume change event. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume - * @since arkts {'1.1':'19','1.2':'20'} - * @arkts 1.1&1.2 + * @since 19 */ on(type: 'appVolumeChange', callback: Callback): void; + /** + * Listens for app volume change events. The app volume may changed by your called {@link setAppVolumePercentage} + * or other system settings. + * @param { 'appVolumeChange' } type - Type of the event to listen for. Only the appVolumeChange event is supported. + * @param { Callback } callback - Callback used to get the app volume change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 20 + * @arkts 1.2 + */ + onAppVolumeChange(type: 'appVolumeChange', callback: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload on { onVolumeChange, onAppVolumeChangeForUid, onAppVolumeChange }; + /** * Unsubscribes to the app volume change events.. * @param { 'appVolumeChange' } type - Type of the event to be unregistered. Only the appVolumeChange event @@ -5298,11 +5898,28 @@ declare namespace audio { * @param { Callback } callback - Callback used to obtain the invoking volume change event. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume - * @since arkts {'1.1':'19','1.2':'20'} - * @arkts 1.1&1.2 + * @since 19 */ off(type: 'appVolumeChange', callback?: Callback): void; + /** + * Unsubscribes to the app volume change events.. + * @param { 'appVolumeChange' } type - Type of the event to be unregistered. Only the appVolumeChange event + * is supported. + * @param { Callback } callback - Callback used to obtain the invoking volume change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 20 + * @arkts 1.2 + */ + offAppVolumeChange(type: 'appVolumeChange', callback?: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload off { offVolumeChange, offAppVolumeChangeForUid, offAppVolumeChange }; + /** * Subscribes to active volume type changes. * @param { 'activeVolumeTypeChange' } type - Type of the event to listen for. @@ -5552,10 +6169,23 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ setVolume(volumeType: AudioVolumeType, volume: int, callback: AsyncCallback): void; + + /** + * Sets the volume for a stream. This method uses an asynchronous callback to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { int } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + * @since 20 + * @arkts 1.2 + */ + setVolumeWithCallback(volumeType: AudioVolumeType, volume: int, callback: AsyncCallback): void; + /** * Sets the volume for a stream. This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -5564,11 +6194,29 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ setVolume(volumeType: AudioVolumeType, volume: int): Promise; + /** + * Sets the volume for a stream. This method uses a promise to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { int } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + * @since 20 + * @arkts 1.2 + */ + setVolumeReturnsPromise(volumeType: AudioVolumeType, volume: int): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload setVolume { setVolumeWithCallback, setVolumeReturnsPromise }; + /** * Sets the volume for a stream. This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -5615,12 +6263,23 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioVolumeManager#getVolumeByStream - * @arkts 1.1&1.2 */ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Obtains the volume of a volume type. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @param { AsyncCallback } callback - Callback used to return the volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#getVolumeByStream + * @arkts 1.2 + */ + getVolumeWithCallback(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the volume of a stream. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -5634,12 +6293,28 @@ declare namespace audio { * @returns { Promise } Promise used to return the volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioVolumeManager#getVolumeByStream - * @arkts 1.1&1.2 */ getVolume(volumeType: AudioVolumeType): Promise; + /** + * Obtains the volume of a volume type. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @returns { Promise } Promise used to return the volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#getVolumeByStream + * @arkts 1.2 + */ + getVolumeReturnsPromise(volumeType: AudioVolumeType): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getVolume { getVolumeWithCallback, getVolumeReturnsPromise }; /** * Obtains the volume of a stream. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -5681,12 +6356,23 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the minimum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioVolumeManager#getMinVolumeByStream - * @arkts 1.1&1.2 */ getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Obtains the minimum volume allowed for a volume type. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @param { AsyncCallback } callback - Callback used to return the minimum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#getMinVolumeByStream + * @arkts 1.2 + */ + getMinVolumeWithCallback(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -5700,12 +6386,28 @@ declare namespace audio { * @returns { Promise } Promise used to return the minimum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioVolumeManager#getMinVolumeByStream - * @arkts 1.1&1.2 */ getMinVolume(volumeType: AudioVolumeType): Promise; + /** + * Obtains the minimum volume allowed for a volume type. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @returns { Promise } Promise used to return the minimum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#getMinVolumeByStream + * @arkts 1.2 + */ + getMinVolumeReturnsPromise(volumeType: AudioVolumeType): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getMinVolume { getMinVolumeWithCallback, getMinVolumeReturnsPromise }; /** * Obtains the minimum volume allowed for a stream. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -5747,12 +6449,23 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the maximum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioVolumeManager#getMaxVolumeByStream - * @arkts 1.1&1.2 */ getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Obtains the maximum volume allowed for a volume type. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @param { AsyncCallback } callback - Callback used to return the maximum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#getMaxVolumeByStream + * @arkts 1.2 + */ + getMaxVolumeWithCallback(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -5766,12 +6479,28 @@ declare namespace audio { * @returns { Promise } Promise used to return the maximum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioVolumeManager#getMaxVolumeByStream - * @arkts 1.1&1.2 */ getMaxVolume(volumeType: AudioVolumeType): Promise; + /** + * Obtains the maximum volume allowed for a volume type. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @returns { Promise } Promise used to return the maximum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#getMaxVolumeByStream + * @arkts 1.2 + */ + getMaxVolumeReturnsPromise(volumeType: AudioVolumeType): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getMaxVolume { getMaxVolumeWithCallback, getMaxVolumeReturnsPromise }; /** * Obtains the maximum volume allowed for a stream. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -5808,10 +6537,32 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + */ + mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; + /** + * Mutes a stream. This method uses an asynchronous callback to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + * @since 20 + * @arkts 1.2 + */ + muteWithCallback(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; + /** + * Mutes a stream. This method uses a promise to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + * @since 9 */ - mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; + mute(volumeType: AudioVolumeType, mute: boolean): Promise; /** * Mutes a stream. This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -5820,10 +6571,15 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 */ - mute(volumeType: AudioVolumeType, mute: boolean): Promise; + muteReturnsPromise(volumeType: AudioVolumeType, mute: boolean): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload mute { muteWithCallback, muteReturnsPromise }; /** * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. @@ -5840,12 +6596,24 @@ declare namespace audio { * value true means that the volume type is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioVolumeManager#isSystemMutedForStream - * @arkts 1.1&1.2 */ isMute(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Checks whether a volume type is muted. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @param { AsyncCallback } callback - Callback used to return the mute status of the volume type. The + * value true means that the volume type is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#isSystemMutedForStream + * @arkts 1.2 + */ + isMuteWithCallback(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Checks whether a stream is muted. This method uses a promise to return the result. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -5861,12 +6629,29 @@ declare namespace audio { * means that the volume type is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @deprecated since 20 * @useinstead ohos.multimedia.audio.AudioVolumeManager#isSystemMutedForStream - * @arkts 1.1&1.2 */ isMute(volumeType: AudioVolumeType): Promise; + /** + * Checks whether a volume type is muted. This method uses a promise to return the result. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @returns { Promise } Promise used to return the mute status of the volume type. The value true + * means that the volume type is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @deprecated since 20 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#isSystemMutedForStream + * @arkts 1.2 + */ + isMuteReturnsPromise(volumeType: AudioVolumeType): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload isMute { isMuteWithCallback, isMuteReturnsPromise }; /** * Checks whether a stream is muted. * @param { AudioVolumeType } volumeType - Audio stream type. @@ -5904,10 +6689,22 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ setRingerMode(mode: AudioRingMode, callback: AsyncCallback): void; + + /** + * Sets the ringer mode. This method uses an asynchronous callback to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { AudioRingMode } mode - Ringer mode. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + * @since 20 + * @arkts 1.2 + */ + setRingerModeWithCallback(mode: AudioRingMode, callback: AsyncCallback): void; + /** * Sets the ringer mode. This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -5915,11 +6712,28 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ setRingerMode(mode: AudioRingMode): Promise; + /** + * Sets the ringer mode. This method uses a promise to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { AudioRingMode } mode - Ringer mode. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + * @since 20 + * @arkts 1.2 + */ + setRingerModeReturnsPromise(mode: AudioRingMode): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload setRingerMode { setRingerModeWithCallback, setRingerModeReturnsPromise }; + /** * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. * @param { AsyncCallback } callback - Callback used to return the ringer mode. @@ -5931,10 +6745,18 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the ringer mode. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getRingerMode(callback: AsyncCallback): void; + /** + * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. + * @param { AsyncCallback } callback - Callback used to return the ringer mode. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getRingerModeWithCallback(callback: AsyncCallback): void; /** * Obtains the ringer mode. This method uses a promise to return the query result. * @returns { Promise } Promise used to return the ringer mode. @@ -5946,10 +6768,23 @@ declare namespace audio { * @returns { Promise } Promise used to return the ringer mode. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getRingerMode(): Promise; + /** + * Obtains the ringer mode. This method uses a promise to return the query result. + * @returns { Promise } Promise used to return the ringer mode. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getRingerModeReturnsPromise(): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getRingerMode { getRingerModeWithCallback, getRingerModeReturnsPromise }; /** * Obtains the ringer mode. * @returns { AudioRingMode } Current ringer mode. @@ -5975,22 +6810,42 @@ declare namespace audio { * 2.Incorrect parameter types. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ on(type: 'ringerModeChange', callback: Callback): void; + /** + * Listens for ringer mode change events. This method uses a callback to get ringer mode changes. + * @param { 'ringerModeChange' } type - Type of the event to listen for. Only the ringerModeChange event is supported. + * @param { Callback } callback - Callback used to get the updated ringer mode. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 20 + * @arkts 1.2 + */ + onRingerModeChange(type: 'ringerModeChange', callback: Callback): void; + /** * Unsubscribes to the ringer mode state change events. * @param { 'ringerModeChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to get the updated ringer mode. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'ringerModeChange', callback?: Callback): void; + /** + * Unsubscribes to the ringer mode state change events. + * @param { 'ringerModeChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to get the updated ringer mode. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 20 + * @arkts 1.2 + */ + offRingerModeChange(type: 'ringerModeChange', callback?: Callback): void; + /** * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. * @permission ohos.permission.MANAGE_AUDIO_CONFIG @@ -6079,10 +6934,19 @@ declare namespace audio { * true means that the microphone is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ isMicrophoneMute(callback: AsyncCallback): void; + /** + * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. + * @param { AsyncCallback } callback - used to return the mute status of the microphone. The value + * true means that the microphone is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + isMicrophoneMuteWithCallback(callback: AsyncCallback): void; /** * Checks whether the microphone is muted. This method uses a promise to return the query result. * @returns { Promise } Promise used to return the mute status of the microphone. The value true @@ -6096,10 +6960,24 @@ declare namespace audio { * means that the microphone is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ isMicrophoneMute(): Promise; + /** + * Checks whether the microphone is muted. This method uses a promise to return the query result. + * @returns { Promise } Promise used to return the mute status of the microphone. The value true + * means that the microphone is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @crossplatform + * @since 12 + * @arkts 1.2 + */ + isMicrophoneMuteReturnsPromise(): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload isMicrophoneMute { isMicrophoneMuteWithCallback, isMicrophoneMuteReturnsPromise }; /** * Checks whether the microphone is muted. * @returns { boolean } The mute status of the microphone. The value true @@ -6127,11 +7005,27 @@ declare namespace audio { * 2.Incorrect parameter types. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ on(type: 'micStateChange', callback: Callback): void; + /** + * Listens for system microphone state change events. This method uses a callback to get microphone change events. + * @param { 'micStateChange' } type - Type of the event to listen for. Only the micStateChange event is supported. + * @param { Callback } callback - Callback used to get the system microphone state change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 20 + * @arkts 1.2 + */ + onMicStateChange(type: 'micStateChange', callback: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload on { onRingerModeChange, onMicStateChange }; + /** * Unsubscribes to the microphone state change events. * @param { 'micStateChange' } type - Type of the event to listen for. @@ -6141,11 +7035,27 @@ declare namespace audio { * 2.Incorrect parameter types. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Volume - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'micStateChange', callback?: Callback): void; + /** + * Unsubscribes to the microphone state change events. + * @param { 'micStateChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to get the system microphone state change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 20 + * @arkts 1.2 + */ + offMicStateChange(type: 'micStateChange', callback?: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload off { offRingerModeChange, offMicStateChange }; + /** * Gets if this volume group is volume unadjustable. * @returns { boolean } Whether it is volume unadjustable. @@ -6176,10 +7086,25 @@ declare namespace audio { * @throws { BusinessError } 6800301 - System error. Return by callback. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ adjustVolumeByStep(adjustType: VolumeAdjustType, callback: AsyncCallback): void; + + /** + * Adjusts system volume by step, volume type is decided by system. + * This method uses an asynchronous callback to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { VolumeAdjustType } adjustType - Volume adjustment type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. + * @throws { BusinessError } 6800301 - System error. Return by callback. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + * @since 20 + * @arkts 1.2 + */ + adjustVolumeByStepWithCallback(adjustType: VolumeAdjustType, callback: AsyncCallback): void; /** * Adjusts system volume by step, volume type is decided by system. * This method uses a promise to return the result. @@ -6194,11 +7119,32 @@ declare namespace audio { * @throws { BusinessError } 6800301 - System error. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ adjustVolumeByStep(adjustType: VolumeAdjustType): Promise; + /** + * Adjusts system volume by step, volume type is decided by system. + * This method uses a promise to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { VolumeAdjustType } adjustType - Volume adjustment type. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. + * @throws { BusinessError } 6800301 - System error. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + * @since 20 + * @arkts 1.2 + */ + adjustVolumeByStepReturnsPromise(adjustType: VolumeAdjustType): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload adjustVolumeByStep { adjustVolumeByStepWithCallback, adjustVolumeByStepReturnsPromise }; + /** * Adjusts system volume by step for target volume type. * This method uses an asynchronous callback to return the result. @@ -6574,11 +7520,26 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'spatializationEnabledChangeForAnyDevice', callback: Callback): void; + /** + * Subscribes to the spatialization enable state change events by the specified device. + * When the spatialization enable state changes, registered clients will receive the callback. + * @param { 'spatializationEnabledChangeForAnyDevice' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to get the spatialization enable state by the specified device. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Spatialization + * @systemapi + * @since 20 + * @arkts 1.2 + */ + onSpatializationEnabledChangeForAnyDevice( + type: 'spatializationEnabledChangeForAnyDevice', + callback: Callback): void; + /** * Unsubscribes to the spatialization enable state change events. * @param { 'spatializationEnabledChange' } type - Type of the event to listen for. @@ -6606,11 +7567,23 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'spatializationEnabledChangeForAnyDevice', callback?: Callback): void; + /** + * Unsubscribes to the spatialization enable state change events by the specified device. + * @param { 'spatializationEnabledChangeForAnyDevice' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to get the spatialization enable state by the specified device. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Spatialization + * @systemapi + * @since 20 + * @arkts 1.2 + */ + offSpatializationEnabledChangeForAnyDevice(type: 'spatializationEnabledChangeForAnyDevice', callback?: Callback): void; + /** * Sets the head tracking enabled or disabled. This method uses an asynchronous callback to return the result. * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS @@ -6709,23 +7682,38 @@ declare namespace audio { * @deprecated since 12 * @useinstead ohos.multimedia.audio.AudioSpatializationManager#on */ - on(type: 'headTrackingEnabledChange', callback: Callback): void; + on(type: 'headTrackingEnabledChange', callback: Callback): void; + /** + * Subscribes to the head tracking enable state change events by the specified device. + * When the head tracking enable state changes, registered clients will receive the callback. + * @param { 'headTrackingEnabledChangeForAnyDevice' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to get the head tracking enable state by the specified device. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Spatialization + * @systemapi + * @since 12 + */ + on(type: 'headTrackingEnabledChangeForAnyDevice', callback: Callback): void; + /** * Subscribes to the head tracking enable state change events by the specified device. * When the head tracking enable state changes, registered clients will receive the callback. * @param { 'headTrackingEnabledChangeForAnyDevice' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to get the head tracking enable state by the specified device. * @throws { BusinessError } 202 - Not system App. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 */ - on(type: 'headTrackingEnabledChangeForAnyDevice', callback: Callback): void; + onHeadTrackingEnabledChangeForAnyDevice( + type: 'headTrackingEnabledChangeForAnyDevice', + callback: Callback): void; /** * Unsubscribes to the head tracking enable state change events. @@ -6754,11 +7742,23 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'headTrackingEnabledChangeForAnyDevice', callback?: Callback): void; + /** + * Unsubscribes to the head tracking enable state change events by the specified device. + * @param { 'headTrackingEnabledChangeForAnyDevice' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to get the head tracking enable state by the specified device. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Spatialization + * @systemapi + * @since 20 + * @arkts 1.2 + */ + offHeadTrackingEnabledChangeForAnyDevice(type: 'headTrackingEnabledChangeForAnyDevice', callback?: Callback): void; + /** * Updates the spatial device state. * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS @@ -6820,21 +7820,66 @@ declare namespace audio { * @param { Callback } callback - Callback used to get the spatialization enable state. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Spatialization - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ on(type: 'spatializationEnabledChangeForCurrentDevice', callback: Callback): void; + /** + * Subscribes to the spatialization enable state change events by the current device. + * When the spatialization enable state changes, registered clients will receive the callback. + * @param { 'spatializationEnabledChangeForCurrentDevice' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to get the spatialization enable state. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Spatialization + * @since 20 + * @arkts 1.2 + */ + onSpatializationEnabledChangeForCurrentDevice( + type: 'spatializationEnabledChangeForCurrentDevice', + callback: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload on { + onSpatializationEnabledChangeForAnyDevice, + onHeadTrackingEnabledChangeForAnyDevice, + onSpatializationEnabledChangeForCurrentDevice + }; + /** * Unsubscribes to the spatialization enable state change events by the current device. * @param { 'spatializationEnabledChangeForCurrentDevice' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to get the spatialization enable state. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Spatialization - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'spatializationEnabledChangeForCurrentDevice', callback?: Callback): void; + + /** + * Unsubscribes to the spatialization enable state change events by the current device. + * @param { 'spatializationEnabledChangeForCurrentDevice' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to get the spatialization enable state. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Spatialization + * @since 20 + * @arkts 1.2 + */ + offSpatializationEnabledChangeForCurrentDevice( + type: 'spatializationEnabledChangeForCurrentDevice', + callback?: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload off { + offSpatializationEnabledChangeForAnyDevice, + offHeadTrackingEnabledChangeForAnyDevice, + offSpatializationEnabledChangeForCurrentDevice + }; } /** @@ -8332,10 +9377,20 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ start(callback: AsyncCallback): void; + + /** + * Starts the renderer. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + startWithCallback(callback: AsyncCallback): void; + /** * Starts the renderer. * Success: This method uses a promise to return the result. @@ -8350,11 +9405,26 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ start(): Promise; + /** + * Starts the renderer. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + startReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload start { startWithCallback, startReturnsPromise }; + /** * Writes the buffer. This method uses an asynchronous callback to return the result. * @param { ArrayBuffer } buffer - Buffer to be written. @@ -8544,10 +9614,20 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ stop(callback: AsyncCallback): void; + + /** + * Stops rendering. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + stopWithCallback(callback: AsyncCallback): void; + /** * Stops rendering. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. @@ -8559,11 +9639,26 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ stop(): Promise; + /** + * Stops rendering. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + stopReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload stop { stopWithCallback, stopReturnsPromise }; + /** * Releases the renderer. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. @@ -8580,10 +9675,24 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ release(callback: AsyncCallback): void; + + /** + * Releases the renderer. This method uses an asynchronous callback to return the result. + *

NOTE: + * The framework will not actively release audio streams in the Stop/Pause state. + * Please make sure to call this method to release the stream when it is no longer needed. + *

+ * + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + releaseWithCallback(callback: AsyncCallback): void; /** * Releases the renderer. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. @@ -8600,11 +9709,31 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ release(): Promise; + /** + * Releases the renderer. This method uses a promise to return the result. + *

NOTE: + * The framework will not actively release audio streams in the Stop/Pause state. + * Please make sure to call this method to release the stream when it is no longer needed. + *

+ * + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + releaseReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload release { releaseWithCallback, releaseReturnsPromise }; + /** * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses an asynchronous callback to * return the result. @@ -8618,10 +9747,19 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the buffer size. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getBufferSize(callback: AsyncCallback): void; + /** + * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses an asynchronous callback to + * return the result. + * @param { AsyncCallback } callback - Callback used to return the buffer size. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 12 + * @arkts 1.2 + */ + getBufferSizeWithCallback(callback: AsyncCallback): void; /** * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses a promise to return the result. * @returns { Promise } Promise used to return the buffer size. @@ -8633,10 +9771,23 @@ declare namespace audio { * @returns { Promise } Promise used to return the buffer size. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getBufferSize(): Promise; + /** + * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the buffer size. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getBufferSizeReturnsPromise(): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getBufferSize { getBufferSizeWithCallback, getBufferSizeReturnsPromise }; /** * Obtains a reasonable minimum buffer size in bytes for rendering. * @returns { long } The audio buffer size. @@ -8816,10 +9967,20 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setVolume(volume: double, callback: AsyncCallback): void; + + /** + * Sets the volume for this stream. This method uses an asynchronous callback to return the result. + * @param { double } volume - Volume to set. The value type is float, form 0.0 to 1.0. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + setVolumeWithCallback(volume: double, callback: AsyncCallback): void; /** * Sets the volume for a stream. This method uses a promise to return the result. * @param { double } volume - Volume to set. The value type is float, form 0.0 to 1.0. @@ -8833,11 +9994,27 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setVolume(volume: double): Promise; + /** + * Sets the volume for a stream. This method uses a promise to return the result. + * @param { double } volume - Volume to set. The value type is float, form 0.0 to 1.0. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + setVolumeReturnsPromise(volume: double): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload setVolume { setVolumeWithCallback, setVolumeReturnsPromise }; + /** * Gets volume of this stream. * @returns { double } Returns one float value. @@ -9178,22 +10355,47 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'audioInterrupt', callback: Callback): void; + /** + * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is + * triggered when audio playback is interrupted. + * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. + * @param { Callback } callback - Callback used to listen for interrupt callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onAudioInterrupt(type: 'audioInterrupt', callback: Callback): void; + /** * Unsubscribes audio interrupt events. * @param { 'audioInterrupt' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to listen for interrupt callback. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Interrupt - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'audioInterrupt', callback?: Callback): void; + /** + * Unsubscribes audio interrupt events. + * @param { 'audioInterrupt' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen for interrupt callback. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 20 + * @arkts 1.2 + */ + offAudioInterrupt(type: 'audioInterrupt', callback?: Callback): void; + /** * Subscribes to mark reached events. When the number of frames rendered reaches the value of the frame parameter, * the callback is invoked. @@ -9216,10 +10418,27 @@ declare namespace audio { * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'markReach', frame: long, callback: Callback): void; + /** + * Subscribes to mark reached events. When the number of frames rendered reaches the value of the frame parameter, + * the callback is invoked. + *

NOTE: + * Before renderer release, the value of internal records frames will continue to increase, + * and operations such as stop/pause/flush/drain will not reset this value. + *

+ * + * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. + * @param { long } frame - Number of frames to trigger the event. The value must be greater than 0. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onMarkReach(type: 'markReach', frame: long, callback: Callback): void; + /** * Unsubscribes from mark reached events. * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. @@ -9239,10 +10458,20 @@ declare namespace audio { * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 + */ + off(type: 'markReach', callback?: Callback): void; + + /** + * Unsubscribes from mark reached events. + * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 */ - off(type: 'markReach', callback?: Callback): void; + offMarkReach(type: 'markReach', callback?: Callback): void; /** * Subscribes to period reached events. When the period of frame rendering reaches the value of frame parameter, @@ -9261,10 +10490,22 @@ declare namespace audio { * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'periodReach', frame: long, callback: Callback): void; + /** + * Subscribes to period reached events. When the period of frame rendering reaches the value of frame parameter, + * the callback is invoked. + * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. + * @param { long } frame - Period during which frame rendering is listened. The value must be greater than 0. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onPeriodReach(type: 'periodReach', frame: long, callback: Callback): void; + /** * Unsubscribes from period reached events. * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. @@ -9284,11 +10525,21 @@ declare namespace audio { * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'periodReach', callback?: Callback): void; + /** + * Unsubscribes from period reached events. + * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offPeriodReach(type: 'periodReach', callback?: Callback): void; + /** * Subscribes audio state change event callback. * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. @@ -9302,22 +10553,42 @@ declare namespace audio { * @param { Callback } callback - Callback invoked when state change. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'stateChange', callback: Callback): void; + /** + * Subscribes audio renderer state change event callback. + * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. + * @param { Callback } callback - Callback invoked when state change. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onStateChange(type: 'stateChange', callback: Callback): void; + /** * Unsubscribes audio state change event callback. * @param { 'stateChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback invoked when state change. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Renderer - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'stateChange', callback?: Callback): void; + /** + * Unsubscribes audio state change event callback. + * @param { 'stateChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback invoked when state change. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 20 + * @arkts 1.2 + */ + offStateChange(type: 'stateChange', callback?: Callback): void; + /** * Subscribes output device change event callback. * The event is triggered when output device change for this stream. @@ -9341,11 +10612,23 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'outputDeviceChange', callback: Callback): void; + /** + * Subscribes output device change event callback. + * The event is triggered when output device change for this stream. + * @param { 'outputDeviceChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onOutputDeviceChange(type: 'outputDeviceChange', callback: Callback): void; + /** * Subscribes output device change event callback. * The event is triggered when output device change for this stream. @@ -9369,11 +10652,25 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'outputDeviceChangeWithInfo', callback: Callback): void; + /** + * Subscribes output device change event callback. + * The event is triggered when output device change for this stream. + * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onOutputDeviceChangeWithInfo( + type: 'outputDeviceChangeWithInfo', + callback: Callback): void; + /** * Unsubscribes output device change event callback. * @param { 'outputDeviceChange' } type - Type of the event to listen for. @@ -9395,11 +10692,22 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'outputDeviceChange', callback?: Callback): void; + /** + * Unsubscribes output device change event callback. + * @param { 'outputDeviceChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offOutputDeviceChange(type: 'outputDeviceChange', callback?: Callback): void; + /** * Unsubscribes output device change event callback. * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. @@ -9421,11 +10729,22 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'outputDeviceChangeWithInfo', callback?: Callback): void; + /** + * Unsubscribes output device change event callback. + * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offOutputDeviceChangeWithInfo(type: 'outputDeviceChangeWithInfo', callback?: Callback): void; + /** * Subscribes audio data callback. * The event is triggered when audio buffer is available for writing more data. @@ -9449,11 +10768,37 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'writeData', callback: AudioRendererWriteDataCallback): void; + /** + * Subscribes audio data callback. + * The event is triggered when audio buffer is available for writing more data. + * @param { 'writeData' } type - Type of the event to listen for. + * @param { AudioRendererWriteDataCallback } callback - Audio renderer write data callback. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onWriteData(type: 'writeData', callback: AudioRendererWriteDataCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload on { + onAudioInterrupt, + onMarkReach, + onPeriodReach, + onStateChange, + onOutputDeviceChange, + onOutputDeviceChangeWithInfo, + onWriteData + }; + /** * Unsubscribes audio data callback. * @param { 'writeData' } type - Type of the event to listen for. @@ -9475,10 +10820,35 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'writeData', callback?: AudioRendererWriteDataCallback): void; + + /** + * Unsubscribes audio data callback. + * @param { 'writeData' } type - Type of the event to listen for. + * @param { AudioRendererWriteDataCallback } callback - Audio renderer write data callback. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offWriteData(type: 'writeData', callback?: AudioRendererWriteDataCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload off { + offAudioInterrupt, + offMarkReach, + offPeriodReach, + offStateChange, + offOutputDeviceChange, + offOutputDeviceChangeWithInfo, + offWriteData + }; } /** @@ -9949,10 +11319,20 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ start(callback: AsyncCallback): void; + + /** + * Starts capturing. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + startWithCallback(callback: AsyncCallback): void; + /** * Starts capturing. * Success: This method uses a promise to return the result. @@ -9967,11 +11347,26 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ start(): Promise; + /** + * Starts capturing. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + startReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload start { startWithCallback, startReturnsPromise }; + /** * Reads the buffer from the audio capturer. This method uses an asynchronous callback to return the result. * @param { number } size - Number of bytes to read. @@ -10082,10 +11477,19 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ stop(callback: AsyncCallback): void; + + /** + * Stops capturing. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + stopWithCallback(callback: AsyncCallback): void; /** * Stops capturing. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. @@ -10097,11 +11501,26 @@ declare namespace audio { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ stop(): Promise; + /** + * Stops capturing. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + stopReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload stop { stopWithCallback, stopReturnsPromise }; + /** * Releases the capturer. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. @@ -10113,10 +11532,19 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ release(callback: AsyncCallback): void; + + /** + * Releases the capturer. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + releaseWithCallback(callback: AsyncCallback): void; /** * Releases the capturer. This method uses a promise to return the result. * @returns { Promise } - Promise used to return the result. @@ -10128,11 +11556,26 @@ declare namespace audio { * @returns { Promise } - Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ release(): Promise; + /** + * Releases the capturer. This method uses a promise to return the result. + * @returns { Promise } - Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + releaseReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload release { releaseWithCallback, releaseReturnsPromise }; + /** * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses an asynchronous callback to * return the result. @@ -10146,10 +11589,19 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the buffer size. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getBufferSize(callback: AsyncCallback): void; + /** + * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses an asynchronous callback to + * return the result. + * @param { AsyncCallback } callback - Callback used to return the buffer size. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getBufferSizeWithCallback(callback: AsyncCallback): void; /** * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses a promise to return the result. * @returns { Promise } Promise used to return the buffer size. @@ -10161,10 +11613,23 @@ declare namespace audio { * @returns { Promise } Promise used to return the buffer size. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getBufferSize(): Promise; + /** + * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the buffer size. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + getBufferSizeReturnsPromise(): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getBufferSize { getBufferSizeWithCallback, getBufferSizeReturnsPromise }; /** * Obtains a reasonable minimum buffer size in bytes for capturing. * @returns { long } Promise used to return the buffer size. @@ -10259,10 +11724,23 @@ declare namespace audio { * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + on(type: 'markReach', frame: long, callback: Callback): void; + + /** + * Subscribes to mark reached events. When the number of frames captured reaches the value of the frame parameter, + * the callback is invoked. + * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. + * @param { long } frame - Number of frames to trigger the event. The value must be greater than 0. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 */ - on(type: 'markReach', frame: long, callback: Callback): void; + onMarkReach(type: 'markReach', frame: long, callback: Callback): void; + /** * Unsubscribes from the mark reached events. * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. @@ -10282,11 +11760,21 @@ declare namespace audio { * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'markReach', callback?: Callback): void; + /** + * Unsubscribes from the mark reached events. + * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offMarkReach(type: 'markReach', callback?: Callback): void; + /** * Subscribes to period reached events. When the period of frame capturing reaches the value of frame parameter, * the callback is invoked. @@ -10304,10 +11792,23 @@ declare namespace audio { * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'periodReach', frame: long, callback: Callback): void; + + /** + * Subscribes to period reached events. When the period of frame capturing reaches the value of frame parameter, + * the callback is invoked. + * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. + * @param { long } frame - Period during which frame capturing is listened. The value must be greater than 0. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onPeriodReach(type: 'periodReach', frame: long, callback: Callback): void; + /** * Unsubscribes from period reached events. * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. @@ -10327,11 +11828,21 @@ declare namespace audio { * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'periodReach', callback?: Callback): void; + /** + * Unsubscribes from period reached events. + * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offPeriodReach(type: 'periodReach', callback?: Callback): void; + /** * Subscribes audio state change event callback. * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. @@ -10345,22 +11856,42 @@ declare namespace audio { * @param { Callback } callback - Callback used to listen for the audio state change event. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'stateChange', callback: Callback): void; + /** + * Subscribes audio state change event callback. + * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. + * @param { Callback } callback - Callback used to listen for the audio state change event. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onStateChange(type: 'stateChange', callback: Callback): void; + /** * Unsubscribes audio state change event callback. * @param { 'stateChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to listen for the audio state change event. * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Capturer - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'stateChange', callback?: Callback): void; + /** + * Unsubscribes audio state change event callback. + * @param { 'stateChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen for the audio state change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 20 + * @arkts 1.2 + */ + offStateChange(type: 'stateChange', callback?: Callback): void; + /** * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is * triggered when audio recording is interrupted. @@ -10384,11 +11915,23 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'audioInterrupt', callback: Callback): void; + /** + * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is + * triggered when audio recording is interrupted. + * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. + * @param { Callback } callback - Callback used to listen for interrupt callback. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onAudioInterrupt(type: 'audioInterrupt', callback: Callback): void; + /** * UnSubscribes to audio interrupt events. * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. @@ -10408,11 +11951,21 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'audioInterrupt'): void; + /** + * UnSubscribes to audio interrupt events. + * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offAudioInterrupt(type: 'audioInterrupt'): void; + /** * Subscribes input device change event callback. * The event is triggered when input device change for this stream. @@ -10436,10 +11989,23 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'inputDeviceChange', callback: Callback): void; + + /** + * Subscribes input device change event callback. + * The event is triggered when input device change for this stream. + * @param { 'inputDeviceChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onInputDeviceChange(type: 'inputDeviceChange', callback: Callback): void; + /** * Unsubscribes input device change event callback. * @param { 'inputDeviceChange' } type - Type of the event to listen for. @@ -10461,11 +12027,22 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Device * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'inputDeviceChange', callback?: Callback): void; + /** + * Unsubscribes input device change event callback. + * @param { 'inputDeviceChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offInputDeviceChange(type: 'inputDeviceChange', callback?: Callback): void; + /** * Subscribes audio capturer info change event callback. * The event is triggered when input device change for this stream. @@ -10489,10 +12066,23 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'audioCapturerChange', callback: Callback): void; + + /** + * Subscribes audio capturer info change event callback. + * The event is triggered when input device change for this stream. + * @param { 'audioCapturerChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onAudioCapturerChange(type: 'audioCapturerChange', callback: Callback): void; + /** * Unsubscribes audio capturer info change event callback. * @param { 'audioCapturerChange' } type - Type of the event to listen for. @@ -10514,11 +12104,22 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'audioCapturerChange', callback?: Callback): void; + /** + * Unsubscribes audio capturer info change event callback. + * @param { 'audioCapturerChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offAudioCapturerChange(type: 'audioCapturerChange', callback?: Callback): void; + /** * Subscribes audio data callback. * The event is triggered when audio buffer is available for reading more data. @@ -10542,11 +12143,37 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'readData', callback: Callback): void; + /** + * Subscribes audio data callback. + * The event is triggered when audio buffer is available for reading more data. + * @param { 'readData' } type - Type of the event to listen for. + * @param { Callback } callback - Callback with the buffer to read. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + onReadData(type: 'readData', callback: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload on { + onMarkReach, + onPeriodReach, + onStateChange, + onAudioInterrupt, + onInputDeviceChange, + onAudioCapturerChange, + onReadData + }; + /** * Unsubscribes audio data callback. * @param { 'readData' } type - Type of the event to listen for. @@ -10568,11 +12195,36 @@ declare namespace audio { * @throws { BusinessError } 6800101 - Parameter verification failed. * @syscap SystemCapability.Multimedia.Audio.Capturer * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'readData', callback?: Callback): void; + /** + * Unsubscribes audio data callback. + * @param { 'readData' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + offReadData(type: 'readData', callback?: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload off { + offMarkReach, + offPeriodReach, + offStateChange, + offAudioInterrupt, + offInputDeviceChange, + offAudioCapturerChange, + offReadData + }; + /** * Sets default input device of this Capturer to DEVICE_TYPE_ACCESSORY. * Other capturers' devices will not be affected by this method. @@ -11215,57 +12867,128 @@ declare namespace audio { * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ start(callback: AsyncCallback): void; + /** + * Starts player. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Tone + * @systemapi + * @since 20 + * @arkts 1.2 + */ + startWithCallback(callback: AsyncCallback): void; /** * Starts player. This method uses a promise to return the result. * @returns { Promise }Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ start(): Promise; + /** + * Starts player. This method uses a promise to return the result. + * @returns { Promise }Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Tone + * @systemapi + * @since 20 + * @arkts 1.2 + */ + startReturnsPromise(): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload start { startWithCallback, startReturnsPromise }; /** * Stops player. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ stop(callback: AsyncCallback): void; + + /** + * Stops player. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Tone + * @systemapi + * @since 20 + * @arkts 1.2 + */ + stopWithCallback(callback: AsyncCallback): void; + /** * Stops player. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ stop(): Promise; + /** + * Stops player. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Tone + * @systemapi + * @since 20 + * @arkts 1.2 + */ + stopReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload stop { stopWithCallback, stopReturnsPromise }; + /** * Releases the player. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ release(callback: AsyncCallback): void; + + /** + * Releases the player. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Tone + * @systemapi + * @since 20 + * @arkts 1.2 + */ + releaseWithCallback(callback: AsyncCallback): void; + /** * Releases the player. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ release(): Promise; + + /** + * Releases the player. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Tone + * @systemapi + * @since 20 + * @arkts 1.2 + */ + releaseReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload release { releaseWithCallback, releaseReturnsPromise }; } /**