Class TracksInfo.TrackGroupInfo

  • All Implemented Interfaces:
    Bundleable
    Enclosing class:
    TracksInfo

    public static final class TracksInfo.TrackGroupInfo
    extends Object
    implements Bundleable
    Information about tracks in a TrackGroup: their C.TrackType, if their format is supported by the player and if they are selected for playback.
    • Constructor Detail

      • TrackGroupInfo

        public TrackGroupInfo​(TrackGroup trackGroup,
                              @FormatSupport
                              int[] trackSupport,
                              @com.google.android.exoplayer2.C.TrackType int trackType,
                              boolean[] tracksSelected)
        Constructs a TrackGroupInfo.
        Parameters:
        trackGroup - The TrackGroup described.
        trackSupport - The C.FormatSupport of each track in the trackGroup.
        trackType - The C.TrackType of the tracks in the trackGroup.
        tracksSelected - Whether a track is selected for each track in trackGroup.
    • Method Detail

      • getTrackGroup

        public TrackGroup getTrackGroup()
        Returns the TrackGroup described by this TrackGroupInfo.
      • getTrackSupport

        @FormatSupport
        public int getTrackSupport​(int trackIndex)
        Returns the level of support for a track in a TrackGroup.
        Parameters:
        trackIndex - The index of the track in the TrackGroup.
        Returns:
        The C.FormatSupport of the track.
      • isTrackSupported

        public boolean isTrackSupported​(int trackIndex)
        Returns if a track in a TrackGroup is supported for playback.
        Parameters:
        trackIndex - The index of the track in the TrackGroup.
        Returns:
        True if the track's format can be played, false otherwise.
      • isSelected

        public boolean isSelected()
        Returns if at least one track in a TrackGroup is selected for playback.
      • isSupported

        public boolean isSupported()
        Returns if at least one track in a TrackGroup is supported.
      • isTrackSelected

        public boolean isTrackSelected​(int trackIndex)
        Returns if a track in a TrackGroup is selected for playback.

        Multiple tracks of a track group may be selected. This is common in adaptive streaming, where multiple tracks of different quality are selected and the player switches between them depending on the network and the TrackSelectionParameters.

        While this class doesn't provide which selected track is currently playing, some player implementations have ways of getting such information. For example ExoPlayer provides this information in ExoTrackSelection.getSelectedFormat.

        Parameters:
        trackIndex - The index of the track in the TrackGroup.
        Returns:
        true if the track is selected, false otherwise.
      • getTrackType

        public @com.google.android.exoplayer2.C.TrackType int getTrackType()
        Returns the C.TrackType of the tracks in the TrackGroup. Tracks in a group are all of the same type.
      • equals

        public boolean equals​(@Nullable
                              Object other)
        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