Class BifThumbnailProvider

  • All Implemented Interfaces:
    ThumbnailProvider

    public class BifThumbnailProvider
    extends Object
    implements 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
    • Constructor Detail

      • BifThumbnailProvider

        public BifThumbnailProvider​(@NonNull
                                    com.castlabs.sdk.thumbs.ThumbnailLoader.Factory loaderFactory,
                                    @NonNull
                                    PlayerController playerController,
                                    @NonNull
                                    Uri sourceUri)
    • 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,
                                 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 interface ThumbnailProvider
        Parameters:
        positionUs - The position in microseconds
        callback - The callback that will be triggered once data are available
        thumbnailIndex - Position of the Thumbnail relative to its timestamp
        positionToleranceUs - 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.