Package com.castlabs.sdk.thumbs
Class JpgThumbnailProvider
java.lang.Object
com.castlabs.sdk.thumbs.JpgThumbnailProvider
- All Implemented Interfaces:
ThumbnailProvider
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, ThumbnailProvider.ThumbnailResult -
Constructor Summary
ConstructorsConstructorDescriptionJpgThumbnailProvider(com.castlabs.sdk.thumbs.ThumbnailLoader.Factory loaderFactory, PlayerController playerController, LoadingStrategy loadingStrategy, String urlTemplate, long thumbnailIntervalMs, Point gridSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidCancels any queued Thumbnail Requests.voiddestroy()Free up all the resources, meaning this provider will not be used anymoregetDownloadableResources(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.getThumbnail(long positionUs, int thumbnailIndex, long positionToleranceUs) Load the thumbnail for the given position and return aFuturelinked to the operation.voidgetThumbnail(long positionUs, ThumbnailProvider.Callback callback, int thumbnailIndex, long positionToleranceUs) Load the thumbnail for the given position and return it through the provided callback.voidonThumbnailRequestFinished(com.castlabs.sdk.thumbs.ThumbnailRequest request, boolean completed) voidsetLoadingStrategy(LoadingStrategy loadingStrategy) Updates theLoadingStrategyof this provider.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.castlabs.sdk.thumbs.ThumbnailProvider
getThumbnail, getThumbnail
-
Constructor Details
-
JpgThumbnailProvider
public JpgThumbnailProvider(@NonNull com.castlabs.sdk.thumbs.ThumbnailLoader.Factory loaderFactory, @Nullable PlayerController playerController, @Nullable LoadingStrategy loadingStrategy, @NonNull String urlTemplate, long thumbnailIntervalMs, Point gridSize)
-
-
Method Details
-
onThumbnailRequestFinished
public void onThumbnailRequestFinished(com.castlabs.sdk.thumbs.ThumbnailRequest request, boolean completed) -
cancelPendingRequests
public void cancelPendingRequests()Description copied from interface:ThumbnailProviderCancels any queued Thumbnail Requests. Requests currently processing won't be cancelled.- Specified by:
cancelPendingRequestsin interfaceThumbnailProvider
-
setLoadingStrategy
Description copied from interface:ThumbnailProviderUpdates theLoadingStrategyof this provider. If thumbnails are already loading, this might not have an immediate effect.- Specified by:
setLoadingStrategyin interfaceThumbnailProvider- Parameters:
loadingStrategy- the loading strategy to set
-
destroy
public void destroy()Description copied from interface:ThumbnailProviderFree up all the resources, meaning this provider will not be used anymore- Specified by:
destroyin interfaceThumbnailProvider
-
getDownloadableResources
@Nullable public DownloadableResource[] getDownloadableResources(String remoteManifestUrl, File basePath, Bundle bundle) Description copied from interface:ThumbnailProviderThis 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:
getDownloadableResourcesin interfaceThumbnailProvider- Parameters:
remoteManifestUrl- The manifest URL of the remote manifest that is the source of this downloadbasePath- The base folder for this downloadbundle- 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, long positionToleranceUs) Description copied from interface:ThumbnailProviderLoad the thumbnail for the given position and return it through the provided callback.- Specified by:
getThumbnailin interfaceThumbnailProvider- Parameters:
positionUs- The position in microsecondscallback- The callback that will be triggered once data are availablethumbnailIndex- Position of the Thumbnail relative to its timestamppositionToleranceUs- Maximum tolerance time between the time of the requested thumbnail and a potentially already-loaded thumbnail in the index. If a matching nearby thumbnail with data is found, it will be returned immediately. Otherwise the requested thumbnail will be scheduled for fetching. If 0, the exact thumbnail will always be returned, loading it if necessary.
-
getThumbnail
public Future<ThumbnailProvider.ThumbnailResult> getThumbnail(long positionUs, int thumbnailIndex, long positionToleranceUs) Description copied from interface:ThumbnailProviderLoad the thumbnail for the given position and return aFuturelinked to the operation.- Specified by:
getThumbnailin interfaceThumbnailProvider- Parameters:
positionUs- The position in microsecondsthumbnailIndex- Position of the Thumbnail relative to its timestamppositionToleranceUs- Maximum tolerance time between the time of the requested thumbnail and a potentially already-loaded thumbnail in the index. If a matching nearby thumbnail with data is found, it will be returned immediately. Otherwise the requested thumbnail will be scheduled for fetching. If 0, the exact thumbnail will always be returned, loading it if necessary.- Returns:
- a Future identifying the request
-