Class ThumbnailDataTrack
java.lang.Object
com.castlabs.android.player.models.ThumbnailDataTrack
- All Implemented Interfaces:
Parcelable
A thumbnail track.
This class is intended to represent a Thumbnail Track in the player model, and not as a mean
of Player configuration anymore.
If you want to side-load a subtitle track. Use
SideloadedTrack.SubtitleBuilder alongside
SdkConsts.INTENT_SIDELOADED_TRACKS_ARRAYLIST if using a Bundle
or PlayerConfig.Builder.sideloadedTracks(ArrayList) if using
PlayerConfig.- Since:
- 4.0.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines the possible thumbnail formats.Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Parcelable.Creator<ThumbnailDataTrack> Creator for Parcelable.static final intType that indicates that the URL to a BIF file is used where the BIF file contains the Index and the thumbnails.static final intType that indicates that a template URL is used where $index$ will be replaced with the thumbnail index starting at 1.static final intType that indicates that the actual thumbnail type is unknown and should be inferred from the URL extension.static final intType that indicates the a URL to a WebVTT file is used where the WebVTT is the index over the thumbnails.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ThumbnailDataTrack(com.google.android.exoplayer2.Format format) Constructor that initializes fields from aFormatobject. -
Method Summary
Modifier and TypeMethodDescriptionintgetAbsoluteUrl(String manifest) Returns the absolute URL of the thumbnail source.intGets the track bitrate.longgetDurationUs(long segmentIndex) Gets the segment's duration in microsecondsintGets the grid height (if a thumbnail grid is used).intGets the grid width (if a thumbnail grid is used).intGets the maximal available index (needed for the downloader integration).longGet's the segment's max indexlongGet's the segment's min indexlongGets the period duration in microseconds.longGets the period relative start time in milliseconds.intGet's the segment countgetSegmentUrl(int segment) Builds the Uri to locate the corresponding file according to the segment and the previously setRepresentation.MultiSegmentRepresentation.longGets the start segment number.intGets the thumbnails height in pixels.intGets the thumbnails width in pixels.longGets the time per thumbnail in milliseconds.longgetTimeUs(int segment) Gets the segment's timestamp in microsecondsintgetType()Gets the type of thumbnails.getUrl()Gets the URL or URL template to the thumbnail data.booleanIf true, caching thumbnails will be enabled if the default loader implementation is used.booleanIf true, caching is enabled, and the default loader implementation is used, the cache will be preserved and cached files will not be removed after a playback session.booleanChecks if the source URL for the thumbnail data is specified relative to the manifest.booleanChecks if this track has been side loaded or not.voidsetBitrate(int bitrate) Sets the bitratevoidsetEnableCache(boolean enableCache) Activates or deactivates cachingvoidsetGridHeight(int gridHeight) Set the grid heightvoidsetGridWidth(int gridWidth) Set the grid widthvoidsetMaxIndex(int maxIndex) Set the maximal available indexvoidsetPeriodDurationUs(long periodDurationUs) Sets the period durationvoidsetPeriodStartMs(long periodStartMs) Set the period relative start timevoidsetPreserveCache(boolean preserveCache) Activates or deactivates cache preservationvoidsetRepresentation(com.google.android.exoplayer2.source.dash.manifest.Representation.MultiSegmentRepresentation representation) Sets the representation.voidsetSideloaded(boolean sideloaded) Set whether this track has been side loaded or not.voidsetStartSegmentNumber(long startSegmentNumber) Set the start segment number.voidsetThumbnailHeight(int height) Set the thumbnails heightvoidsetThumbnailWidth(int width) Set the thumbnails widthvoidsetTimeMs(long timeMs) Set the time per thumbnail in milliseconds.voidsetType(int type) Set the type of thumbnails.voidSet the URL or URL template to the thumbnail datavoidwriteToParcel(Parcel dest, int flags)
-
Field Details
-
TYPE_UNKNOWN
public static final int TYPE_UNKNOWNType that indicates that the actual thumbnail type is unknown and should be inferred from the URL extension.- See Also:
-
TYPE_JPEG_TEMPLATE
public static final int TYPE_JPEG_TEMPLATEType that indicates that a template URL is used where $index$ will be replaced with the thumbnail index starting at 1.If this type is used, make sure that you also specify
gridWidthandgridHeightin case gridded thumbnails are used.- See Also:
-
TYPE_WEBVTT_INDEX
public static final int TYPE_WEBVTT_INDEXType that indicates the a URL to a WebVTT file is used where the WebVTT is the index over the thumbnails.- See Also:
-
TYPE_BIF
public static final int TYPE_BIFType that indicates that the URL to a BIF file is used where the BIF file contains the Index and the thumbnails.- See Also:
-
CREATOR
Creator for Parcelable.
-
-
Constructor Details
-
ThumbnailDataTrack
public ThumbnailDataTrack()Default constructor. -
ThumbnailDataTrack
public ThumbnailDataTrack(com.google.android.exoplayer2.Format format) Constructor that initializes fields from aFormatobject.- Parameters:
format- TheFormatobject to initialize from.
-
-
Method Details
-
getPeriodStartMs
public long getPeriodStartMs()Gets the period relative start time in milliseconds.- Returns:
- period relative start time in milliseconds
-
setPeriodStartMs
public void setPeriodStartMs(long periodStartMs) Set the period relative start time- Parameters:
periodStartMs- the period relative start time in milliseconds
-
getThumbnailWidth
public int getThumbnailWidth()Gets the thumbnails width in pixels.- Returns:
- the thumbnails width in pixels
-
setThumbnailWidth
public void setThumbnailWidth(int width) Set the thumbnails width- Parameters:
width- the thumbnails width in pixels
-
getThumbnailHeight
public int getThumbnailHeight()Gets the thumbnails height in pixels.- Returns:
- the thumbnails height in pixels
-
setThumbnailHeight
public void setThumbnailHeight(int height) Set the thumbnails height- Parameters:
height- the thumbnails height in pixels
-
getGridWidth
public int getGridWidth()Gets the grid width (if a thumbnail grid is used).- Returns:
- The grid with (if a thumbnail grid is used)
-
setGridWidth
public void setGridWidth(int gridWidth) Set the grid width- Parameters:
gridWidth- grid width (columns)
-
getGridHeight
public int getGridHeight()Gets the grid height (if a thumbnail grid is used).- Returns:
- The grid height (if a thumbnail grid is used)
-
setGridHeight
public void setGridHeight(int gridHeight) Set the grid height- Parameters:
gridHeight- grid height (rows)
-
getStartSegmentNumber
public long getStartSegmentNumber()Gets the start segment number.- Returns:
- the start segment number
-
setStartSegmentNumber
public void setStartSegmentNumber(long startSegmentNumber) Set the start segment number.- Parameters:
startSegmentNumber- the start segment number
-
getBitrate
public int getBitrate()Gets the track bitrate.- Returns:
- the track bitrate
-
setBitrate
public void setBitrate(int bitrate) Sets the bitrate- Parameters:
bitrate- the bitrate of the track
-
setRepresentation
public void setRepresentation(com.google.android.exoplayer2.source.dash.manifest.Representation.MultiSegmentRepresentation representation) Sets the representation. This is used to get the download urls of the thumbnails for DASH manifests.- Parameters:
representation- the representation where to get the url info from
-
getSegmentUrl
Builds the Uri to locate the corresponding file according to the segment and the previously setRepresentation.MultiSegmentRepresentation.- Parameters:
segment- the desired segment index- Returns:
- the Uri that points to the corresponding segment index
-
getTimeUs
public long getTimeUs(int segment) Gets the segment's timestamp in microseconds- Parameters:
segment- the desired segment index- Returns:
- the segment's timestamp in microseconds
-
getDurationUs
public long getDurationUs(long segmentIndex) Gets the segment's duration in microseconds- Parameters:
segmentIndex- the desired segment index- Returns:
- the segment's duration in microseconds
-
getSegmentCount
public int getSegmentCount()Get's the segment count- Returns:
- the segment count
-
getMinSegment
public long getMinSegment()Get's the segment's min index- Returns:
- the segment's min index
-
getMaxSegment
public long getMaxSegment()Get's the segment's max index- Returns:
- the segment's max index
-
getPeriodDurationUs
public long getPeriodDurationUs()Gets the period duration in microseconds.- Returns:
- the period duration in microseconds
-
setPeriodDurationUs
public void setPeriodDurationUs(long periodDurationUs) Sets the period duration- Parameters:
periodDurationUs- the period duration in microseconds
-
isSideloaded
public boolean isSideloaded()Checks if this track has been side loaded or not.- Returns:
- whether this track has been side loaded or not.
-
setSideloaded
public void setSideloaded(boolean sideloaded) Set whether this track has been side loaded or not.- Parameters:
sideloaded- whether this track has been side loaded or not
-
getUrl
Gets the URL or URL template to the thumbnail data.- Returns:
- the URL or URL template to the thumbnail data
-
setUrl
Set the URL or URL template to the thumbnail data- Parameters:
url- the URL or URL template to the thumbnail data
-
getTimeMs
public long getTimeMs()Gets the time per thumbnail in milliseconds.- Returns:
- time per thumbnail in milliseconds
-
setTimeMs
public void setTimeMs(long timeMs) Set the time per thumbnail in milliseconds.- Parameters:
timeMs- time per thumbnail in milliseconds
-
getMaxIndex
public int getMaxIndex()Gets the maximal available index (needed for the downloader integration).- Returns:
- the maximal available index (needed for the downloader integration)
-
setMaxIndex
public void setMaxIndex(int maxIndex) Set the maximal available index- Parameters:
maxIndex- the maximal available index
-
getType
public int getType()Gets the type of thumbnails.- Returns:
- the type of thumbnails
-
setType
public void setType(int type) Set the type of thumbnails.- Parameters:
type- the type of thumbnails
-
isEnableCache
public boolean isEnableCache()If true, caching thumbnails will be enabled if the default loader implementation is used.- Returns:
- cache state
-
setEnableCache
public void setEnableCache(boolean enableCache) Activates or deactivates caching- Parameters:
enableCache- desired cache state
-
isPreserveCache
public boolean isPreserveCache()If true, caching is enabled, and the default loader implementation is used, the cache will be preserved and cached files will not be removed after a playback session.- Returns:
- the preserve cache state
-
setPreserveCache
public void setPreserveCache(boolean preserveCache) Activates or deactivates cache preservation- Parameters:
preserveCache- desired cache preservation state
-
describeContents
public int describeContents()- Specified by:
describeContentsin interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcelin interfaceParcelable
-
getAbsoluteUrl
Returns the absolute URL of the thumbnail source.- Parameters:
manifest- The streaming manifest URL. This is used if the thumbnail is relative or does not contain a host name or a scheme. In that case the Manifest base url is used as the reference.- Returns:
- The absolute URL or URL template to the thumbnail data.
-
isRelativeUrl
public boolean isRelativeUrl()Checks if the source URL for the thumbnail data is specified relative to the manifest.- Returns:
- True if the source URL for the thumbnail data is specified relative to the manifest
-