FakeTrackSelector


@UnstableApi
class FakeTrackSelector : DefaultTrackSelector


A fake MappingTrackSelector that returns FakeTrackSelections.

Summary

Public constructors

FakeTrackSelector(mayReuseTrackSelection: Boolean)

Public functions

(Mutable)List<FakeTrackSelection!>!

Returns list of all FakeTrackSelections that this track selector has made so far.

Protected functions

Array<@NullableType ExoTrackSelection.Definition!>!
selectAllTracks(
    mappedTrackInfo: MappingTrackSelector.MappedTrackInfo!,
    @RendererCapabilities.Capabilities rendererFormatSupports: Array<Array<IntArray!>!>!,
    @RendererCapabilities.AdaptiveSupport rendererMixedMimeTypeAdaptationSupports: IntArray!,
    params: DefaultTrackSelector.Parameters!
)

Called from selectTracks to make a track selection for each renderer, prior to overrides and disabled flags being applied.

Inherited Constants

From androidx.media3.exoplayer.trackselection.DefaultTrackSelector
const Int

Track is eligible for both a fixed selection and as part of an adaptive selection with multiple tracks.

const Int

Track is eligible for a fixed selection with one track.

const Int

Track is not eligible for selection.

Inherited functions

From androidx.media3.exoplayer.trackselection.DefaultTrackSelector
DefaultTrackSelector.Parameters.Builder!

Returns a new Parameters.Builder initialized with the current selection parameters.

java-static Int
getFormatLanguageScore(
    format: Format!,
    language: String?,
    allowUndeterminedFormatLanguage: Boolean
)

Returns a score for how well a language specified in a Format matches a given language.

RendererCapabilities.Listener?

Returns the RendererCapabilities.Listener that the concrete instance uses to listen to the renderer capabilities changes.

Boolean

Returns if this TrackSelector supports setParameters.

java-static Boolean
isSupported(
    @RendererCapabilities.Capabilities formatSupport: Int,
    allowExceedsCapabilities: Boolean
)

This function is deprecated.

Use isFormatSupported instead.

java-static String?

Normalizes the input string to null if it does not define a language, or returns it otherwise.

Unit

Called when the renderer capabilities are changed.

Unit

Called by the player to release the selector.

Pair<ExoTrackSelection.Definition!, Int!>?
selectAudioTrack(
    mappedTrackInfo: MappingTrackSelector.MappedTrackInfo!,
    @RendererCapabilities.Capabilities rendererFormatSupports: Array<Array<IntArray!>!>!,
    @RendererCapabilities.AdaptiveSupport rendererMixedMimeTypeAdaptationSupports: IntArray!,
    params: DefaultTrackSelector.Parameters!
)

Called by selectAllTracks to create a ExoTrackSelection.Definition for an audio track selection.

Pair<ExoTrackSelection.Definition!, Int!>?
selectImageTrack(
    mappedTrackInfo: MappingTrackSelector.MappedTrackInfo!,
    @RendererCapabilities.Capabilities rendererFormatSupports: Array<Array<IntArray!>!>!,
    params: DefaultTrackSelector.Parameters!
)

Called by selectAllTracks to create a ExoTrackSelection.Definition for an image track selection.

ExoTrackSelection.Definition?
selectOtherTrack(
    trackType: Int,
    groups: TrackGroupArray!,
    @RendererCapabilities.Capabilities formatSupport: Array<IntArray!>!,
    params: DefaultTrackSelector.Parameters!
)

Called by selectAllTracks to create a ExoTrackSelection for a renderer whose type is neither video, audio or text.

Pair<ExoTrackSelection.Definition!, Int!>?
selectTextTrack(
    mappedTrackInfo: MappingTrackSelector.MappedTrackInfo!,
    @RendererCapabilities.Capabilities rendererFormatSupports: Array<Array<IntArray!>!>!,
    params: DefaultTrackSelector.Parameters!,
    selectedAudioLanguage: String?
)

Called by selectAllTracks to create a ExoTrackSelection.Definition for a text track selection.

Pair<Array<@NullableType RendererConfiguration!>!, Array<@NullableType ExoTrackSelection!>!>!
selectTracks(
    mappedTrackInfo: MappingTrackSelector.MappedTrackInfo!,
    @RendererCapabilities.Capabilities rendererFormatSupports: Array<Array<IntArray!>!>!,
    @RendererCapabilities.AdaptiveSupport rendererMixedMimeTypeAdaptationSupport: IntArray!,
    mediaPeriodId: MediaSource.MediaPeriodId!,
    timeline: Timeline!
)

