DownloadManager

interface DownloadManager

A Manager for Download assets. Takes care of managing download tasks and retrieving cached downloads.

Types

Link copied to clipboard
object Companion

DownloadManager singleton

Link copied to clipboard
interface Listener

Listener that listens for download events

Properties

Link copied to clipboard
Link copied to clipboard
abstract var drmDelegate: DRMDelegate

Functions

Link copied to clipboard
abstract fun addListener(listener: DownloadManager.Listener)

Adds a Listener to the list of download events listeners.

Link copied to clipboard
abstract suspend fun enqueueDownload(request: DownloadRequest): Result<Download, Error>

Returns a valid Download object upon successful Queueing of request. Also, DownloadManager.Listener.onDownloadStateChanged will be triggered Note that Download.mediaURL will correspond to DownloadRequest.mediaURL.

Link copied to clipboard
abstract fun getAllDownloads(): List<Download>

Returns all downloads. Includes downloads that are ongoing as well as terminal.

Link copied to clipboard

Returns current downloads. Downloads that are in terminal states (i.e. completed or failed) are not included.

Link copied to clipboard
abstract fun isInitialized(): Boolean

Determines whether the manager has completed initialization.

Link copied to clipboard
abstract fun pauseDownload(download: Download)

Pauses a given Download.

Link copied to clipboard
abstract fun pauseDownloads()

Pauses all non-terminal download tasks. Useful, when we want to pause all downloads when a certain criteria is met.

Link copied to clipboard
abstract suspend fun purgeDownload(download: Download)

Purges a given Download.

Link copied to clipboard
abstract suspend fun purgeLicense(download: Download): Result<Unit, Error>

Purges License for a particular Download.

Link copied to clipboard

Removes the Listener from the list of download events listeners.

Link copied to clipboard
abstract suspend fun renewLicense(download: Download): Result<Unit, Error>

Renews License for a particular Download.

Link copied to clipboard
abstract suspend fun requestLicenseInfo(download: Download): Result<LicenseInfo, Error>

Obtains the LicenseInfo for a particular Download This API returns appropriate Error on License Retrieval Failure.

Link copied to clipboard
abstract fun resumeDownload(download: Download)

Resumes a given Download.

Link copied to clipboard
abstract fun resumeDownloads()

Resumes all non-terminal download tasks Useful, when we want to resume all downloads when a certain criteria is met.

Link copied to clipboard
abstract suspend fun shutdown()

Shuts down the DownloadManager by stopping all the on-going tasks. The DownloadManager is unusable after this. A new instance needs to be created for any new request processing.

Link copied to clipboard
abstract fun updateDownloadsAutoPurgeOnExpiry(autoPurgeOnExpiry: Boolean)

On demand enables or disables (toggles) the task to automatically purge all the downloads which expired. Note that the initial value to enable/disable this task is passed as DownloadProperties.downloadsAutoPurgeOnExpiry during DownloadManager instance creation.