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` |

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

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

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static Parcelable.Creator<ThumbnailDataTrack>` | `CREATOR` |
    `static 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 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 int` | `TYPE_UNKNOWN` | Type that indicates that the actual thumbnail type is unknown and should be inferred from the URL extension.
    `static 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()` |
    `ThumbnailDataTrack​(com.google.android.exoplayer2.Format format)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `describeContents()` |
    `String` | `getAbsoluteUrl​(String manifest)` | Returns the absolute URL of the thumbnail source.
    `int` | `getBitrate()` |
    `int` | `getGridHeight()` | The grid height (if a thumbnail grid is used)
    `int` | `getGridWidth()` | The grid with (if a thumbnail grid is used)
    `int` | `getMaxIndex()` |
    `long` | `getMaxSegment()` |
    `long` | `getMinSegment()` |
    `long` | `getPeriodDurationMs()` |
    `long` | `getPeriodStartMs()` |
    `Uri` | `getSegmentUrl​(int segment)` | Builds the Uri to locate the corresponding file according to the segment and the previously set `Representation.MultiSegmentRepresentation`.
    `long` | `getStartSegmentNumber()` |
    `long` | `getTemplateDuration()` |
    `int` | `getThumbnailHeight()` |
    `int` | `getThumbnailWidth()` |
    `long` | `getTimeMs()` |
    `int` | `getType()` |
    `String` | `getUrl()` |
    `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()` |
    `boolean` | `isSideloaded()` |
    `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` | `setPeriodDurationMs​(long periodDurationMs)` | 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` | `setTemplateDuration​(long templateDuration)` | Sets the template duration.
    `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 Detail

    - #### 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

  - ### Constructor Detail

    - #### ThumbnailDataTrack

          public ThumbnailDataTrack()

    - #### ThumbnailDataTrack

          public ThumbnailDataTrack​(com.google.android.exoplayer2.Format format)

  - ### Method Detail

    - #### 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

    - #### getTemplateDuration

          public long getTemplateDuration()

      Returns:
        the template duration in seconds

    - #### setTemplateDuration

          public void setTemplateDuration​(long templateDuration)

      Sets the template duration.
      Parameters:
        `templateDuration` - the template duration in seconds

    - #### 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

          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

    - #### getMinSegment

          public long getMinSegment()

    - #### getMaxSegment

          public long getMaxSegment()

    - #### getPeriodDurationMs

          public long getPeriodDurationMs()

      Returns:
        the period duration in milliseconds

    - #### setPeriodDurationMs

          public void setPeriodDurationMs​(long periodDurationMs)

      Sets the period duration
      Parameters:
        `periodDurationMs` - the period duration in milliseconds

    - #### 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

          public String getUrl()

      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()

      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 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()

      Returns:
        True if the source URL for the thumbnail data is specified relative to the manifest