Package 

Class AudioOptions


  • 
    public final class AudioOptions
    
                        

    Options for customizing the audio settings of LiveKit.

    • Constructor Detail

      • AudioOptions

        AudioOptions(AudioType audioOutputType, AudioHandler audioHandler, AudioDeviceModule audioDeviceModule, Function1<JavaAudioDeviceModule.Builder, Unit> javaAudioDeviceModuleCustomizer, Boolean disableCommunicationModeWorkaround, AudioProcessorOptions audioProcessorOptions, Boolean disableAudioPrewarming)
    • Method Detail

      • getAudioDeviceModule

         final AudioDeviceModule getAudioDeviceModule()

        Override the default AudioDeviceModule.

        If a non-null value is passed, the library does not take ownership of the object and will not release it upon Room.release. It is the responsibility of the owner to call AudioDeviceModule.release when finished with it to prevent memory leaks.

      • getJavaAudioDeviceModuleCustomizer

         final Function1<JavaAudioDeviceModule.Builder, Unit> getJavaAudioDeviceModuleCustomizer()

        Called after default setup to allow for customizations on the JavaAudioDeviceModule.

        Not used if audioDeviceModule is provided.

        Note: We require setting the JavaAudioDeviceModule.Builder.setSamplesReadyCallback to provide support for LocalAudioTrack.addSink. If you wish to grab the audio samples from the local microphone track, use LocalAudioTrack.addSink instead of setting your own callback.

      • getDisableCommunicationModeWorkaround

         final Boolean getDisableCommunicationModeWorkaround()

        On Android 11+, the audio mode will reset itself from AudioManager.MODE_IN_COMMUNICATION if there is no audio playback or capture for 6 seconds (for example when joining a room with no speakers and the local mic is muted.) This mode reset will cause unexpected behavior when trying to change the volume, causing it to not properly change the volume.

        We use a workaround by playing a silent audio track to keep the communication mode from resetting.

        Setting this flag to true will disable the workaround.

        This flag is a no-op when the audio mode is set to anything other than AudioManager.MODE_IN_COMMUNICATION.

      • getDisableAudioPrewarming

         final Boolean getDisableAudioPrewarming()

        Devices may take some time initializing the audio stack for recording. Prewarming allows starting up the underlying audio recording prior to publish, letting the audio device be ready immediately when the track is fully published.

        If set to true, disables audio recording prewarming (and the related LocalAudioTrack.prewarm function), and audio resources are only used while the track is connected and published. Defaults to false.