Package com.castlabs.android.player.models

# Class SubtitleTrack

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

public class SubtitleTrack extends Track
A subtitle track.

Since:
  3.0.0

- ## Field Summary

  ### Fields inherited from class com.castlabs.android.player.models.Track

  `LABEL_LOCALE, UNKNOWN_INDEX`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SubtitleTrack()`
  Create a new track instance
  `SubtitleTrack(com.google.android.exoplayer2.Format format)`
  Create a new track instance and populate it from the information from the given format.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `int`
  `getEmbeddedTrackGroupIndex()`
  Returns the track group index in which this SubtileTrack is embedded.
  `com.google.android.exoplayer2.Format`
  `getFormat()`
  Returns the underlying format of this track.
  `String`
  `getId()`
  Returns the id associated with this track.
  `String`
  `getLabel()`
  Returns the default label for this track.
  `String`
  `getLanguage()`
  The language of the format.
  `String`
  `getMediaMimeType()`
  Returns the media mime type associated with this track.
  `String`
  `getMimeType()`
  Returns the codec mime type associated with this track.
  `String`
  `getName()`
  The name associated with this track.
  `String`
  `getOriginalLanguage()`
  The language tag as present in the manifest.
  `boolean`
  `getSideloaded()`
  Check if the subtitle is of side-loaded type.
  `String`
  `getUrl()`
  Returns the URL that is used for side-loaded tracks.
  `int`
  `hashCode()`
  `boolean`
  `isEmbedded()`
  Returns whether this track is embedded in another TrackGroup.
  `void`
  `setEmbeddedTrackGroupIndex(int embeddedTrackGroupIndex)`
  Set the track group index in which this TrackGroup is embedded into.
  `void`
  `setId(String id)`
  Set the id associated with this track
  `void`
  `setLanguage(String language)`
  Set the language of this track.
  `void`
  `setMediaMimeType(String mimeType)`
  Set the media mime type associated with this track.
  `void`
  `setMimeType(String mimeType)`
  Set the codec mime type associated with this track
  `void`
  `setName(String name)`
  Set a name associated with this track
  `void`
  `setOriginalLanguage(String language)`
  Set the manifest language of this track.
  `void`
  `setSideloaded(boolean sideloaded)`
  Set if the subtitle is of side-loaded type.
  `void`
  `setUrl(String url)`
  Set the URL that is used to side-load a track.
  `String`
  `toString()`

  ### Methods inherited from class com.castlabs.android.player.models.Track

  `addDescriptor, getDescriptors, getLocalizedLanguageName, getOriginalGroupIndex, getOriginalTrackIndex, getTrackIndex, hasTrickModeId, isTrickModeTrack, setDescriptors, setOriginalGroupIndex, setOriginalTrackIndex, setTrackIndex, setTrickModeIds`

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

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

- ## Constructor Details

  - ### SubtitleTrack

    public SubtitleTrack()
    Create a new track instance

  - ### SubtitleTrack

    public SubtitleTrack(@NonNull com.google.android.exoplayer2.Format format)
    Create a new track instance and populate it from the information from the given format.
    Parameters:
      `format` - the format

- ## Method Details

  - ### getFormat

    @Nullable public com.google.android.exoplayer2.Format getFormat()
    Returns the underlying format of this track.
    Returns:
      the underlying format or `null`

  - ### getLanguage

    @Nullable public String getLanguage()
    The language of the format. Can be null if unknown.

    The language codes are two-letter lowercase ISO language codes (such as "en") as defined by IETF BCP 47.
    Returns:
      The language tag associated with this track or null

  - ### setLanguage

    public void setLanguage(@Nullable String language)
    Set the language of this track.
    Parameters:
      `language` - the language

  - ### getOriginalLanguage

    @Nullable public String getOriginalLanguage()
    The language tag as present in the manifest. Can be null if unknown.
    Returns:
      The manifest language tag associated with this track or null

  - ### setOriginalLanguage

    public void setOriginalLanguage(@Nullable String language)
    Set the manifest language of this track.
    Parameters:
      `language` - the manifest language

  - ### setSideloaded

    public void setSideloaded(boolean sideloaded)
    Set if the subtitle is of side-loaded type. Default is not side-loaded.
    Parameters:
      `sideloaded` - true if side-loaded otherwise false

  - ### getSideloaded

    public boolean getSideloaded()
    Check if the subtitle is of side-loaded type.
    Returns:
      true if side-loaded otherwise false

  - ### getName

    @Nullable public String getName()
    The name associated with this track.
    Returns:
      The name associated with this track

  - ### setName

    public void setName(@Nullable String name)
    Set a name associated with this track
    Parameters:
      `name` - the name

  - ### getMediaMimeType

    @Nullable public String getMediaMimeType()
    Returns the media mime type associated with this track.
    Returns:
      The media mime type associated with this track. This is the type of the media container

  - ### setMediaMimeType

    public void setMediaMimeType(String mimeType)
    Set the media mime type associated with this track.
    Parameters:
      `mimeType` - the mime type

  - ### getMimeType

    @Nullable public String getMimeType()
    Returns the codec mime type associated with this track.
    Returns:
      The codec mime type associated with this track. This is the type of the elementary stream (i.e. the individual samples)

  - ### setMimeType

    public void setMimeType(String mimeType)
    Set the codec mime type associated with this track
    Parameters:
      `mimeType` - the mime type

  - ### getId

    @Nullable public String getId()
    Returns the id associated with this track.
    Returns:
      The id associated with this track

  - ### setId

    public void setId(String id)
    Set the id associated with this track
    Parameters:
      `id` - the id

  - ### isEmbedded

    public boolean isEmbedded()
    Returns whether this track is embedded in another TrackGroup.
    Returns:
      whether this track is embedded in another TrackGroup

  - ### getEmbeddedTrackGroupIndex

    public int getEmbeddedTrackGroupIndex()
    Returns the track group index in which this SubtileTrack is embedded.
    Returns:
      The track group index in which this SubtileTrack is embedded. `C.INDEX_UNSET` if this is not an embedded track.

  - ### setEmbeddedTrackGroupIndex

    public void setEmbeddedTrackGroupIndex(int embeddedTrackGroupIndex)
    Set the track group index in which this TrackGroup is embedded into.
    Parameters:
      `embeddedTrackGroupIndex` - the TrackGroup index in which this Track is embedded

  - ### getLabel

    public String getLabel()
    Returns the default label for this track. The label is either the DASH label, `name` if its set, the `language`, or it falls back to "Unknown".
    Returns:
      The default label for this track

  - ### getUrl

    @Nullable public String getUrl()
    Returns the URL that is used for side-loaded tracks.
    Returns:
      optional URL that is used for side-loaded tracks

  - ### setUrl

    public void setUrl(@Nullable String url)
    Set the URL that is used to side-load a track.
    Parameters:
      `url` - the URL that is used to side-load a track

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### hashCode

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

  - ### equals

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