Class AudioDeviceManager
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.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newAudioDeviceManagerinstance.AudioDeviceManager(android.content.Context context) Constructs a newAudioDeviceManagerinstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic BaseAudioDeviceGets theBaseAudioDeviceinstance.Gets the AudioFocusManager instance, if the current audio device supports it.static voidsetAudioDevice(BaseAudioDevice device) Sets the audio device to be used.
-
Constructor Details
-
AudioDeviceManager
public AudioDeviceManager()Constructs a newAudioDeviceManagerinstance. -
AudioDeviceManager
public AudioDeviceManager(android.content.Context context) Constructs a newAudioDeviceManagerinstance.- Parameters:
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.
-
-
Method Details
-
setAudioDevice
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:
device- TheBaseAudioDeviceinterface implementation.- Throws:
IllegalStateException
-
getAudioDevice
Gets theBaseAudioDeviceinstance.- Returns:
- id The
BaseAudioDeviceinstance.
-
getAudioFocusManager
Gets the AudioFocusManager instance, if the current audio device supports it.This requires having instantiated object via
AudioDeviceManager(Context context), otherwise the method returnsnull. This returns the same instance as thegetAudioDevice()method if it conforms to the AudioFocusManager interface. Otherwise, it returnsnull.Note: Currently only the default audio device implements this interface.
- Returns:
- The AudioFocusManager implementation, or
nullif unsupported. - See Also:
-