Thumbnail previews
The CONNECT Player React Native SDK provides, depending on the played-back stream, the ability to capture and display preview thumbnails. This is useful when the user slides through the seek bar. The feature is dependent on the stream's manifest facilitating thumbnails.
Supported thumbnail formats
Support for thumbnails depends on the platform. In this version, support for Live streams is experimental:
Format | Android | iOS/tvOS | Browsers and Connected TV (js) |
---|---|---|---|
DASH-IF | Yes | No | Yes (excl. Safari) |
I-Frame (for HLS) | Yes (clear only) | Yes | No |
WebVTT (Harmonic) | No | No | No |
The following describes how to manage thumbnail previews. It assumes integration into an existing project; see the React Native SDK Integration Guide for details. To view this feature in a standalone project, see the readme in the examples.zip archive in the release files. The API concerning the management of thumbnails involves one event and three properties:
Events
Event Name | Parameters | Notes |
---|---|---|
onThumbnailAvailable | None | This event will be triggered after the App sets the source, as soon as the OTVPlayer gets details of any available thumbnails identified in the source stream's manifest. It is only triggered once for a new content request; the App can then decide to set the displayThumbnail property, for example, when the user slides the seek bar. |
Properties
Property Name | Field | Type | Default value | Notes |
---|---|---|---|---|
thumbnail | Object | |||
display | Boolean | false | true: Display thumbnail content | |
positionInSeconds | Number | Current playback position | The position in seconds of the time value within the seekable duration of the currently played content. | |
style | Object: | borderColor defaults to opaque black | Layout style properties to display the thumbnail relative to the position of the video.
|
It is expected that the thumbnail style and position properties are set prior to setting display to true. After enabling the thumbnail display, it is expected that the App will update the style, coordinates and position according to the user's slide bar movements. All the properties are set to default when the player is initialised, including when zapping.
Errors
Errors are sent to the App only if display is set to true. They are sent through the same onError described in Error Handling. All thumbnail-related errors are under the PLAYER category.
Error Description | Unique Error Code | Notes |
---|---|---|
Thumbnail item error | 7020 | An error occurred while the Player attempted to fetch and display a thumbnail. |
Thumbnail position error | 7021 | Invalid/out-of-range position number. |
Thumbnail styling error | 7022 | Invalid/not-set values in styling object. |
Thumbnail not yet available | 7023 | Thumbnails were requested to be shown while not yet available. |
Thumbnail status unknown | 7024 | Thumbnails were requested to be shown after the player identified no thumbnails available. |
Example code
The example code presents a player view, a slide bar to control and seek thumbnail previews, a button to toggle between streams, fields to control the various properties, and a modal display when error events occur.
Non-error events are added to the logs but are not displayed on the screen. The only thumbnail event is captured in App.js in _onThumbnailAvailable()
; in that part of the code, you can see how the properties are set through setThumbnailProps()
. Capturing the onError event is generic to all player errors, and in this example, it merely shows the modal Alert box.