OGDownloadManager

Download-to-go: persists media (and, for DRM'd items, a persistent offline license) so it plays without a network connection.

Obtain via OGDownloads.manager. Downloading an item and playing it later needs no special playback code — OGPlayer.load of the same URL automatically plays from local storage, using the stored offline license instead of a license request.

All methods must be called from the application main thread unless noted.

Properties

Link copied to clipboard
abstract val downloads: List<OGDownload>

Snapshot of all known downloads, in insertion order.

Functions

Link copied to clipboard
abstract fun add(item: OGMediaItem, config: OGDownloadConfig = OGDownloadConfig.DEFAULT)

Queues item for download. For DRM'd items the persistent offline license is acquired as part of the download (the item's DrmTokenProvider is invoked as it would be for streaming). VOD only — throws for live stream types. Re-adding a URL that is already downloading or downloaded is a no-op.

Link copied to clipboard
abstract fun addListener(listener: OGDownloadListener)
Link copied to clipboard
abstract fun getDownload(url: String): OGDownload?

The download whose OGDownload.url equals url, or null.

Link copied to clipboard
abstract fun pause(url: String)

Pauses the download with the given URL.

Link copied to clipboard
abstract fun pauseAll()

Pauses all downloads.

Link copied to clipboard
abstract fun removeDownload(url: String, item: OGMediaItem? = null)

Deletes the downloaded media AND releases the stored offline license.

Link copied to clipboard
abstract fun removeListener(listener: OGDownloadListener)
Link copied to clipboard
abstract suspend fun renewLicense(item: OGMediaItem): OfflineLicenseInfo

Re-acquires the persistent license for a previously downloaded DRM'd item — call while online, before or after expiry. item must carry the same DrmConfig (including its token provider) used for add. Returns the refreshed license info.

Link copied to clipboard
abstract fun resume(url: String)

Resumes a paused or failed download.

Link copied to clipboard
abstract fun resumeAll()

Resumes all paused/failed downloads.