To test this feature and view the example code, please see the Example Code Quick Setup guide.
Offline Playback (also known as Download to Go), enables users to locally store an online DASH 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.
The API does not yet support renewal of offline expired licences.Playback quality may be affected for concurrent active downloads when network bandwidth is constrained.
The lifecycle for offline playback is as follows.
The application creates an instance of the
OTVDownloadManagerclass. This object can be instantiated once and remain so for the entire lifespan of the application itself.
OTVDownloadManagercan be instantiated multiple times, the instances control a single persistent download database. Integrators are encouraged to use a single instance to avoid conflict in configurations.
The application implements the
OTVDownloadListenerand registers this listener for download events. Downloads will not be accepted unless a listener is registered.
The application registers an asset for download. The asset is added to a list of download items, but 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 is creating 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
The application triggers the effective download and persistency of the media data.
The application plays the downloaded asset in a similar manner to streamed content. For encrypted content, there is no need to provide the licence callback as the licence for the offline content is already stored internally.
- The application purges the asset (and licence if encrypted) when the user no longer needs it.
This guide provides step-by-step instructions on how to adjust your application to support offline playback. Additional steps are required where the content is encrypted.
- Your application should already be able to playback clear content.
- You should have a clear DASH stream with download enabled available for testing.
The full procedure comprises the following steps:
- Add the dependencies
- Register the download
- Start the download process
- Watch the downloaded content
- Delete the download entry
Additional considerations are required to run downloads in a service, see Downloading as a service