Skip to main content
Skip table of contents

HLS I-frame thumbnails

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

The HLS I-Frame thumbnails view requires an extra decoder/descrambler; this feature may not work on some older devices with decoder hardware limitations.

Preparing the listener

To preview HLS I-Frame thumbnails while performing a seek, the application needs to implement and set IOTVThumbnailListener on the OTVVideoView instance.

Click here to see the example code.
JAVA
private final IOTVThumbnailListener mThumbnailListener = new IOTVThumbnailListener() {
    @Override
    public void noThumbnails() {
      // Couldn't find thumbnails for the given stream
    }

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

    @Override
    public void prepared(@NonNull OTVThumbnailView xView) {
      // This callback method only needs to be implemented for non I-frame thumbnail use cases
    }

    @Override
    public void prepared(@NonNull OTVIFrameThumbnailView xView){
	  // Add the OTVIFrameThumbnailView to Control bar to preview HLS I-Frame thumbnails.
    }

    @Override
    public void error(int reason) {
      // Failed to fetch thumbnails for some reason
    }
  };

The application needs to attach the listener implemented to the player view.

JAVA
   //Player view instance
	mOTVVideoView = new OTVVideoView(this);
	// set listener 
    mOTVVideoView.setThumbnailListener(mThumbnailListener, 20000);

Seek method

While performing a player seek on the control bar, to display the HLS I-Frame thumbnails, the application needs to call seekIFrameTo method on the player view instance. When the control bar is initialised, so that it can call seekIFrameTo when the user seeks, the application needs to pass the player view instance to the control bar.

JAVA
//void seekIFrameTo(long position)	
mOTVVideoView.seekIFrameTo(position)

Disabling I-frame Thumbnail Tracks

If i-frame thumbnails are not required, they can be disabled through player configuration prior to starting playback:

JAVA
// Apply the configuration
OTVPlayerConfiguration.Builder configBuilder = new OTVPlayerConfiguration.Builder();
configBuilder.setDisableLoadingIFrameOnlyTracks(true);
mOTVVideoView.setPlayerConfiguration(configBuilder.build());

// Start playback
mOTVVideoView.setVideoPath("https://video.host/stream.mpd");
mOTVVideoView.start();
JavaScript errors detected

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

If this problem persists, please contact our support.