-
- All Implemented Interfaces:
-
com.twilio.video.AudioDeviceCapturer,com.twilio.video.AudioDeviceRenderer
public interface AudioDevice implements AudioDeviceCapturer, AudioDeviceRenderer
AudioDevice interface allows developers to inject custom audio device capturer and audio device renderer of audio by replacing the default device used by the SDK.
-
-
Method Summary
Modifier and Type Method Description static voidaudioDeviceFormatChanged(@NonNull() AudioDeviceContext audioDeviceContext)This method should be called any time the capturing or rendering format changes. static voidaudioDeviceWriteCaptureData(@NonNull() AudioDeviceContext audioDeviceContext, @NonNull() ByteBuffer audioSample)This method needs to be called by AudioDeviceCapturer implementation to providecaptured data to the media engine. static voidaudioDeviceReadRenderData(@NonNull() AudioDeviceContext audioDeviceContext, @NonNull() ByteBuffer audioSample)This method needs to be called by AudioDeviceRenderer to pull renderable audio datafrom the media engine. static voidaudioDeviceExecuteWorkerBlock(@NonNull() AudioDeviceContext audioDeviceContext, @NonNull() Runnable runnable)A utility method to execute a runnable on the media engine's worker thread asynchronously. -
Methods inherited from class com.twilio.video.AudioDeviceCapturer
getCapturerFormat, onInitCapturer, onStartCapturing, onStopCapturing -
Methods inherited from class com.twilio.video.AudioDeviceRenderer
getRendererFormat, onInitRenderer, onStartRendering, onStopRendering -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
audioDeviceFormatChanged
static void audioDeviceFormatChanged(@NonNull() AudioDeviceContext audioDeviceContext)
This method should be called any time the capturing or rendering format changes. If bothformat change simultaneously its fine to call this method just once. As a result, the mediaengine will read the new audio format, stop capturing and/or rendering by calling and/or onStopRendering and then call onStartCapturing and/or .
- Parameters:
audioDeviceContext- The AudioDevice context.
-
audioDeviceWriteCaptureData
static void audioDeviceWriteCaptureData(@NonNull() AudioDeviceContext audioDeviceContext, @NonNull() ByteBuffer audioSample)
This method needs to be called by AudioDeviceCapturer implementation to providecaptured data to the media engine. When callback is raised, call thismethod in a loop to provide captured data to media engine.
- Parameters:
audioDeviceContext- The AudioDevice context.audioSample- Audio data you wish to deliver.
-
audioDeviceReadRenderData
static void audioDeviceReadRenderData(@NonNull() AudioDeviceContext audioDeviceContext, @NonNull() ByteBuffer audioSample)
This method needs to be called by AudioDeviceRenderer to pull renderable audio datafrom the media engine.
- Parameters:
audioDeviceContext- The context reference.audioSample- A reference to a buffer where the signed 16-bit LPCM audio data will becopied into.
-
audioDeviceExecuteWorkerBlock
static void audioDeviceExecuteWorkerBlock(@NonNull() AudioDeviceContext audioDeviceContext, @NonNull() Runnable runnable)
A utility method to execute a runnable on the media engine's worker thread asynchronously.
AudioDevice invokes the callbacks on the media engine's worker thread. If you wish toinitialize, start or stop the audio device from your application code, to avoid thethread-safety problems, you should execute code from the media engine's worker thread.
- Parameters:
audioDeviceContext- The AudioDevice context.runnable- A block which will be executed on the media engine's worker thread.
-
-
-
-