Additional features
Setting thumbnail bandwidth
Thumbnail bandwidth is defined in the IOP document as the thumbnail size in bits divided by its duration. In some streams, the DASH manifest provides thumbnails in multiple bandwidths.
Thumbnail preparation time and the memory requirements increase with the bandwidth. As an entire set of thumbnails (List<OTVThumbnail> thumbnails
) is stored in the device’s memory during playback, selecting a set of high bandwidth thumbnails, especially with long-content VOD, can use up much of the application’s usable memory. If available memory is exhausted, the SDK will send an Out of memory error to the thumbnail listener and discard the entire set of thumbnails.
The application can specify its preferred thumbnail bandwidth. The SDK will select from the available bandwidths in the stream the thumbnails with the bandwidth closest to the preferred one. If no bandwidth is specified, the lowest bandwidth will be selected. The preferred bandwidth is passed as an extra parameter when setting the thumbnail listener.
mOTVVideoView.setThumbnailListener(mThumbnailListener, 20000);
// ...
mOTVVideoView.setVideoPath(STREAM_URI);
Direct access to thumbnail images and their start-time
If you do not want to display the OTVThumbnailView
instance and want to implement a thumbnail view of your own, you can still have access to the list of images (and their start time) through the provided OTVThumbnailView
instance, which contains a list of OTVThumbnail
elements. Each element consists of the start-time (in milliseconds) and a byte array representing an image bitmap.
// Extract the thumbnail list from the view
List<OTVThumbnail> thumbnails = thumbnailView.getThumbnails();
for (OTVThumbnail thumbnail : thumbnails) {
// Extract start-time and bitmap image from an OTVThumbnail instance
long startTime = thumbnail.getStartTime();
byte[] imageData = thumbnail.getImageData();
Bitmap thumbnailBitmap = BitmapFactory.decodeByteArray(imageData, 0, imageData.length);
}