Enabling I-Frame thumbnail preview on seek

Like WebVTT thumbnails, I-Frame thumbnails are also used to show previews of the stream using the time slider/progress bar.

Prerequisites

  • The Thumbnail Seeking I-Frame example code project.
  • A test stream with #EXT-X-I-FRAME-STREAM-INF playlists included. The thumbnails example code project provides an example stream.

Process

To present I-Frame thumbnails to your user, you simply need to create an instance of OTVThumbnailView, passing it the stream URL that your OTVAVPlayer is (or will be) playing.

OTVThumbnailView is only intended for use with streams that have #EXT-X-I-FRAME-STREAM-INF playlists as these define where the I-Frames are in the stream. Immediately after initialisation the function will always return false. If #EXT-X-I-FRAME-STREAM-INF playlists are present, the OTVThumbnailView will report true from its hasThumbnails() function once it has determined that they are present (which is an asynchronous operation).

Presenting the thumbnail to the user

See Presenting thumbnails to the user for details of how the example code presents thumbnails to the user.

The thumbnail needs to be updated in the timeSliderDidChange function, which in the case of I-Frame thumbnails simply means calling the thumbnail view's setTime(toSeconds:) function.

Note that you cannot create an OTVThumbnailView in storyboard or interface builder as it needs to be initialised with a stream URL.

DRM considerations

If the stream you are using with OTVThumbnailView is encrypted, you will need to have setup a license delegate with the SDK in the same way as for playback of the encrypted stream.