!7355 音频设备管理新增接口

Merge pull request !7355 from zhengxin/1024
This commit is contained in:
openharmony_ci 2023-11-14 03:58:33 +00:00 committed by Gitee
commit ba38e923a6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -326,6 +326,58 @@ declare namespace audio {
ALL_DISTRIBUTED_DEVICES_FLAG = 12,
}
/**
* Enumerates audio device for usage.
* @enum { number }
* @syscap SystemCapability.Multimedia.Audio.Device
* @systemapi
* @since 11
*/
enum DeviceUsage {
/**
* Media output devices.
* @syscap SystemCapability.Multimedia.Audio.Device
* @systemapi
* @since 11
*/
MEDIA_OUTPUT_DEVICES = 1,
/**
* Media input devices.
* @syscap SystemCapability.Multimedia.Audio.Device
* @systemapi
* @since 11
*/
MEDIA_INPUT_DEVICES = 2,
/**
* All media devices.
* @syscap SystemCapability.Multimedia.Audio.Device
* @systemapi
* @since 11
*/
ALL_MEDIA_DEVICES = 3,
/**
* Call output devices.
* @syscap SystemCapability.Multimedia.Audio.Device
* @systemapi
* @since 11
*/
CALL_OUTPUT_DEVICES = 4,
/**
* Call input devices.
* @syscap SystemCapability.Multimedia.Audio.Device
* @systemapi
* @since 11
*/
CALL_INPUT_DEVICES = 8,
/**
* All call devices.
* @syscap SystemCapability.Multimedia.Audio.Device
* @systemapi
* @since 11
*/
ALL_CALL_DEVICES = 12,
}
/**
* Enumerates device roles.
* @enum { number }
@ -1860,6 +1912,44 @@ declare namespace audio {
*/
off(type: 'deviceChange', callback?: Callback<DeviceChangeAction>): void;
/**
* Obtains all the available audio devices with a specific device usage.
* @param { DeviceUsage } deviceUsage - Audio device usage.
* @returns { AudioDeviceDescriptors } The device list.
* @throws { BusinessError } 401 - Input parameter type or number mismatch.
* @throws { BusinessError } 6800101 - Invalid parameter error.
* @syscap SystemCapability.Multimedia.Audio.Device
* @systemapi
* @since 11
*/
getAvailableDevices(deviceUsage: DeviceUsage): AudioDeviceDescriptors;
/**
* 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<DeviceChangeAction> } callback - Callback used to obtain the device update details.
* @throws { BusinessError } 401 - Input parameter type or number mismatch.
* @throws { BusinessError } 6800101 - Invalid parameter error.
* @syscap SystemCapability.Multimedia.Audio.Device
* @systemapi
* @since 11
*/
on(type: 'availableDeviceChange', deviceUsage: DeviceUsage, callback: Callback<DeviceChangeAction>): 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<DeviceChangeAction> } callback - Callback used to obtain the device update details.
* @throws { BusinessError } 401 - Input parameter type or number mismatch.
* @throws { BusinessError } 6800101 - Invalid parameter error.
* @syscap SystemCapability.Multimedia.Audio.Device
* @systemapi
* @since 11
*/
off(type: 'availableDeviceChange', callback?: Callback<DeviceChangeAction>): void;
/**
* Sets a device to the active state. This method uses an asynchronous callback to return the result.
* @param { CommunicationDeviceType } deviceType - Audio device type.
@ -4473,4 +4563,4 @@ declare namespace audio {
}
}
export default audio;
export default audio;