AudioService

The AudioService allows an application to get an audio connection and manage it.

In this service the application:

Available in the package com.voxeet.sdk.services.AudioService.

Methods

getSoundManager

getSoundManager(): SoundManager

Retrieves the static SoundManager.

Returns: @Nullable SoundManager - the instance of the SoundManager or a null value if it is not initialized.

preInitSounds

preInitSounds(@NonNull applicationContext: Context): boolean

Initializes the SoundManager in cases when the SDK is not initialized. For example, when Cordova or React Native is used.

Parameters

NameTypeDescription
applicationContextContextnon null valid instance

Returns: boolean - the boolean indicating if the initialization has just happened or was initialized before using this method.

getAvailableRoutes

getAvailableRoutes(): List<AudioRoute>

Gets the available routes.

Returns: @NonNull List<AudioRoute> - the list of all possible routes.

currentRoute

currentRoute(): AudioRoute

Gets the current route used by the SoundManager instance.

Returns: @NonNull AudioRoute - the currently selected route.

registerUpdateDevices

registerUpdateDevices(callback: SoundManager.Call<List>): boolean

Registers the 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

Deregisters the external listeners to update the MediaDevice platform.

Parameters

NameTypeDescription
callbackSoundManager.Call<List>callback to deregister

isNotFiltered

isNotFiltered(@NonNull device: MediaDevice): boolean

Checks if the device is compatible with the system, and, therefore can be filtered.

Parameters

NameTypeDescription
deviceMediaDevicenon null device

Returns: boolean - informs about the compatibility.

enumerateDevices

enumerateDevices(): Promise<List>

List the audio media devices on the platform.

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

connect

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

Connect the SDK to the specified device.

Parameters

NameTypeDescription
deviceMediaDevicenon null device

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

disconnect

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

Disconnect the SDK from the specified device.

Parameters

NameTypeDescription
deviceMediaDevicenon null device

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

checkOutputRoute

checkOutputRoute(): AudioService

Checks route side effects for internal management.

Returns: @NonNull AudioService - the current instance.

abandonAudioFocusRequest

abandonAudioFocusRequest(): AudioService

Removes the focus on the currently available or valid audio route.

Returns: @NonNull AudioService - the current instance.

requestAudioFocus

requestAudioFocus(): AudioService

Asks for a focus on the current available or valid audio route.

Returns: @NonNull AudioService - the current instance.

setSound

setSound(@NonNull type: AudioType, @NonNull assetName: String): boolean

Attaches the specific asset from the sound type name into the phone mode.

Parameters

NameTypeDescription
typeAudioTypenon null sound type
assetNameStringnon null name of the asset

Returns: boolean - information about the successful attach.

setSound

setSound(@NonNull type: AudioType, @NonNull assetName: String, soundMode: int): boolean

Attaches the specific asset from a sound type name into the specific sound mode pool.

Parameters

NameTypeDescription
typeAudioTypenon null sound type
assetNameStringnon null name of the asset
soundModeintthe sound mode reflecting the pool mode

Returns: boolean - information about the successful attach.

playSoundType

playSoundType(@NonNull type: AudioType): AudioService

Plays the specific type of audio in the phone mode.

Parameters

NameTypeDescription
typeAudioTypenon null audio type to play

Returns: @NonNull AudioService - the current instance.

playSoundType

playSoundType(@NonNull type: AudioType, soundMode: int): AudioService

Plays the given audio type.

Parameters

NameTypeDescription
typeAudioTypenon null audio type to play
soundModeintthe sound mode

Returns: @NonNull AudioService - the current instance.

stopSoundType

stopSoundType(@NonNull audioType: AudioType): AudioService

Stops the given type of audio.

Parameters

NameTypeDescription
audioTypeAudioTypenon null requested type

Returns: @NonNull AudioService - the current instance.

stopSoundType

stopSoundType(@NonNull audioType: AudioType, soundMode: int): AudioService

Stops the given type and mode of audio.

Parameters

NameTypeDescription
audioTypeAudioTypenon null audio type
soundModeintthe sound mode

Returns: @NonNull AudioService - the current instance.

stop

stop(): AudioService

Stops the service but does not free the holds or resources.

Returns: @NonNull AudioService - the current instance.

enable

enable(): AudioService

Enables the service and lets it manage sounds and mode modifications.

Returns: @NonNull AudioService - the current instance.

disable

disable(): AudioService

Disables the AudioService and stops elements inside it.

Returns: @NonNull AudioService - the current instance.

enableNoiseSuppressor

enableNoiseSuppressor(enable: boolean): boolean

Activates or deactivates the NS mode.

Parameters

NameTypeDescription
enablebooleanthe new state

Returns: boolean - success or a failure.

currentMediaDevice

currentMediaDevice(): Promise<MediaDevice>

Get the currently connected media device.

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

Events

AudioRouteChangeEvent

Emitted when the SDK changed the current AudioRoute.

Available in the package com.voxeet.sdk.events.sdk.AudioRouteChangeEvent.