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

    • 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