Package com.castlabs.android.player.models

# Class ThumbnailDataTrack

java.lang.Object
com.castlabs.android.player.models.ThumbnailDataTrack

All Implemented Interfaces:
  `Parcelable`

public class ThumbnailDataTrack extends Object implements 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
  Modifier and Type
  Class
  Description
  `static @interface`
  `ThumbnailDataTrack.ThumbnailFormat`
  Defines the possible thumbnail formats.

  ## Nested classes/interfaces inherited from interface android.os.Parcelable

  `Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Parcelable.Creator<ThumbnailDataTrack>`
  `CREATOR`
  Creator for Parcelable.
  `static final int`
  `TYPE_BIF`
  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_JPEG_TEMPLATE`
  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_UNKNOWN`
  Type that indicates that the actual thumbnail type is unknown and should be inferred from the URL extension.
  `static final int`
  `TYPE_WEBVTT_INDEX`
  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

  Constructors
  Constructor
  Description
  `ThumbnailDataTrack()`
  Default constructor.
  `ThumbnailDataTrack(com.google.android.exoplayer2.Format format)`
  Constructor that initializes fields from a `Format` object.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `describeContents()`
  `String`
  `getAbsoluteUrl(String manifest)`
  Returns the absolute URL of the thumbnail source.
  `int`
  `getBitrate()`
  Gets the track bitrate.
  `long`
  `getDurationUs(long segmentIndex)`
  Gets the segment's duration in microseconds
  `int`
  `getGridHeight()`
  Gets the grid height (if a thumbnail grid is used).
  `int`
  `getGridWidth()`
  Gets the grid width (if a thumbnail grid is used).
  `int`
  `getMaxIndex()`
  Gets the maximal available index (needed for the downloader integration).
  `long`
  `getMaxSegment()`
  Get's the segment's max index
  `long`
  `getMinSegment()`
  Get's the segment's min index
  `long`
  `getPeriodDurationUs()`
  Gets the period duration in microseconds.
  `long`
  `getPeriodStartMs()`
  Gets the period relative start time in milliseconds.
  `int`
  `getSegmentCount()`
  Get's the segment count
  `Uri`
  `getSegmentUrl(int segment)`
  Builds the Uri to locate the corresponding file according to the segment and the previously set `Representation.MultiSegmentRepresentation`.
  `long`
  `getStartSegmentNumber()`
  Gets the start segment number.
  `int`
  `getThumbnailHeight()`
  Gets the thumbnails height in pixels.
  `int`
  `getThumbnailWidth()`
  Gets the thumbnails width in pixels.
  `long`
  `getTimeMs()`
  Gets the time per thumbnail in milliseconds.
  `long`
  `getTimeUs(int segment)`
  Gets the segment's timestamp in microseconds
  `int`
  `getType()`
  Gets the type of thumbnails.
  `String`
  `getUrl()`
  Gets the URL or URL template to the thumbnail data.
  `boolean`
  `isEnableCache()`
  If true, caching thumbnails will be enabled if the default loader implementation is used.
  `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.
  `boolean`
  `isRelativeUrl()`
  Checks if the source URL for the thumbnail data is specified relative to the manifest.
  `boolean`
  `isSideloaded()`
  Checks if this track has been side loaded or not.
  `void`
  `setBitrate(int bitrate)`
  Sets the bitrate
  `void`
  `setEnableCache(boolean enableCache)`
  Activates or deactivates caching
  `void`
  `setGridHeight(int gridHeight)`
  Set the grid height
  `void`
  `setGridWidth(int gridWidth)`
  Set the grid width
  `void`
  `setMaxIndex(int maxIndex)`
  Set the maximal available index
  `void`
  `setPeriodDurationUs(long periodDurationUs)`
  Sets the period duration
  `void`
  `setPeriodStartMs(long periodStartMs)`
  Set the period relative start time
  `void`
  `setPreserveCache(boolean preserveCache)`
  Activates or deactivates cache preservation
  `void`
  `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 height
  `void`
  `setThumbnailWidth(int width)`
  Set the thumbnails width
  `void`
  `setTimeMs(long timeMs)`
  Set the time per thumbnail in milliseconds.
  `void`
  `setType(int type)`
  Set the type of thumbnails.
  `void`
  `setUrl(String url)`
  Set the URL or URL template to the thumbnail data
  `void`
  `writeToParcel(Parcel dest, int flags)`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### TYPE_UNKNOWN

    public static final int TYPE_UNKNOWN
    Type that indicates that the actual thumbnail type is unknown and should be inferred from the URL extension.
    See Also:
      - Constant Field Values

  - ### TYPE_JPEG_TEMPLATE

    public static final int TYPE_JPEG_TEMPLATE
    Type 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` and `gridHeight` in case gridded thumbnails are used.

    See Also:
      - Constant Field Values

  - ### TYPE_WEBVTT_INDEX

    public static final int TYPE_WEBVTT_INDEX
    Type that indicates the a URL to a WebVTT file is used where the WebVTT is the index over the thumbnails.
    See Also:
      - Constant Field Values

  - ### TYPE_BIF

    public static final int TYPE_BIF
    Type that indicates that the URL to a BIF file is used where the BIF file contains the Index and the thumbnails.
    See Also:
      - Constant Field Values

  - ### CREATOR

    public static final Parcelable.Creator<ThumbnailDataTrack> 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 a `Format` object.
    Parameters:
      `format` - The `Format` object 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

    public Uri getSegmentUrl(int segment)
    Builds the Uri to locate the corresponding file according to the segment and the previously set `Representation.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

    public String getUrl()
    Gets the URL or URL template to the thumbnail data.
    Returns:
      the URL or URL template to the thumbnail data

  - ### setUrl

    public void setUrl(String url)
    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:
      `describeContents` in interface `Parcelable`

  - ### writeToParcel

    public void writeToParcel(Parcel dest, int flags)
    Specified by:
      `writeToParcel` in interface `Parcelable`

  - ### getAbsoluteUrl

    public String getAbsoluteUrl(String manifest)
    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