Class DefaultThumbnailView

java.lang.Object
android.view.View
com.castlabs.sdk.thumbs.DefaultThumbnailView
All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback

public class DefaultThumbnailView extends View
This is a default implementation of a renderer that can be used with a ThumbnailProvider.

If you are not using the ThumbsPlugin.ThumbnailViewComponent to automatically add this renderer to the PlayerView, you have to manually add it on top of the PlayerView or somewhere else in your view hierarchy. If you are not using the default plugin infrastructure and you manually create this component, please ensure that you call setThumbnailProvider(ThumbnailProvider) to specify the provider that will be used by this renderer. You can for example use ThumbsPlugin.createProvider(PlayerController, ThumbnailDataTrack, LoadingStrategy, String, ThumbnailLoader.Factory) to create a new provider instance. You can get the internal instance, if any, using PlayerController.getComponentView(int) and passing ThumbsPlugin.PRESTO_DEFAULT_THUMBNAIL_VIEW as param.

Since:
4.0.0
  • Constructor Details

    • DefaultThumbnailView

      public DefaultThumbnailView(Context context)
    • DefaultThumbnailView

      public DefaultThumbnailView(Context context, AttributeSet attrs)
    • DefaultThumbnailView

      public DefaultThumbnailView(Context context, AttributeSet attrs, int defStyleAttr)
  • Method Details

    • getThumbnailTolerance

      public long getThumbnailTolerance()
      Returns:
      the current thumbnail time tolerance in microseconds
    • setThumbnailTolerance

      public void setThumbnailTolerance(long thumbnailToleranceUs)
      Set the thumbnail fetching tolerance when calling show(long, Callback, int).

      Defines the maximum 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.

      Parameters:
      thumbnailToleranceUs - the tolerance in microseconds
    • setBorderPaint

      public void setBorderPaint(@Nullable Paint borderPaint)
      Sets the Paint to use for rendering the Thumbnails. If null, the border will not be rendered.
      Parameters:
      borderPaint - the Paint to use
    • setThumbnailProvider

      public void setThumbnailProvider(@Nullable ThumbnailProvider thumbnailProvider)
    • show

      public void show(long positionUs, DefaultThumbnailView.Callback sizeCallback, @ThumbnailIndex int thumbnailIndex)
      Render a thumbnail for the given timestamp in microseconds
      Parameters:
      positionUs - The position to render a thumbnail for in microseconds
      sizeCallback - The callback that will be used to query the target size and location
      thumbnailIndex - The type thumbnail to return, one of ThumbsPlugin.THUMBNAIL_INDEX_CURRENT, ThumbsPlugin.THUMBNAIL_INDEX_NEXT or ThumbsPlugin.THUMBNAIL_INDEX_CLOSEST
    • show

      public void show(long positionUs, DefaultThumbnailView.Callback sizeCallback)
      Render the current thumbnail for the given timestamp in microseconds
      Parameters:
      positionUs - The position to render a thumbnail for in microseconds
      sizeCallback - The callback that will be used to query the target size and location
    • hide

      public void hide()
      Hide the thumbnails
    • clear

      public void clear()
      Clear the currently displayed Thumbnail, if any