2020 API AWARDS WINNER - BEST IN MEDIA APIs LEARN MORE

SoundManager

The SoundManager model manages calls to the lower audio stack management. It allows the application to:

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

NameTypeDescription
callbackSoundManager.Call<List>callback to register

Returns: boolean - informs if the register call has been properly be done.

unregisterUpdateDevices

unregisterUpdateDevices(callback: SoundManager.Call<List>): void

Unregisters external listeners to update the MediaDevice platform.

Parameters

NameTypeDescription
callbackSoundManager.Call<List>callback to unregister

getAvailableRoutes

getAvailableRoutes(): List<AudioRoute>

Gets currently available routes.

Returns: @NonNull List<AudioRoute> - a non-null route.

currentRoute

currentRoute(): AudioRoute

Gets the current route calculated on the current internal manager state.

Returns: @NonNull AudioRoute - the currently calculated route.

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

NameTypeDescription
deviceMediaDevicenon null device

Returns: @NonNull Promise<Boolean> - the promise to resolve.

disconnect

disconnect(@NonNull device: MediaDevice): Promise<Boolean>

Disconnects the SDK from a device.

Parameters

NameTypeDescription
deviceMediaDevicenon null device

Returns: @NonNull Promise<Boolean> - the promise to resolve.

setAudioRoute

setAudioRoute(@NonNull route: AudioRoute): boolean

Sets the current route forcing a newly calculated route that is compatible with the current system state. For example, it is impossible to enable Bluetooth if Bluetooth headset is not connected. It starts working after connecting Bluetooth headset.

Parameters

NameTypeDescription
routeAudioRoutenon null valid audio route

Returns: boolean - the result of an internal call.

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

NameTypeDescription
deviceTypeDeviceTypenon null device type
stateConnectionStatenon null connection state to the native platform

Returns: boolean - informs about the state.

setSpeakerMode

setSpeakerMode(isSpeaker: boolean): SoundManager

Changes the state of output or an internal speaker.

Parameters

NameTypeDescription
isSpeakerbooleanoption to change the speaker to the external one

Returns: @NonNull SoundManager - the current instance to chain calls.

isSpeakerOn

isSpeakerOn(): boolean

Checks an external speaker mode.

Returns: boolean - the current speaker state.

acquireLocks

acquireLocks(): SoundManager

Acquires locks for an internal manager.

Returns: @NonNull SoundManager - the current instance to chain calls.

releaseLocks

releaseLocks(): SoundManager

Releases locks for an internal manager.

Returns: @NonNull SoundManager - the current instance to chain calls.

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

Unsets the Call mode to set the standard Media or a System type. Should not be used in conferences.

Returns: @NonNull SoundManager - the current instance to chain calls.

unsetMediaRoute

unsetMediaRoute(): SoundManager

Unsets the Media mode to set the Call mode. Should be used in conferences.

Returns: @NonNull SoundManager - the current instance to chain calls

abandonAudioFocusRequest

abandonAudioFocusRequest(): SoundManager

Makes the instance of the current application release the AudioFocus. For more information, see android-sdk-audio.

Returns: @NonNull SoundManager - the current instance to chain calls.

requestAudioFocus

requestAudioFocus(): SoundManager

Makes the instance of the current application acquire 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

NameTypeDescription
typeAudioTypenon null AudioType to set in the stream voice call
assetNameStringnon 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

NameTypeDescription
typeAudioTypenon null AudioType to set in the stream voice call
assetNameStringnon null name of the asset
soundModeintsound 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

NameTypeDescription
typeAudioTypenon 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

NameTypeDescription
typeAudioTypenon null AudioType
soundModeintsound 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

NameTypeDescription
typeAudioTypenon 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

NameTypeDescription
typeAudioTypenon null AudioType
soundModeintsound 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

NameTypeDescription
audioTypeAudioTypenon 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

NameTypeDescription
audioTypeAudioTypenon null AudioType
soundModeintsound 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

NameTypeDescription
soundModeintsound 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.

onConferencePreJoinedEvent

onConferencePreJoinedEvent(): SoundManager

Calls when a conference is in a joining state.

Returns: @NonNull SoundManager - the current instance to chain calls.

onConferenceDestroyedPush

onConferenceDestroyedPush(): SoundManager

Calls when a conference is destroyed.

Returns: @NonNull SoundManager - the current instance to chain calls.

enable

enable(): SoundManager

Enables this and the internal manager.

Returns: @NonNull SoundManager - the current instance to chain calls.

disable

disable(): SoundManager

Disables this and the internal manager.

Returns: @NonNull SoundManager - the current instance to chain calls.

isNotFiltered

isNotFiltered(@NonNull device: MediaDevice): boolean

Searches for devices that are registered but not compatible (for example smart watches).

Parameters

NameTypeDescription
deviceMediaDevicenon null device

Returns: boolean - informs about the compatibility.

current

current(): Promise<MediaDevice>

Gets the connected media device.

Returns: Promise<MediaDevice> - the promise to resolve.