fm.liveswitch.android.AudioManagerUtility Class Reference

AudioManagerUtility is responsible for managing Audio Input and Output devices on an Android client. Notice that some methods and events are only available on Android SDK 31 and above. Application layer should check the version of Android on the client before attempting to call such methods. Use if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) More...

Public Member Functions

 AudioManagerUtility (Context context, AudioDevicePreferenceProfile profile)
 AudioManagerUtility constructor Parameters: More...
 
String serializeDevice (AudioDeviceInfo device)
 Utility method that provides a string representation of an AudioDeviceInfo. More...
 
AudioDeviceInfo[] enumerateDevices ()
 
Promise< AudioDeviceInfo > setSpeakerOn ()
 Enables built-in speaker for audio communication. More...
 
Promise< AudioDeviceInfo > setBluetoothOn ()
 Enables a connected bluetooth device for audio communication. When multiple bluetooth devices are connected, a random bluetoth device will be enabled. On some modern Android systems, it is possible to enable different Bluetooth Devices by first examining their IDs via AudioManagerUtility.enumerateDevices() and then using AudioManagerUtility.setAudioCommunicationDeviceId() - only available in SDK 31 and above. More...
 
Promise< AudioDeviceInfo > setEarpieceOn ()
 Enables built-in earpiece for audio communication. Typical for audio-only conferences. More...
 
Promise< AudioDeviceInfo > setWiredHeadsetOn ()
 Enables plugged in wired headset for audio communication. May not work on some devices running SDK 30 and earlier. More...
 
void startSession ()
 Call this method when starting local or remote media. More...
 
void endSession ()
 Call this method when the last connection on a conference completes. More...
 
void addOnDeviceAdded (IAction1< AudioDeviceInfo > value) throws UnsupportedOperationException
 Adds an event listener that is invoked when an audio device is added. Only available on Android SDK 30 and above. More...
 
void removeOnDeviceAdded (IAction1< AudioDeviceInfo > value)
 Removes an event listener that is invoked when an audio device is added. Only available on Android SDK 30 and above. More...
 
void addOnDeviceRemoved (IAction1< AudioDeviceInfo > value) throws UnsupportedOperationException
 Adds an event listener that is invoked when an audio device is removed. Only available on Android SDK 30 and above. More...
 
void removeOnDeviceRemoved (IAction1< AudioDeviceInfo > value)
 Removes an event listener that is invoked when an audio device is removed. Only available on Android SDK 30 and above. More...
 
void addOnDeviceChanged (IAction1< AudioDeviceInfo > value) throws UnsupportedOperationException
 Adds an event listener that is invoked when an active audio device used for communication has been changed. Only available on Android SDK 30 and above. More...
 
void removeOnDeviceChanged (IAction1< AudioDeviceInfo > value)
 Removes an event listener that is invoked when an active audio device used for communication has been changed. Only available on Android SDK 30 and above. More...
 

Detailed Description

AudioManagerUtility is responsible for managing Audio Input and Output devices on an Android client. Notice that some methods and events are only available on Android SDK 31 and above. Application layer should check the version of Android on the client before attempting to call such methods. Use if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S)

Constructor & Destructor Documentation

◆ AudioManagerUtility()

fm.liveswitch.android.AudioManagerUtility.AudioManagerUtility ( Context  context,
AudioDevicePreferenceProfile  profile 
)

AudioManagerUtility constructor Parameters:

  • context - Android context
  • profile - one of the pre-specified audio device preference. These are used to decide which audio device is active by default including the cases when a device is plugged in or unplugged.

Member Function Documentation

◆ addOnDeviceAdded()

void fm.liveswitch.android.AudioManagerUtility.addOnDeviceAdded ( IAction1< AudioDeviceInfo >  value) throws UnsupportedOperationException

Adds an event listener that is invoked when an audio device is added. Only available on Android SDK 30 and above.

◆ addOnDeviceChanged()

void fm.liveswitch.android.AudioManagerUtility.addOnDeviceChanged ( IAction1< AudioDeviceInfo >  value) throws UnsupportedOperationException

Adds an event listener that is invoked when an active audio device used for communication has been changed. Only available on Android SDK 30 and above.

◆ addOnDeviceRemoved()

void fm.liveswitch.android.AudioManagerUtility.addOnDeviceRemoved ( IAction1< AudioDeviceInfo >  value) throws UnsupportedOperationException

Adds an event listener that is invoked when an audio device is removed. Only available on Android SDK 30 and above.

◆ endSession()

void fm.liveswitch.android.AudioManagerUtility.endSession ( )

Call this method when the last connection on a conference completes.

◆ enumerateDevices()

AudioDeviceInfo [] fm.liveswitch.android.AudioManagerUtility.enumerateDevices ( )

◆ removeOnDeviceAdded()

void fm.liveswitch.android.AudioManagerUtility.removeOnDeviceAdded ( IAction1< AudioDeviceInfo >  value)

Removes an event listener that is invoked when an audio device is added. Only available on Android SDK 30 and above.

◆ removeOnDeviceChanged()

void fm.liveswitch.android.AudioManagerUtility.removeOnDeviceChanged ( IAction1< AudioDeviceInfo >  value)

Removes an event listener that is invoked when an active audio device used for communication has been changed. Only available on Android SDK 30 and above.

◆ removeOnDeviceRemoved()

void fm.liveswitch.android.AudioManagerUtility.removeOnDeviceRemoved ( IAction1< AudioDeviceInfo >  value)

Removes an event listener that is invoked when an audio device is removed. Only available on Android SDK 30 and above.

◆ serializeDevice()

String fm.liveswitch.android.AudioManagerUtility.serializeDevice ( AudioDeviceInfo  device)

Utility method that provides a string representation of an AudioDeviceInfo.

◆ setBluetoothOn()

Promise<AudioDeviceInfo> fm.liveswitch.android.AudioManagerUtility.setBluetoothOn ( )

Enables a connected bluetooth device for audio communication. When multiple bluetooth devices are connected, a random bluetoth device will be enabled. On some modern Android systems, it is possible to enable different Bluetooth Devices by first examining their IDs via AudioManagerUtility.enumerateDevices() and then using AudioManagerUtility.setAudioCommunicationDeviceId() - only available in SDK 31 and above.

◆ setEarpieceOn()

Promise<AudioDeviceInfo> fm.liveswitch.android.AudioManagerUtility.setEarpieceOn ( )

Enables built-in earpiece for audio communication. Typical for audio-only conferences.

◆ setSpeakerOn()

Promise<AudioDeviceInfo> fm.liveswitch.android.AudioManagerUtility.setSpeakerOn ( )

Enables built-in speaker for audio communication.

◆ setWiredHeadsetOn()

Promise<AudioDeviceInfo> fm.liveswitch.android.AudioManagerUtility.setWiredHeadsetOn ( )

Enables plugged in wired headset for audio communication. May not work on some devices running SDK 30 and earlier.

◆ startSession()

void fm.liveswitch.android.AudioManagerUtility.startSession ( )

Call this method when starting local or remote media.