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 TypeMethodDescriptionboolean
int
com.google.android.exoplayer2.Format
getId()
getLabel()
Returns the default label for this track.The language of the format.getName()
The name associated with this track.The language tag as present in the manifest.boolean
Check if the subtitle is of side-loaded type.getUrl()
int
hashCode()
boolean
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
Set the id associated with this trackvoid
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 trackvoid
Set a name associated with this trackvoid
setOriginalLanguage
(String language) Set the manifest language of this track.void
setSideloaded
(boolean sideloaded) Set if the subtitle is of side-loaded type.void
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 underlaying 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. 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. 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
-
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.
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
Returns the default label for this track. The label is either the DASH label,name
if its set, thelanguage
, or it falls back to "Unknown".- Returns:
- The default label for this track
-
getUrl
- Returns:
- optional URL that is used for side-loaded tracks
-
setUrl
- Parameters:
url
- the URL that is used to side-load a track
-
toString
-
hashCode
public int hashCode() -
equals
-