AudioDeviceManager
public class AudioDeviceManager
Use the AudioDeviceManager to set a custom audio device to be used by the app. The audio device manages access to the audio capturing and rendering hardware.
You can only define a single audio capture source and rendering target for
the app. You cannot set these individually for each publisher and subscriber.
You can, however, set the audio bitrate for a published stream using the
PublisherKit.Builder#audioBitrate(int) method.
Methods
| Name | Description |
|---|---|
AudioDeviceManager() |
Constructs a new AudioDeviceManager instance. |
AudioDeviceManager(context) |
Constructs a new AudioDeviceManager instance. |
(static) getAudioDevice() → {BaseAudioDevice} |
Gets the BaseAudioDevice instance. |
getAudioFocusManager() → {BaseAudioDevice.AudioFocusManager} |
Gets the AudioFocusManager instance, if the current audio device supports it. |
(static) setAudioDevice(device) |
Sets the audio device to be used. |
AudioDeviceManager()
Constructs a new AudioDeviceManager instance.
AudioDeviceManager(context)
Constructs a new AudioDeviceManager instance.
Parameters:
| Name | Type | Description |
|---|---|---|
context |
Context | the context used for managing audio devices. This should be the application-level context to avoid memory leaks or unintended behavior related to activity lifecycles. |
(static) getAudioDevice() → {BaseAudioDevice}
Gets the BaseAudioDevice instance.
Returns:
id The BaseAudioDevice instance.
getAudioFocusManager() → {BaseAudioDevice.AudioFocusManager}
Gets the AudioFocusManager instance, if the current audio device supports it.
This requires having instantiated object via AudioDeviceManager(Context context),
otherwise the method returns null. This returns the same instance as the getAudioDevice() method
if it conforms to the AudioFocusManager interface. Otherwise, it returns null.
Note: Currently only the default audio device implements this interface.
See: : - Creating a VoIP app using the Android ConnectionService
Returns:
The AudioFocusManager implementation, or null if unsupported.
(static) setAudioDevice(device)
Sets the audio device to be used.
You must call this method before you connect to a session. Additionally, this is a global operation that must persist throughout the lifetime of an application.
If you do not call this method, the app uses the Android device's microphone and speaker.
Parameters:
| Name | Type | Description |
|---|---|---|
device |
BaseAudioDevice | The BaseAudioDevice interface implementation. |