FakeTrackSelector.FakeTrackSelectionFactory


public class FakeTrackSelector.FakeTrackSelectionFactory implements ExoTrackSelection.Factory


A factory for the androidx.media3.test.utils.FakeTrackSelection instances requested by the FakeTrackSelector.

Summary

Public constructors

FakeTrackSelectionFactory(boolean mayReuseTrackSelection)

Public methods

final ExoTrackSelection[]
createTrackSelections(
    ExoTrackSelection.Definition[] definitions,
    BandwidthMeter bandwidthMeter,
    MediaSource.MediaPeriodId mediaPeriodId,
    Timeline timeline
)

Creates track selections for the provided Definitions.

Protected methods

ExoTrackSelection

Creates the FakeTrackSelection from a TrackGroup.

Public constructors

FakeTrackSelectionFactory

public FakeTrackSelectionFactory(boolean mayReuseTrackSelection)

Public methods

createTrackSelections

public final ExoTrackSelection[] createTrackSelections(
    ExoTrackSelection.Definition[] definitions,
    BandwidthMeter bandwidthMeter,
    MediaSource.MediaPeriodId mediaPeriodId,
    Timeline timeline
)

Creates track selections for the provided Definitions.

Implementations that create at most one adaptive track selection may use createTrackSelectionsForDefinitions.

Parameters
ExoTrackSelection.Definition[] definitions

A Definition array. May include null values.

BandwidthMeter bandwidthMeter

A BandwidthMeter which can be used to select tracks.

MediaSource.MediaPeriodId mediaPeriodId

The MediaPeriodId of the period for which tracks are to be selected.

Timeline timeline

The Timeline holding the period for which tracks are to be selected.

Returns
ExoTrackSelection[]

The created selections. Must have the same length as definitions and may include null values.

Protected methods

createTrackSelection

protected ExoTrackSelection createTrackSelection(TrackGroup trackGroup)

Creates the FakeTrackSelection from a TrackGroup.