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 classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Parcelable.Creator
<ThumbnailDataTrack> static final int
Type that indicates that the URL to a BIF file is used where the BIF file contains the Index and the thumbnails.static final int
Type that indicates that a template URL is used where $index$ will be replaced with the thumbnail index starting at 1.static final int
Type that indicates that the actual thumbnail type is unknown and should be inferred from the URL extension.static final int
Type 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
-
Method Summary
Modifier and TypeMethodDescriptionint
getAbsoluteUrl
(String manifest) Returns the absolute URL of the thumbnail source.int
long
getDurationUs
(long segmentIndex) Gets the segment's duration in microsecondsint
The grid height (if a thumbnail grid is used)int
The grid with (if a thumbnail grid is used)int
long
Get's the segment's max indexlong
Get's the segment's min indexlong
long
int
Get's the segment countgetSegmentUrl
(int segment) Builds the Uri to locate the corresponding file according to the segment and the previously setRepresentation.MultiSegmentRepresentation
.long
int
int
long
long
getTimeUs
(int segment) Gets the segment's timestamp in microsecondsint
getType()
getUrl()
boolean
If true, caching thumbnails will be enabled if the default loader implementation is used.boolean
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.boolean
boolean
void
setBitrate
(int bitrate) Sets the bitratevoid
setEnableCache
(boolean enableCache) Activates or deactivates cachingvoid
setGridHeight
(int gridHeight) Set the grid heightvoid
setGridWidth
(int gridWidth) Set the grid widthvoid
setMaxIndex
(int maxIndex) Set the maximal available indexvoid
setPeriodDurationUs
(long periodDurationUs) Sets the period durationvoid
setPeriodStartMs
(long periodStartMs) Set the period relative start timevoid
setPreserveCache
(boolean preserveCache) Activates or deactivates cache preservationvoid
setRepresentation
(com.google.android.exoplayer2.source.dash.manifest.Representation.MultiSegmentRepresentation representation) Sets the representation.void
setSideloaded
(boolean sideloaded) Set whether this track has been side loaded or not.void
setStartSegmentNumber
(long startSegmentNumber) Set the start segment number.void
setThumbnailHeight
(int height) Set the thumbnails heightvoid
setThumbnailWidth
(int width) Set the thumbnails widthvoid
setTimeMs
(long timeMs) Set the time per thumbnail in milliseconds.void
setType
(int type) Set the type of thumbnails.void
Set the URL or URL template to the thumbnail datavoid
writeToParcel
(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
gridWidth
andgridHeight
in 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
-
-
Constructor Details
-
ThumbnailDataTrack
public ThumbnailDataTrack() -
ThumbnailDataTrack
public ThumbnailDataTrack(com.google.android.exoplayer2.Format format)
-
-
Method Details
-
getPeriodStartMs
public long getPeriodStartMs()- 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()- 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()- 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()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()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()- 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()- 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()- 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()- 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
- 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()- 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()- 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()- 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:
describeContents
in interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcel
in 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()- Returns:
- True if the source URL for the thumbnail data is specified relative to the manifest
-