ThumbnailsAPI Protocol

public protocol ThumbnailsAPI

Thumbnail Interface

Enables retrieving and storing thumbnail preview images and timing info that could then be used e.g. to display on the player seekbar. Requires the ThumbnailsPlugin.

  • Retrieve a thumbnail image for a given player time.

    Requires that the thumbnail data has been successfully loaded i.e. one of the loadThumbnailsFrom() functions has been called during this player session and after the completion handler has returned without an error. If no image could be found for the given timestamp then nil is returned. The client code can take the returned image data to create and display an UIImageView

    Declaration

    Swift

    func getThumbnail(atTimestamp: CMTime) -> ThumbnailImage?

    Parameters

    atTimestamp

    The time point used to locate the thumbnail image.

  • Download thumbnails data encoded in a WebVTT path from the given path.

    All images referenced in the WebVTT file will be downloaded asynchronously and saved in the cache on the device filesystem. This function returns immediately and the download tasks will be carried out asynchronously in the background. Once the tasks are finished, either due to completion or error, the completion handler will be called.

    Declaration

    Swift

    func loadThumbnailsFrom(webVTTtrack vttUrl: URL, completionHandler: Handler?)

    Parameters

    vttUrl

    Either a local file path or a remote URL where the webbtt file exists.

    completionHandler

    optional callback to execute when thumbnails are downloaded and ready.

  • Download thumbnails data which is defined by the given GridThumbnail object.

    The images will be downloaded asynchronously and saved in the cache on the device filesystem. This function returns immediately and the download tasks will be carried out asynchronously in the background. Once the tasks are finished, either due to completion or error, the completion handler will be called.

    Declaration

    Swift

    func loadThumbnailsFrom(gridThumbnail grid: GridThumbnail, completionHandler: Handler?)

    Parameters

    gridThumbnail

    Information about how to generate thumbnails.

  • Delete all the downloaded files/images downloaded to the device filesystem.

    Declaration

    Swift

    func deleteLocalCache()