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.
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.
//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.
//void seekIFrameTo(long position)
mOTVVideoView.seekIFrameTo(position)