Package com.castlabs.sdk.thumbs
Class BifThumbnailProvider
java.lang.Object
com.castlabs.sdk.thumbs.BifThumbnailProvider
- All Implemented Interfaces:
ThumbnailProvider
Provided thumbnails from BIF files.
BIF files are essentially containers that wrap a set of jpegs and add an index that allows to map a jpeg to both a timestamp and the absolute location in the file. This enabled good streaming support as well as a compact format.
This implementation supports both blocked loading as well as streaming support for the BIF data.
- Since:
- 4.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.castlabs.sdk.thumbs.ThumbnailProvider
ThumbnailProvider.Callback, ThumbnailProvider.ThumbnailResult
-
Constructor Summary
ConstructorsConstructorDescriptionBifThumbnailProvider
(com.castlabs.sdk.thumbs.ThumbnailLoader.Factory loaderFactory, PlayerController playerController, Uri sourceUri) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Cancels any queued Thumbnail Requests.void
destroy()
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) Load the exact thumbnail for the given position and return aFuture
linked to the operation.getThumbnail
(long positionUs, int thumbnailIndex, long positionToleranceUs) Load the thumbnail for the given position and return aFuture
linked to the operation.void
getThumbnail
(long positionUs, ThumbnailProvider.Callback callback, int thumbnailIndex) Load the exact thumbnail for the given position and return it through the provided callback.void
getThumbnail
(long positionUs, ThumbnailProvider.Callback callback, int thumbnailIndex, long positionToleranceUs) Load the thumbnail for the given position and return it through the provided callback.void
setLoadingStrategy
(LoadingStrategy loadingStrategy) Updates theLoadingStrategy
of this provider.
-
Constructor Details
-
BifThumbnailProvider
public BifThumbnailProvider(@NonNull com.castlabs.sdk.thumbs.ThumbnailLoader.Factory loaderFactory, @NonNull PlayerController playerController, @NonNull Uri sourceUri)
-
-
Method Details
-
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 interfaceThumbnailProvider
-
setLoadingStrategy
Description copied from interface:ThumbnailProvider
Updates theLoadingStrategy
of this provider. If thumbnails are already loading, this might not have an immediate effect.- Specified by:
setLoadingStrategy
in interfaceThumbnailProvider
- Parameters:
loadingStrategy
- the loading strategy to set
-
cancelPendingRequests
public void cancelPendingRequests()Description copied from interface:ThumbnailProvider
Cancels any queued Thumbnail Requests. Requests currently processing won't be cancelled.- Specified by:
cancelPendingRequests
in interfaceThumbnailProvider
-
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 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) Description copied from interface:ThumbnailProvider
Load the exact thumbnail for the given position and return it through the provided callback.Same as calling
ThumbnailProvider.getThumbnail(long, Callback, int, long)
with a tolerance of 0- Specified by:
getThumbnail
in interfaceThumbnailProvider
- Parameters:
positionUs
- The position in microsecondscallback
- The callback that will be triggered once data are availablethumbnailIndex
- Position of the Thumbnail relative to its timestamp
-
getThumbnail
Description copied from interface:ThumbnailProvider
Load the exact thumbnail for the given position and return aFuture
linked to the operation.Same as calling
ThumbnailProvider.getThumbnail(long, int, long)
with a tolerance of 0- Specified by:
getThumbnail
in interfaceThumbnailProvider
- Parameters:
positionUs
- The position in microsecondsthumbnailIndex
- Position of the Thumbnail relative to its timestamp- Returns:
- a Future identifying the request
-
getThumbnail
public Future<ThumbnailProvider.ThumbnailResult> getThumbnail(long positionUs, int thumbnailIndex, long positionToleranceUs) Description copied from interface:ThumbnailProvider
Load the thumbnail for the given position and return aFuture
linked to the operation.- Specified by:
getThumbnail
in 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
-
getThumbnail
public void getThumbnail(long positionUs, ThumbnailProvider.Callback callback, int thumbnailIndex, long positionToleranceUs) Description copied from interface:ThumbnailProvider
Load the thumbnail for the given position and return it through the provided callback.- Specified by:
getThumbnail
in 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.
-