BaseAudioDevice
public abstract class BaseAudioDevice
Defines an audio device for use in a session. See
AudioDeviceManager#setAudioDevice(BaseAudioDevice device).
Nested types: BaseAudioDevice.OutputMode, BaseAudioDevice.BluetoothState, BaseAudioDevice.AudioFocusManager, BaseAudioDevice.AudioSettings, BaseAudioDevice.AudioBus
Methods
| Name | Description |
|---|---|
BaseAudioDevice() |
|
destroyCapturer() → {boolean} |
Stops the audio capturer thread. |
destroyRenderer() → {boolean} |
Stops the audio renderer thread. |
finalize() |
|
getAudioBus() → {BaseAudioDevice.AudioBus} |
Gets the AudioBus instance that this audio device uses. |
getBluetoothState() → {BaseAudioDevice.BluetoothState} |
Returns BluetoothState#Connected if there is a Bluetooth device and audio is being rendered to this device. |
getCaptureSettings() → {BaseAudioDevice.AudioSettings} |
Returns the AudioSettings object defining the audio capture settings used by this device. |
getEstimatedCaptureDelay() → {int} |
The estimated capturing delay in ms. |
getEstimatedRenderDelay() → {int} |
Returns the estimated rendering delay in ms. |
getOutputMode() → {BaseAudioDevice.OutputMode} |
Returns the audio output mode for the app. |
getRenderSettings() → {BaseAudioDevice.AudioSettings} |
Returns the AudioSettings object defining the audio rendering settings used by this device. |
initCapturer() → {boolean} |
Requests the audio device to initialize itself for audio sampling. |
initRenderer() → {boolean} |
Requests the audio device to initialize itself for rendering. |
onPause() |
Call this method when the activity pauses. |
onResume() |
Call this method when the activity resumes. |
setOutputMode(mode) → {boolean} |
Set the audio output mode for the app: video (the default) or voice. |
startCapturer() → {boolean} |
Requests that the device start capturing audio samples. |
startRenderer() → {boolean} |
Requests that the device start rendering audio. |
stopCapturer() → {boolean} |
Requests that the device stop sampling audio. |
stopRenderer() → {boolean} |
Requests that the device stop rendering audio. |
BaseAudioDevice()
destroyCapturer() → {boolean}
Stops the audio capturer thread.
Returns:
boolean
destroyRenderer() → {boolean}
Stops the audio renderer thread.
Returns:
boolean
finalize()
getAudioBus() → {BaseAudioDevice.AudioBus}
Gets the AudioBus instance that this audio device uses. Use the AudioBus instance to send and receive audio samples to and from a session.
Returns:
BaseAudioDevice.AudioBus
getBluetoothState() → {BaseAudioDevice.BluetoothState}
Returns BluetoothState#Connected if there is a Bluetooth device and audio is being
rendered to this device. Returns BluetoothState#Disconnected otherwise.
Returns:
The current Bluetooth state.
getCaptureSettings() → {BaseAudioDevice.AudioSettings}
Returns the AudioSettings object defining the audio capture settings used by this device.
Returns:
AudioSettings The AudioSettings object.
getEstimatedCaptureDelay() → {int}
The estimated capturing delay in ms. This is used to adjust timing transmission information for encoded audio samples.
Returns:
int
getEstimatedRenderDelay() → {int}
Returns the estimated rendering delay in ms. This is used to adjust audio signal processing and rendering.
Returns:
int
getOutputMode() → {BaseAudioDevice.OutputMode}
Returns the audio output mode for the app.
See:
: - setOutputMode(OutputMode mode)
Returns:
BaseAudioDevice.OutputMode
getRenderSettings() → {BaseAudioDevice.AudioSettings}
Returns the AudioSettings object defining the audio rendering settings used by this device.
Returns:
AudioSettings The AudioSettings object.
initCapturer() → {boolean}
Requests the audio device to initialize itself for audio sampling. Call this method before attempting to start sampling.
Returns:
boolean
initRenderer() → {boolean}
Requests the audio device to initialize itself for rendering. Call this method before attempting to start rendering.
Returns:
boolean
onPause()
Call this method when the activity pauses. When you override this method, implement code to respond to the activity being paused. For example, you may pause capturing and rendering audio.
See:
: - onResume()
onResume()
Call this method when the activity resumes. When you override this method, implement code to respond to the activity being resumed. For example, you may resume capturing and rendering audio.
See:
: - onPause()
setOutputMode(mode) → {boolean}
Set the audio output mode for the app: video (the default) or voice. The audio output mode defines which audio outputs are used:
OutputMode.SpeakerPhone— Pass in this value to set the audio output mode for video communication (the default setting). When using the default audio driver, the app uses the device loudspeaker instead of the headset speaker. This is preferable for apps that include both video and audio.OutputMode.Handset— Pass in this value to set the audio output mode for voice communication. When using the default audio driver, the app uses the headset speaker (and the loudspeaker is disabled), so that the device can be used as in a regular phone call. This is preferable in voice-only apps. When a Bluetooth device is connected, this will send the audio to it instead of the Handset.
Call this method before you connect to a session.
The following code sets the app to use handset audio output mode, which is preferred in a voice-only app:
AudioDeviceManager.getAudioDevice().setOutputMode(OutputMode.Handset);
Parameters:
| Name | Type | Description |
|---|---|---|
mode |
BaseAudioDevice.OutputMode | The audio output mode for the app. |
Returns:
boolean
startCapturer() → {boolean}
Requests that the device start capturing audio samples. After successful return from this function, the audio bus is ready to receive audio sample data.
Returns:
boolean
startRenderer() → {boolean}
Requests that the device start rendering audio. After successful return from this function, audio samples become available on the audio bus.
Returns:
boolean
stopCapturer() → {boolean}
Requests that the device stop sampling audio.
Returns:
boolean
stopRenderer() → {boolean}
Requests that the device stop rendering audio.
Returns:
boolean