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
  • 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 underlaying 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. 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. 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
    • 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. 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:
      optional URL that is used for side-loaded tracks
    • setUrl

      public void setUrl(@Nullable String url)
      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