com.brightcove.player.mediacontroller

## Class ThumbnailComponent

- java.lang.Object
- - com.brightcove.player.event.AbstractComponent
  - - com.brightcove.player.mediacontroller.ThumbnailComponent

- All Implemented Interfaces:
    Component

      @ListensFor(events={"didSetVideo","configurationChanged","restoreDefaultMediaController"})
       @Emits(events={"thumbnailFormatSelected","seekControllerConfiguration"})
      public final class ThumbnailComponent
      extends AbstractComponent

  Thumbnail Component Plugin.

  This plugin facilitates displaying preview thumbnail

  The main code to be implemented from this class:

       ThumbnailComponent thumbnailComponent = new ThumbnailComponent(brightcoveVideoView);
       thumbnailComponent.setupPreviewThumbnailController();
       ...

  If you are also using the SSAI plugin, you will need additional setup to account for the gap between the absolute and relative playhead position introduced by the Ad breaks.

       eventEmitter.once(AD_DATA_READY, event -> {
           Timeline timeline = event.getProperty(SSAIEvent.VMAP_TIMELINE, Timeline.class);
           thumbnailComponent.setThumbnailDocumentCreator(
                   new SSAIThumbnailDocumentCreatorWrapper(new DefaultThumbnailDocumentCreator(), timeline)
           );
       });

- - ### Field Summary

    - ### Fields inherited from class com.brightcove.player.event.AbstractComponent

      `eventEmitter, listenerTokens`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ThumbnailComponent(BaseVideoView baseVideoView)` Creates a new ThumbnailComponent instance with the `BaseVideoView`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `PreviewLoader` | `getPreviewLoader()` Gets the `PreviewLoader` responsible to download the images and load them into the Thumbnail View.
    `ThumbnailDocumentCreator` | `getThumbnailDocumentCreator()` Returns the `ThumbnailDocumentCreator`
    `void` | `setPreviewLoader(PreviewLoader previewLoader)` Sets a `PreviewLoader` responsible to download the images and load them into the Thumbnail View.
    `void` | `setThumbnailDocumentCreator(ThumbnailDocumentCreator thumbnailDocumentCreator)` Sets the `ThumbnailDocumentCreator` for creating the `ThumbnailDocument`
    `void` | `setThumbnailFormatSelector(PreviewThumbnailFormatSelector selector)` Sets the `PreviewThumbnailFormatSelector`, used to select a `PreviewThumbnailFormat` to create our `ThumbnailDocument`.
    `void` | `setupPreviewThumbnailController()` Finish setting up the component to support Preview Thumbnail scrubbing.

    - ### Methods inherited from class com.brightcove.player.event.AbstractComponent

      `addListener, addOnceListener, getEventEmitter, removeListener, removeListeners`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ThumbnailComponent

          public ThumbnailComponent(@NonNull
                                    BaseVideoView baseVideoView)

      Creates a new ThumbnailComponent instance with the `BaseVideoView`
      Parameters:
        `baseVideoView` - the Brightcove video view

  - ### Method Detail

    - #### setupPreviewThumbnailController

          public void setupPreviewThumbnailController()

      Finish setting up the component to support Preview Thumbnail scrubbing. As part of the setup, a new `BrightcoveMediaController` instance with Preview Thumbnail support is created and is automatically added to the Video View. Because this method creates View components, it MUST be called from the UI thread.

    - #### setThumbnailFormatSelector

          public void setThumbnailFormatSelector(@NonNull
                                                 PreviewThumbnailFormatSelector selector)

      Sets the `PreviewThumbnailFormatSelector`, used to select a `PreviewThumbnailFormat` to create our `ThumbnailDocument`.
      Parameters:
        `selector` - the `PreviewThumbnailFormat` selector

    - #### getPreviewLoader

          @NonNull
          public PreviewLoader getPreviewLoader()

      Gets the `PreviewLoader` responsible to download the images and load them into the Thumbnail View.
      Returns:
        the preview loader

    - #### setPreviewLoader

          public void setPreviewLoader(@NonNull
                                       PreviewLoader previewLoader)

      Sets a `PreviewLoader` responsible to download the images and load them into the Thumbnail View.
      Parameters:
        `previewLoader` - the preview loader

    - #### setThumbnailDocumentCreator

          public void setThumbnailDocumentCreator(@NonNull
                                                  ThumbnailDocumentCreator thumbnailDocumentCreator)

      Sets the `ThumbnailDocumentCreator` for creating the `ThumbnailDocument`
      Parameters:
        `thumbnailDocumentCreator` - the `ThumbnailDocument` creator

    - #### getThumbnailDocumentCreator

          @NonNull
          public ThumbnailDocumentCreator getThumbnailDocumentCreator()

      Returns the `ThumbnailDocumentCreator`