AudioTrackAudioOutputProvider


@UnstableApi
public final class AudioTrackAudioOutputProvider implements AudioOutputProvider


A default implementation of AudioOutputProvider.

Summary

Nested types

A builder to create AudioTrackAudioOutputProvider instances.

Public fields

static boolean

Whether to throw an AudioTrackAudioOutput.InvalidAudioTrackTimestampException when a spurious timestamp is reported from getTimestamp.

Public methods

void

Adds a Listener.

AudioOutput

Returns an AudioOutput for the given config.

AudioOutputProvider.FormatSupport

Returns the level of support that this provider has for a given FormatConfig.

AudioOutputProvider.OutputConfig

Returns the OutputConfig for the given format.

void

Releases resources held by the provider.

void

Removes a Listener.

void
setClock(Clock clock)

Sets the Clock to use in the provider.

Inherited Constants

From androidx.media3.exoplayer.audio.AudioOutputProvider
static final int

The provider supports the format directly, without the need for internal transcoding.

static final int

The provider supports the format, but needs to transcode it internally to do so.

static final int

The provider does not support the format.

Public fields

failOnSpuriousAudioTimestamp

public static boolean failOnSpuriousAudioTimestamp

Whether to throw an AudioTrackAudioOutput.InvalidAudioTrackTimestampException when a spurious timestamp is reported from getTimestamp.

The flag must be set before creating a player. Should be set to true for testing and debugging purposes only.

Public methods

addListener

public void addListener(AudioOutputProvider.Listener listener)

Adds a Listener.

Parameters
AudioOutputProvider.Listener listener

The listener to add.

getFormatSupport

public AudioOutputProvider.FormatSupport getFormatSupport(AudioOutputProvider.FormatConfig formatConfig)

Returns the level of support that this provider has for a given FormatConfig.

Parameters
AudioOutputProvider.FormatConfig formatConfig

The FormatConfig.

Returns
AudioOutputProvider.FormatSupport

The FormatSupport for this config.

release

public void release()

Releases resources held by the provider.

removeListener

public void removeListener(AudioOutputProvider.Listener listener)

Removes a Listener.

Parameters
AudioOutputProvider.Listener listener

The listener to remove.

setClock

public void setClock(Clock clock)

Sets the Clock to use in the provider.