DefaultAudioTrackProvider


@UnstableApi
public class DefaultAudioTrackProvider implements DefaultAudioSink.AudioTrackProvider


The default provider for AudioTrack instances.

Subclasses of this provider can customize the AudioTrack.Builder in customizeAudioTrackBuilder if required.

Summary

Public constructors

Public methods

final AudioTrack
getAudioTrack(
    AudioSink.AudioTrackConfig audioTrackConfig,
    AudioAttributes audioAttributes,
    int audioSessionId
)

Returns a new AudioTrack for the given parameters.

Protected methods

AudioTrack.Builder

Optionally customize AudioTrack.Builder with other parameters.

Inherited Constants

From androidx.media3.exoplayer.audio.DefaultAudioSink.AudioTrackProvider
static final DefaultAudioSink.AudioTrackProvider

The default provider for AudioTrack instances.

Public constructors

DefaultAudioTrackProvider

public DefaultAudioTrackProvider()

Public methods

getAudioTrack

public final AudioTrack getAudioTrack(
    AudioSink.AudioTrackConfig audioTrackConfig,
    AudioAttributes audioAttributes,
    int audioSessionId
)

Returns a new AudioTrack for the given parameters.

Protected methods

customizeAudioTrackBuilder

@RequiresApi(value = 23)
@CanIgnoreReturnValue
protected AudioTrack.Builder customizeAudioTrackBuilder(AudioTrack.Builder audioTrackBuilder)

Optionally customize AudioTrack.Builder with other parameters.

Note that this method is only called on API 23 and above.

Parameters
AudioTrack.Builder audioTrackBuilder

The AudioTrack.Builder on which to set the attributes.

Returns
AudioTrack.Builder

The same AudioTrack.Builder instance provided.