To test this feature and view the example code, please see the Example Code Quick Start 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.
- Only Widevine-protected DASH streams are supported (only one decryption key per stored content).
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. You are encouraged to use a single instance to avoid conflict in configurations.
OTVDownloadListenerand 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 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 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. For encrypted content, there is no need to provide the licence callback 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.
This guide provides step-by-step instructions on how to adjust your application to support offline playback.
- 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
- Instantiate the OTVDownloadManager
- Register the download
- Start the download process
- Watch the downloaded content
- Delete the download entry
Additional considerations are required to run downloads as a service, see Downloading as a service