Given mapped track information, returns a track selection and configuration for each renderer.

Pair<ExoTrackSelection.Definition!, Int!>?
selectVideoTrack(
    mappedTrackInfo: MappingTrackSelector.MappedTrackInfo!,
    @RendererCapabilities.Capabilities rendererFormatSupports: Array<Array<IntArray!>!>!,
    @RendererCapabilities.AdaptiveSupport mixedMimeTypeSupports: IntArray!,
    params: DefaultTrackSelector.Parameters!
)

Called by selectAllTracks to create a ExoTrackSelection.Definition for a video track selection.

Unit

Called by the player to set the AudioAttributes that will be used for playback.

Unit

Atomically sets the provided parameters for track selection.

Unit

This function is deprecated.

Use setParameters instead.

Unit

Called by the player to provide parameters for track selection.

From androidx.media3.exoplayer.trackselection.MappingTrackSelector
Unit

Called by the player when a TrackSelectorResult previously generated by selectTracks is activated.

TrackSelectorResult!
selectTracks(
    rendererCapabilities: Array<RendererCapabilities!>!,
    trackGroups: TrackGroupArray!,
    periodId: MediaSource.MediaPeriodId!,
    timeline: Timeline!
)

Called by the player to perform a track selection.

From androidx.media3.exoplayer.trackselection.TrackSelector
TrackSelectionParameters!

Returns the current parameters for track selection.

Unit
@CallSuper
init(
    listener: TrackSelector.InvalidationListener!,
    bandwidthMeter: BandwidthMeter!
)

Called by the player to initialize the selector.

Unit

Calls onTrackSelectionsInvalidated to invalidate all previously generated track selections.

Unit

Calls onRendererCapabilitiesChanged to invalidate all previously generated track selections because a renderer's capabilities have changed.

Public constructors

FakeTrackSelector

FakeTrackSelector()

FakeTrackSelector

FakeTrackSelector(
    fakeTrackSelectionFactory: FakeTrackSelector.FakeTrackSelectionFactory!
)
Parameters
fakeTrackSelectionFactory: FakeTrackSelector.FakeTrackSelectionFactory!

The FakeTrackSelectionFactory used to create the FakeTrackSelection instances.

FakeTrackSelector

FakeTrackSelector(mayReuseTrackSelection: Boolean)
Parameters
mayReuseTrackSelection: Boolean

Whether this FakeTrackSelector will reuse s during track selection, when it finds previously-selected track selection using the same TrackGroup.

Public functions

getAllTrackSelections

fun getAllTrackSelections(): (Mutable)List<FakeTrackSelection!>!

Returns list of all FakeTrackSelections that this track selector has made so far.

Protected functions

selectAllTracks

protected fun selectAllTracks(
    mappedTrackInfo: MappingTrackSelector.MappedTrackInfo!,
    @RendererCapabilities.Capabilities rendererFormatSupports: Array<Array<IntArray!>!>!,
    @RendererCapabilities.AdaptiveSupport rendererMixedMimeTypeAdaptationSupports: IntArray!,
    params: DefaultTrackSelector.Parameters!
): Array<@NullableType ExoTrackSelection.Definition!>!

Called from selectTracks to make a track selection for each renderer, prior to overrides and disabled flags being applied.

The implementation should not account for overrides and disabled flags. Track selections generated by this method will be overridden to account for these properties.

If selection parameters include audioOffloadPreferences with audioOffloadMode set to AUDIO_OFFLOAD_MODE_REQUIRED then only audio tracks will be selected. If no audio track is supported in offload, then no track will be selected.

Parameters
mappedTrackInfo: MappingTrackSelector.MappedTrackInfo!

Mapped track information.

@RendererCapabilities.Capabilities rendererFormatSupports: Array<Array<IntArray!>!>!

The Capabilities for each mapped track, indexed by renderer, track group and track (in that order).

@RendererCapabilities.AdaptiveSupport rendererMixedMimeTypeAdaptationSupports: IntArray!

The AdaptiveSupport for mixed MIME type adaptation for the renderer.

params: DefaultTrackSelector.Parameters!

The parameters to use for the track selection.

Returns
Array<@NullableType ExoTrackSelection.Definition!>!

The ExoTrackSelection.Definitions for the renderers. A null entry indicates no selection was made.

Throws
androidx.media3.exoplayer.ExoPlaybackException

If an error occurs while selecting the tracks.