Package com.google.android.exoplayer2.trackselection

## Class TrackSelectionOverride

- java.lang.Object
- - com.google.android.exoplayer2.trackselection.TrackSelectionOverride

- All Implemented Interfaces:
    `Bundleable`

      public final class TrackSelectionOverride
      extends Object
      implements Bundleable

  A track selection override, consisting of a `TrackGroup` and the indices of the tracks within the group that should be selected.

  A track selection override is applied during playback if the media being played contains a `TrackGroup` equal to the one in the override. If a `TrackSelectionParameters` contains only one override of a given track type that applies to the media, this override will be used to control the track selection for that type. If multiple overrides of a given track type apply then the player will apply only one of them.

  If `trackIndices` is empty then the override specifies that no tracks should be selected. Adding an empty override to a `TrackSelectionParameters` is similar to `disabling a track type`, except that an empty override will only be applied if the media being played contains a `TrackGroup` equal to the one in the override. Conversely, disabling a track type will prevent selection of tracks of that type for all media.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Bundleable

      `Bundleable.Creator<T extends Bundleable>`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static Bundleable.Creator<TrackSelectionOverride>` | `CREATOR` | Object that can restore `TrackSelectionOverride` from a `Bundle`.
    `TrackGroup` | `mediaTrackGroup` | The media `TrackGroup` whose `trackIndices` are forced to be selected.
    `ImmutableList<Integer>` | `trackIndices` | The indices of tracks in a `TrackGroup` to be selected.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TrackSelectionOverride​(TrackGroup mediaTrackGroup, int trackIndex)` | Constructs an instance to force `trackIndex` in `trackGroup` to be selected.
    `TrackSelectionOverride​(TrackGroup mediaTrackGroup, List<Integer> trackIndices)` | Constructs an instance to force `trackIndices` in `trackGroup` to be selected.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object obj)` |
    `@com.google.android.exoplayer2.C.TrackType int` | `getType()` | Returns the `C.TrackType` of the overridden track group.
    `int` | `hashCode()` |
    `Bundle` | `toBundle()` | Returns a `Bundle` representing the information stored in this object.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### mediaTrackGroup

          public final TrackGroup mediaTrackGroup

      The media `TrackGroup` whose `trackIndices` are forced to be selected.

    - #### trackIndices

          public final ImmutableList<Integer> trackIndices

      The indices of tracks in a `TrackGroup` to be selected.

    - #### CREATOR

          public static final Bundleable.Creator<TrackSelectionOverride> CREATOR

      Object that can restore `TrackSelectionOverride` from a `Bundle`.

  - ### Constructor Detail

    - #### TrackSelectionOverride

          public TrackSelectionOverride​(TrackGroup mediaTrackGroup,
                                        int trackIndex)

      Constructs an instance to force `trackIndex` in `trackGroup` to be selected.
      Parameters:
        `mediaTrackGroup` - The media `TrackGroup` for which to override the track selection.
        `trackIndex` - The index of the track in the `TrackGroup` to select.

    - #### TrackSelectionOverride

          public TrackSelectionOverride​(TrackGroup mediaTrackGroup,
                                        List<Integer> trackIndices)

      Constructs an instance to force `trackIndices` in `trackGroup` to be selected.
      Parameters:
        `mediaTrackGroup` - The media `TrackGroup` for which to override the track selection.
        `trackIndices` - The indices of the tracks in the `TrackGroup` to select.

  - ### Method Detail

    - #### getType

          public @com.google.android.exoplayer2.C.TrackType int getType()

      Returns the `C.TrackType` of the overridden track group.

    - #### equals

          public boolean equals​(@Nullable
                                Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toBundle

          public Bundle toBundle()

      Description copied from interface: `Bundleable`
      Returns a `Bundle` representing the information stored in this object.
      Specified by:
        `toBundle` in interface `Bundleable`