Package com.castlabs.sdk.thumbs

## Class JpgThumbnailProvider

- java.lang.Object
- - com.castlabs.sdk.thumbs.JpgThumbnailProvider

- All Implemented Interfaces:
    `ThumbnailProvider`

      public class JpgThumbnailProvider
      extends Object

  Implementation of the `ThumbnailProvider` that supportes single and gridded thumbnails that are loaded from a URL template that contains $index$.

  The index starts at 1 and is calculated based on the current position and the specified duration of a thumbnail.

  Since:
    4.0.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.castlabs.sdk.thumbs.ThumbnailProvider

      `ThumbnailProvider.Callback`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JpgThumbnailProvider​(com.castlabs.sdk.thumbs.ThumbnailLoader loader, PlayerController playerController, LoadingStrategy loadingStrategy, String urlTemplate, long thumbnailIntervalMs, Point gridSize)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `destroy()` | Free up all the resources, meaning this provider will not be used anymore
    `DownloadableResource[]` | `getDownloadableResources​(String remoteManifestUrl, File basePath, Bundle bundle)` | This methods is used to integrate a thumbnail provider with the downloader plugins and implementation can return an array of resources that should be fetched for offline playback.
    `void` | `getThumbnail​(long positionUs, ThumbnailProvider.Callback callback, int thumbnailIndex)` | Load the thumbnail for the given position and return it through the provided callback.

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

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

- - ### Constructor Detail

    - #### JpgThumbnailProvider

          public JpgThumbnailProvider​(@NonNull
                                      com.castlabs.sdk.thumbs.ThumbnailLoader loader,
                                      @NonNull
                                      PlayerController playerController,
                                      @NonNull
                                      LoadingStrategy loadingStrategy,
                                      @NonNull
                                      String urlTemplate,
                                      long thumbnailIntervalMs,
                                      Point gridSize)

  - ### Method Detail

    - #### destroy

          public void destroy()

      Description copied from interface: `ThumbnailProvider`
      Free up all the resources, meaning this provider will not be used anymore
      Specified by:
        `destroy` in interface `ThumbnailProvider`

    - #### getDownloadableResources

          @Nullable
          public DownloadableResource[] getDownloadableResources​(String remoteManifestUrl,
                                                                 File basePath,
                                                                 Bundle bundle)

      Description copied from interface: `ThumbnailProvider`
      This methods is used to integrate a thumbnail provider with the downloader plugins and implementation can return an array of resources that should be fetched for offline playback.
      Specified by:
        `getDownloadableResources` in interface `ThumbnailProvider`
      Parameters:
        `remoteManifestUrl` - The manifest URL of the remote manifest that is the source of this download
        `basePath` - The base folder for this download
        `bundle` - The bundle that was used to start the initiate the download
      Returns:
        Array of downloadable resources or null

    - #### getThumbnail

          public void getThumbnail​(long positionUs,
                                   ThumbnailProvider.Callback callback,
                                   @ThumbnailIndex
                                   int thumbnailIndex)

      Description copied from interface: `ThumbnailProvider`
      Load the thumbnail for the given position and return it through the provided callback.
      Specified by:
        `getThumbnail` in interface `ThumbnailProvider`
      Parameters:
        `positionUs` - The position in microseconds
        `callback` - The callback that will be triggered once data are available