Class SubtitleTrack
java.lang.Object
com.castlabs.android.player.models.Track
com.castlabs.android.player.models.SubtitleTrack
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
ConstructorsConstructorDescriptionCreate a new track instanceSubtitleTrack(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 TypeMethodDescriptionbooleanintReturns the track group index in which this SubtileTrack is embedded.com.google.android.exoplayer2.FormatReturns the underlying format of this track.getId()Returns the id associated with this track.getLabel()Returns the default label for this track.The language of the format.Returns the media mime type associated with this track.Returns the codec mime type associated with this track.getName()The name associated with this track.The language tag as present in the manifest.booleanCheck if the subtitle is of side-loaded type.getUrl()Returns the URL that is used for side-loaded tracks.inthashCode()booleanReturns whether this track is embedded in another TrackGroup.voidsetEmbeddedTrackGroupIndex(int embeddedTrackGroupIndex) Set the track group index in which this TrackGroup is embedded into.voidSet the id associated with this trackvoidsetLanguage(String language) Set the language of this track.voidsetMediaMimeType(String mimeType) Set the media mime type associated with this track.voidsetMimeType(String mimeType) Set the codec mime type associated with this trackvoidSet a name associated with this trackvoidsetOriginalLanguage(String language) Set the manifest language of this track.voidsetSideloaded(boolean sideloaded) Set if the subtitle is of side-loaded type.voidSet the URL that is used to side-load a track.toString()Methods inherited from class com.castlabs.android.player.models.Track
addDescriptor, getDescriptors, getLocalizedLanguageName, getOriginalGroupIndex, getOriginalTrackIndex, getTrackIndex, hasTrickModeId, isTrickModeTrack, setDescriptors, setOriginalGroupIndex, setOriginalTrackIndex, setTrackIndex, setTrickModeIds
-
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
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
Set the language of this track.- Parameters:
language- the language
-
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
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
The name associated with this track.- Returns:
- The name associated with this track
-
setName
Set a name associated with this track- Parameters:
name- the name
-
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
Set the media mime type associated with this track.- Parameters:
mimeType- the mime type
-
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
Set the codec mime type associated with this track- Parameters:
mimeType- the mime type
-
getId
Returns the id associated with this track.- Returns:
- The id associated with this track
-
setId
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_UNSETif 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
Returns the default label for this track. The label is either the DASH label,nameif its set, thelanguage, or it falls back to "Unknown".- Returns:
- The default label for this track
-
getUrl
Returns the URL that is used for side-loaded tracks.- Returns:
- optional URL that is used for side-loaded tracks
-
setUrl
Set the URL that is used to side-load a track.- Parameters:
url- the URL that is used to side-load a track
-
toString
-
hashCode
public int hashCode() -
equals
-