SoundManager
The SoundManager model enables audio stack management. It allows the application to:
- Check if Bluetooth or wired headset is connected
- Register and deregister external listeners to update the media device platform
- Connect and disconnect the SDK to audio devices
- List the connected media devices and all devices
- Check whether the specific types of devices are connected and search for the registered devices that are not compatible
- Set the media mode
- Change the current mode to the media mode
- Calculate the output route and set the proper internal state
- Acquire or release the audio focus
- Set the audio type to a proper asset reference and changes the asset reference name to a specific sound and audio type
- Play a specific audio type in a stream voice call, force or stop a specific audio type, or stop playing sound in a specific mode
- Reset internal sound type
- Get the ringtone established by the Android system
- Enable and disable the sound manager and the internal manager
Available in the package com.voxeet.sdk.media.audio.SoundManager.
Methods
registerUpdateDevices
â–¸ registerUpdateDevices(callback
: SoundManager.Call<List>): boolean
Registers external listeners to update the MediaDevice platform.
Parameters
Name | Type | Description |
---|---|---|
callback | SoundManager.Call<List> | callback to register |
Returns: boolean - informs if the register call has been properly done.
unregisterUpdateDevices
â–¸ unregisterUpdateDevices(callback
: SoundManager.Call<List>): void
Deregisters external listeners to update the MediaDevice platform.
Parameters
Name | Type | Description |
---|---|---|
callback | SoundManager.Call<List> | callback to deregister |
enumerateDevices
â–¸ enumerateDevices(): Promise<List>
Lists audio and media devices connected to the platform.
Returns: @NonNull Promise<List> - the promise to resolve.
connect
â–¸ connect(@NonNull device
: MediaDevice): Promise<Boolean>
Connects the SDK to the specific device.
Parameters
Name | Type | Description |
---|---|---|
device | MediaDevice | non null device |
Returns: @NonNull Promise<Boolean> - the promise to resolve.
disconnect
â–¸ disconnect(@NonNull device
: MediaDevice): Promise<Boolean>
Disconnects the SDK from a device.
Parameters
Name | Type | Description |
---|---|---|
device | MediaDevice | non null device |
Returns: @NonNull Promise<Boolean> - the promise to resolve.
getSystemRingtone
â–¸ getSystemRingtone(): Ringtone
Gets the Ringtone from an Android system.
Returns: @Nullable Ringtone - the Ringtone instance corresponding to the instance of the current system.
isBluetoothHeadsetConnected
â–¸ isBluetoothHeadsetConnected(): boolean
Checks for a headset that is connected to the device.
Returns: boolean - the connection state.
isWiredHeadsetOn
â–¸ isWiredHeadsetOn(): boolean
Checks for wired headset connected to the device.
Returns: boolean - the connection state.
isPlatformConnected
â–¸ isPlatformConnected(@NonNull deviceType
: DeviceType, @NonNull state
: ConnectionState): boolean
Checks if the specified device type is connected to the native platform.
Parameters
Name | Type | Description |
---|---|---|
deviceType | DeviceType | non null device type |
state | ConnectionState | non null connection state to the native platform |
Returns: boolean - informs about the state.
resetDefaultSoundType
â–¸ resetDefaultSoundType(): SoundManager
Resets an internal Sound Type to the default type.
Returns: @NonNull SoundManager - the current instance to chain calls.
enableMedia
â–¸ enableMedia(): SoundManager
Sets the current mode to Media.
Returns: @NonNull SoundManager - the current instance to chain calls.
setMediaRoute
â–¸ setMediaRoute(): SoundManager
Changes the Call mode to the standard Media or System mode. We do not recommend using this method during conferences.
Returns: @NonNull SoundManager - the current instance to chain calls.
abandonAudioFocusRequest
â–¸ abandonAudioFocusRequest(): SoundManager
Releases the AudioFocus. For more information, see android-sdk-audio.
Returns: @NonNull SoundManager - the current instance to chain calls.
requestAudioFocus
â–¸ requestAudioFocus(): SoundManager
Acquires the AudioFocus. For more information, see android-sdk-audio.
Returns: @NonNull SoundManager - the current instance to chain calls.
checkOutputRoute
â–¸ checkOutputRoute(): SoundManager
Calculates the output route and sets the internal state accordingly. Use this method each time it must be recalculated.
Returns: @NonNull SoundManager - the current instance to chain calls.
setSound
â–¸ setSound(@NonNull type
: AudioType, @NonNull assetName
: String): boolean
Sets the AudioType to the given asset reference in the voice call mode.
Parameters
Name | Type | Description |
---|---|---|
type | AudioType | non null AudioType to set in the stream voice call |
assetName | String | non null name of the asset |
Returns: boolean - the current instance to chain calls.
setSound
â–¸ setSound(@NonNull type
: AudioType, @NonNull assetName
: String, soundMode
: int): boolean
Sets the asset reference name for a given soundMode and an AudioType.
Parameters
Name | Type | Description |
---|---|---|
type | AudioType | non null AudioType to set in the stream voice call |
assetName | String | non null name of the asset |
soundMode | int | sound mode for the system |
Returns: boolean - the current instance to chain calls.
playSoundType
â–¸ playSoundType(@NonNull type
: AudioType): SoundManager
Plays given AudioType in a stream voice call.
Parameters
Name | Type | Description |
---|---|---|
type | AudioType | non null AudioType |
Returns: @NonNull SoundManager - the current instance to chain calls.
playSoundType
â–¸ playSoundType(@NonNull type
: AudioType, soundMode
: int): SoundManager
Plays a given AudioType in a stream voice call for a given sound mode.
Parameters
Name | Type | Description |
---|---|---|
type | AudioType | non null AudioType |
soundMode | int | sound mode |
Returns: @NonNull SoundManager - the current instance to chain calls.
playSoundTypeForce
â–¸ playSoundTypeForce(@NonNull type
: AudioType): SoundManager
Forces a given AudioType sound to be played in a stream voice call.
Parameters
Name | Type | Description |
---|---|---|
type | AudioType | non null AudioType |
Returns: @NonNull SoundManager - the current instance to chain calls.
playSoundTypeForce
â–¸ playSoundTypeForce(@NonNull type
: AudioType, soundMode
: int): SoundManager
Forces a given AudioType sound to be played in the given sound mode.
Parameters
Name | Type | Description |
---|---|---|
type | AudioType | non null AudioType |
soundMode | int | sound mode |
Returns: @NonNull SoundManager - the current instance to chain calls.
stopSoundType
â–¸ stopSoundType(@NonNull audioType
: AudioType): SoundManager
Stops playing the specified type of sound for the stream voice call.
Parameters
Name | Type | Description |
---|---|---|
audioType | AudioType | non null AudioType |
Returns: @NonNull SoundManager - the current instance to chain calls.
stopSoundType
â–¸ stopSoundType(@NonNull audioType
: AudioType, soundMode
: int): SoundManager
Stops playing the specified type of sound in a given mode.
Parameters
Name | Type | Description |
---|---|---|
audioType | AudioType | non null AudioType |
soundMode | int | sound mode |
Returns: @NonNull SoundManager - the current instance to chain calls.
stop
â–¸ stop(soundMode
: int): SoundManager
Stops the sound that is played in a given mode.
Parameters
Name | Type | Description |
---|---|---|
soundMode | int | sound mode |
Returns: @NonNull SoundManager - the current instance to chain calls.
stop
â–¸ stop(): SoundManager
Stops the sound that is played in a stream voice call mode.
Returns: @NonNull SoundManager - the current instance to chain calls.
enable
â–¸ enable(): SoundManager
Enables the sound manager and the internal manager.
Returns: @NonNull SoundManager - the current instance to chain calls.
disable
â–¸ disable(): SoundManager
Disables the sound manager and the internal manager.
Returns: @NonNull SoundManager - the current instance to chain calls.
isIncompatible
â–¸ isIncompatible(@NonNull device
: MediaDevice): boolean
Checks if a device, such as a smart watch, is incompatible with the device management.
Parameters
Name | Type | Description |
---|---|---|
device | MediaDevice | non null The specific device. |
Returns: boolean - A flag indicating if the device is incompatible with the device management. True indicates that the device is incompatible, false indicates that the device is compatible.
current
â–¸ current(): Promise<MediaDevice>
Gets the connected media device.
Returns: Promise<MediaDevice> - the promise to resolve.
Updated 9 months ago