Skip to main content
Skip table of contents

DASH-IF thumbnails

To test this feature and view the example code, please see the (5.33.x) Android SDK 5 Example Code Quick Start guide.

The operation is instigated by the application providing the OTVVideoView instance with a thumbnail listener before delivering it with the stream’s URL. So that playback start time is not compromised, thumbnails are prepared asynchronously; this also means that the thumbnails are not available at the beginning of playback. The SDK notifies the application of the thumbnail preparation state through the provided listener and, once prepared, will provide the application with a thumbnail view to display.

Preparation time (the time it takes from the start of playback until thumbnails are available for preview) depends on the number of thumbnails and their size (bandwidth). This could take a fraction of a second for short content with few thumbnails to several seconds for long-duration content with a high density of thumbnails.

Preparing a listener in the application

Click here to see the example code.
JAVA
    private IOTVThumbnailListener mThumbnailListener = new IOTVThumbnailListener() {
      @Override
      public void noThumbnails() {
        // Info: No thumbnails for the given stream
      }

      @Override
      public void preparing() {
        // Info: Got a DASH manifest with thumbnails. Preparing thumbnails
      }

      @Override
      public void prepared(OTVThumbnailView xView) {
        // Thumbnails are prepared and the thumbnail view is provided as a parameter
        // Note: this callback is NOT called on the UI thread.
      }

      @Override
      public void error(int reason) {
        // Failed to fetch thumbnails for some reason
        // The reason parameter represents one of the OTVThumbnailError integer constants
      }
      
      @Override
      public void thumbnailsUpdate(List<OTVThumbnail> xThumbnails, int xRemoveCount) {
      // Thumbnail list is updated with a list of thumbnails.
      // Existing thumbnail list needs to be updated by removing the number of thumbnails specified as per remove count from the beginning of the thumbnail list.
      // Once the required number of thumbnails are removed from the thumbnail list, then the new set of thumbnails list is required to be appended to the thumbnail list.
      }
    };

Just before setting the video path of the stream to play, provide the OTVVideoView instance with the thumbnail listener

JAVA
    mOTVVideoView.setThumbnailListener(mThumbnailListener);
    // ...
    mOTVVideoView.setVideoPath(STREAM_URI);

The OTVThumbnailView instance provided in the prepared() callback is used to display all thumbnails. The application must update the view with the correct image by specifying the desired time. The SDK will match the position (in milliseconds) with the correct thumbnail image.

JAVA
thumbnailView.seekTime(positionMs);

The example code implements a simple seek bar in a ThumbnailMediaController class which demonstrates the usage of the thumbnail view provided in the prepared() callback.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.