Skip to main content
Skip table of contents

Offline playback

To test this feature and view the example code, please see the Android SDK 5 Example Code Quick Start guide.

Offline Playback (also known as Download to Go) enables users to locally store an online DASH or HLS stream and play it back later on, for example, when network availability is limited.

The feature has the following characteristics:

  • Downloaded streams and their licence keys persist on device storage even if the application is closed.

  • The download continues when the application runs in the background.

  • Downloaded and partially downloaded content can be played back.

  • Multiple downloads can take place concurrently.

  • The download process can run as a service.

  • Both PRM-protected HLS and Widevine-protected DASH streams are supported (only one decryption key per stored content).

  • The application can specify an external storage path for downloads.

Offline playback is not supported for PlayReady, and the API does not yet support the renewal of offline expired licences.
Playback quality may be affected for concurrent active downloads when network bandwidth is constrained.

Lifecycle

The lifecycle for offline playback is as follows. The application:

  • Creates an instance of the OTVDownloadManager class. This object can be instantiated once and remain so for the entire lifespan of the application itself.

Although OTVDownloadManager can be instantiated multiple times, the instances control a single persistent download database. You are encouraged to use a single instance to avoid conflict in configurations.

  • Implements the OTVDownloadListener and registers this listener for download events. Downloads will not be accepted unless a listener is registered.

  • Registers an asset for download. The asset is added to a list of download items, but the download does not begin until the next step.
    For encrypted content, the application needs to provide a callback class for acquiring the licence; this can be the same callback class the application creates for playback of online encrypted content. The licence keys are fetched as soon as the download is registered.

Licences for download may also require additional permissions. The name of this permission varies from one licence server to another. Typical names are storable, persistent or offline.

  • Triggers the effective download and persistency of the media data.

  • Plays the downloaded asset in a similar manner to streamed content. There is no need to provide the licence callback for encrypted content as the licence for the offline content is already stored internally.

  • Purges the asset (and licence if encrypted) when the user no longer needs it.

Prerequisites

The following are required:

  • Your application should already be able to playback clear content.

  • A clear DASH or HLS stream with download enabled is available for testing.

Procedure

The full procedure comprises the following steps:

Additional considerations are required to run downloading as a service.

JavaScript errors detected

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

If this problem persists, please contact our support.