Package 

Interface AudioDevice

  • All Implemented Interfaces:
    com.twilio.voice.AudioDeviceCapturer , com.twilio.voice.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 Detail

      • audioDeviceFormatChanged

         static void audioDeviceFormatChanged(@NonNull() AudioDeviceContext audioDeviceContext)

        This method should be called any time the capturing or rendering format changes. If bothformats 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.
      • 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.