Package com.castlabs.android.player.models

# Class Track

java.lang.Object
com.castlabs.android.player.models.Track

Direct Known Subclasses:
  `AudioTrack`, `SubtitleTrack`, `VideoTrack`

public class Track extends Object
Base class for tracks that exposes a track index to uniquely identify the track within a player model.

Since:
  3.0.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static Locale`
  `LABEL_LOCALE`
  For Tracks that display a language, this Locale will be used.
  `static final int`
  `UNKNOWN_INDEX`
  Indicates that an index is unknown

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Track()`
  Default constructor for Track.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addDescriptor(DashDescriptor dashDescriptor)`
  Adds a Dash descriptor to the list
  `boolean`
  `equals(Object obj)`
  `List<DashDescriptor>`
  `getDescriptors()`
  Gets the list of Dash descriptors for this track.
  `static String`
  `getLocalizedLanguageName(String language)`
  Returns the given language code's name, in the `Locale` determined by `LABEL_LOCALE`.
  `int`
  `getOriginalGroupIndex()`
  Gets the original group index of this group, when no filters were applied.
  `int`
  `getOriginalTrackIndex()`
  Gets the original track index of this track, when no filters were applied.
  `int`
  `getTrackIndex()`
  Gets the track index of this track.
  `int`
  `hashCode()`
  `boolean`
  `hasTrickModeId(int trickModeId)`
  Checks if this track has the specified trick mode ID.
  `boolean`
  `isTrickModeTrack()`
  Checks if this track is a trick mode track.
  `void`
  `setDescriptors(List<DashDescriptor> descriptors)`
  Sets the Dash descriptors list
  `void`
  `setOriginalGroupIndex(int originalGroupIndex)`
  Set the original index of this group
  `void`
  `setOriginalTrackIndex(int originalTrackIndex)`
  Set the original index of this track
  `void`
  `setTrackIndex(int trackIndex)`
  Set the track index of this track
  `void`
  `setTrickModeIds(Integer[] trickModeIds)`
  Sets the trick mode IDs for this track.

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

  `getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### UNKNOWN_INDEX

    public static final int UNKNOWN_INDEX
    Indicates that an index is unknown
    See Also:
      - Constant Field Values

  - ### LABEL_LOCALE

    public static Locale LABEL_LOCALE
    For Tracks that display a language, this Locale will be used. This is the language in which the Track's language name is displayed. If null (default) will use the current system Locale.

- ## Constructor Details

  - ### Track

    public Track()
    Default constructor for Track.

- ## Method Details

  - ### getTrackIndex

    public int getTrackIndex()
    Gets the track index of this track.
    Returns:
      The track index of this track

  - ### setTrackIndex

    public void setTrackIndex(int trackIndex)
    Set the track index of this track
    Parameters:
      `trackIndex` - the track index

  - ### getOriginalTrackIndex

    public int getOriginalTrackIndex()
    Gets the original track index of this track, when no filters were applied.
    Returns:
      The original index if this track, when no filters where applied

  - ### setOriginalTrackIndex

    public void setOriginalTrackIndex(int originalTrackIndex)
    Set the original index of this track
    Parameters:
      `originalTrackIndex` - The original index

  - ### getOriginalGroupIndex

    public int getOriginalGroupIndex()
    Gets the original group index of this group, when no filters were applied.
    Returns:
      The original index if this group, when no filters where applied

  - ### setOriginalGroupIndex

    public void setOriginalGroupIndex(int originalGroupIndex)
    Set the original index of this group
    Parameters:
      `originalGroupIndex` - The original index

  - ### setTrickModeIds

    public void setTrickModeIds(@NonNull Integer[] trickModeIds)
    Sets the trick mode IDs for this track.
    Parameters:
      `trickModeIds` - An array of trick mode IDs.

  - ### isTrickModeTrack

    public boolean isTrickModeTrack()
    Checks if this track is a trick mode track.
    Returns:
      `true` if this track is a trick mode track, `false` otherwise.

  - ### hasTrickModeId

    public boolean hasTrickModeId(int trickModeId)
    Checks if this track has the specified trick mode ID.
    Parameters:
      `trickModeId` - The trick mode ID to check for.
    Returns:
      `true` if this track has the specified trick mode ID, `false` otherwise.

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`

  - ### addDescriptor

    public void addDescriptor(@NonNull DashDescriptor dashDescriptor)
    Adds a Dash descriptor to the list
    Parameters:
      `dashDescriptor` - Dash descriptor to add

  - ### getDescriptors

    @Nullable public List<DashDescriptor> getDescriptors()
    Gets the list of Dash descriptors for this track.
    Returns:
      list of Dash descriptors for this track.

  - ### setDescriptors

    public void setDescriptors(@Nullable List<DashDescriptor> descriptors)
    Sets the Dash descriptors list
    Parameters:
      `descriptors` - list of Dash descriptors to set.

  - ### getLocalizedLanguageName

    @NonNull public static String getLocalizedLanguageName(@Nullable String language)
    Returns the given language code's name, in the `Locale` determined by `LABEL_LOCALE`. If such is null, the current device Locale will be used.
    Parameters:
      `language` - the language code
    Returns:
      the language name