Class TrackGroupArray

  • All Implemented Interfaces:
    Bundleable

    public final class TrackGroupArray
    extends Object
    implements Bundleable
    An immutable array of TrackGroups.

    This class is typically used to represent all of the tracks available in a piece of media. Tracks that are known to present the same content are grouped together (e.g., the same video feed provided at different resolutions in an adaptive stream). Tracks that are known to present different content are in separate track groups (e.g., an audio track will not be in the same group as a video track, and an audio track in one language will be in a different group to an audio track in another language).

    • Field Detail

      • length

        public final int length
        The number of groups in the array. Greater than or equal to zero.
    • Constructor Detail

      • TrackGroupArray

        public TrackGroupArray​(TrackGroup... trackGroups)
        Construct a TrackGroupArray from an array of TrackGroups.

        The groups must not contain duplicates.

    • Method Detail

      • get

        public TrackGroup get​(int index)
        Returns the group at a given index.
        Parameters:
        index - The index of the group.
        Returns:
        The group.
      • indexOf

        public int indexOf​(TrackGroup group)
        Returns the index of a group within the array.
        Parameters:
        group - The group.
        Returns:
        The index of the group, or C.INDEX_UNSET if no such group exists.
      • isEmpty

        public boolean isEmpty()
        Returns whether this track group array is empty.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

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