MappingTrackSelector


@UnstableApi
abstract class MappingTrackSelector : TrackSelector

Known direct subclasses
DefaultTrackSelector

A default TrackSelector suitable for most use cases.

Known indirect subclasses

Base class for TrackSelectors that first establish a mapping between TrackGroups and Renderers, and then from that mapping create a ExoTrackSelection for each renderer.

Summary

Nested types

Provides mapped track information for each renderer.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = )
@IntDef(value = )
annotation MappingTrackSelector.MappedTrackInfo.RendererSupport

Levels of renderer support.

Public constructors

Public functions

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.

Protected functions

abstract 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.

Inherited functions

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

Returns the current parameters for track selection.

RendererCapabilities.Listener?

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

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.

Boolean

Returns if this TrackSelector supports setParameters.

Unit

Called by the player to release the selector.

Unit

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

Unit

Called by the player to provide parameters for track selection.

Public constructors

MappingTrackSelector

MappingTrackSelector()

Public functions

onSelectionActivated

fun onSelectionActivated(info: Any?): Unit

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

Parameters
info: Any?

The value of info in the activated selection.

selectTracks

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

Called by the player to perform a track selection.

Parameters
rendererCapabilities: Array<RendererCapabilities!>!

The RendererCapabilities of the renderers for which tracks are to be selected.

trackGroups: TrackGroupArray!

The available track groups.

periodId: MediaSource.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
TrackSelectorResult!

A TrackSelectorResult describing the track selections.

Throws
androidx.media3.exoplayer.ExoPlaybackException

If an error occurs selecting tracks.

Protected functions

selectTracks

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

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

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 rendererMixedMimeTypeAdaptationSupport: IntArray!

The AdaptiveSupport for mixed MIME type adaptation for the renderer.

mediaPeriodId: MediaSource.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
Pair<Array<@NullableType RendererConfiguration!>!, Array<@NullableType ExoTrackSelection!>!>!

A pair consisting of the track selections and configurations for each renderer. A null configuration indicates the renderer should be disabled, in which case the track selection must also be null. A track selection may also be null for a non-disabled renderer if getTrackType is TRACK_TYPE_NONE.

Throws
androidx.media3.exoplayer.ExoPlaybackException

If an error occurs while selecting the tracks.

Public properties