Skip to main content
Skip table of contents

Unified API playback of offline content (Download to Go)

To test this feature and view the example code, please see the (5.33.x) Unified API Example Code Quick Start guide.

Most of the process of handling offline content, clear or encrypted, makes use of the OTVDownloadManager class, as described in Offline playback , independent of which playback API is used - the OTVVideoView or the OTVUPIPlayer methods. Specifying storage location, registering downloads, retrieving and renewing persisted licences, management of the download process, adding or removing download assets - all of these are common to the two approaches.

The difference is only in intiating a playback. Whereas with OTVVideoView we use setVideoPathFromDownloadItem(item), with the OTVUPIPlayer we specify the download item to play through its UUID in the OTVUPISource structure. However, note that underneath the hood, OTVUPIPlayer makes use of OTVVideoView.

Playback of a downloaded offline asset

In the process of downloading an asset through OTVDownloadManager , the application would get the unique ID (UUID) of the offline asset.

When instantiating the OTVUPISource through its constructor

CODE
OTVUPISource(String xSrc, String xType, String xToken, String xAdTagURL, TextTrack[] xTextTracks, Drm xDrm)

the first two parameters can specify an offline item to playback:

  • xSrc - provide the UUID string rather than its URI.

  • xType - set to "application/x-offline" to indicate this is a downloaded asset.

For encrypted content, there is no need to specify the DRM parameters of the downloaded item, as the keys are already fetched and securely stored during the download process.

Error handling

As with other errors reporting with the UPI interface, errors are reported through the OTVUPIEventListener listener. The only error reported by the OTVUPIPlayer specific to playback of offline assets is if the player cannot translate the UUID into a valid playable asset. The application, when implementing the listener, must add an implementation for the following error report:

CODE
void onOfflineStreamNotAvailable()
JavaScript errors detected

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

If this problem persists, please contact our support.