OfflineContentManager

com.bitmovin.player.api.offline

OfflineContentManager

interface OfflineContentManager : EventEmitter<OfflineEvent>

Provides the means to download and store sources locally that can be played back with a Player without an active network connection. An OfflineContentManager instance can be created via the OfflineContentManager.getOfflineContentManager function.

The OfflineContentManager emits OfflineEvents during its lifecycle. See EventEmitter on how to subscribe to events.

Note: When downloading content for offline playback, the player license key must be provided via the via a tag in the AndroidManifest.xml using the android:name="BITMOVIN_PLAYER_LICENSE_KEY" attribute. Supplying the key only through com.bitmovin.player.api.PlayerConfig is not sufficient for downloading offline content. For offline playback (i.e., playing already downloaded content), the key from com.bitmovin.player.api.PlayerConfig can be used.

Types

NameSummary
Companionobject Companion

Properties

NameSummary
offlineSourceConfigabstract val offlineSourceConfig: OfflineSourceConfig?
Creates an OfflineSourceConfig, which can be used to play the offline content with a Player or returns null, if no offline content is available.
remainingOfflineLicenseDurationabstract val remainingOfflineLicenseDuration: DrmLicenseInformation
A DrmLicenseInformation object containing the remaining drm license duration and the remaining playback duration. Throws an IOException if the loading of the DRM key fails. Throws an UnsupportedDrmException if the provided DRM technology is not supported. Throws a DrmSessionException if the DRM licensing call to the server fails
usedStorageabstract val usedStorage: Long
Returns how many bytes of storage are used by the offline content.

Functions

NameSummary
deleteAllabstract fun deleteAll()
Deletes everything related to the related content ID.
downloadLicenseabstract fun downloadLicense()
Downloads the offline license. When finished successfully OfflineContentManagerListener.onDrmLicenseUpdated will be called. Errors are transmitted by a OfflineContentManagerListener.onError call and an OfflineEvent.Error event.
getOptionsabstract fun getOptions()
Loads the current OfflineContentOptions and passes them to OfflineContentManagerListener.onOptionsAvailable.
nextopen override fun <E : OfflineEvent> next(eventClass: Class<E>, eventListener: EventListener<in E>)
Subscribes the eventListener to be executed when the next event of type E is emitted. The eventListener will then be automatically unsubscribed.
abstract fun <E : OfflineEvent> next(eventClass: KClass<E>, action: (E) -> Unit)
Subscribes the action to be executed when the next event of type E is emitted. The action will then be automatically unsubscribed.
nextinline fun <E : Event> EventEmitter<Event>.next(noinline action: (E) -> Unit)
@JvmName(name = "nextOfflineEvent")
inline fun <E : OfflineEvent> EventEmitter<OfflineEvent>.next(noinline action: (E) -> Unit)
@JvmName(name = "nextPlayerEvent")
inline fun <E : PlayerEvent> EventEmitter<PlayerEvent>.next(noinline action: (E) -> Unit)
@JvmName(name = "nextSourceEvent")
inline fun <E : SourceEvent> EventEmitter<SourceEvent>.next(noinline action: (E) -> Unit)
offopen override fun <E : OfflineEvent> off(eventListener: EventListener<in E>)
Unsubscribes the eventListener for all events.
abstract fun <E : OfflineEvent> off(action: (E) -> Unit)
Unsubscribes the action for all events.
open override fun <E : OfflineEvent> off(eventClass: Class<E>, eventListener: EventListener<in E>)
Unsubscribes the eventListener for the specified event.
abstract fun <E : OfflineEvent> off(eventClass: KClass<E>, action: (E) -> Unit)
Unsubscribes the action for the specified event.
onopen override fun <E : OfflineEvent> on(eventClass: Class<E>, eventListener: EventListener<in E>)
Subscribes the eventListener to be executed when an event of type E is emitted. Provides the same functionality as EventEmitter.on with a more convenient style when used from Java.
abstract fun <E : OfflineEvent> on(eventClass: KClass<E>, action: (E) -> Unit)
Subscribes the action to be executed when an event of type E is emitted.
oninline fun <E : Event> EventEmitter<Event>.on(noinline action: (E) -> Unit)
@JvmName(name = "onOfflineEvent")
inline fun <E : OfflineEvent> EventEmitter<OfflineEvent>.on(noinline action: (E) -> Unit)
@JvmName(name = "onPlayerEvent")
inline fun <E : PlayerEvent> EventEmitter<PlayerEvent>.on(noinline action: (E) -> Unit)
@JvmName(name = "onSourceEvent")
inline fun <E : SourceEvent> EventEmitter<SourceEvent>.on(noinline action: (E) -> Unit)
processabstract fun process(offlineContentOptions: OfflineContentOptions)
Enqueues downloads and deletions according to the current OfflineOptionEntryState and OfflineOptionEntryAction of the OfflineOptionEntry in the OfflineContentOptions.
releaseabstract fun release()
Releases the memory resources. IMPORTANT: Call this when the Activity/Context, in which it was created, is destroy. The OfflineContentManager should not be used after calling this method.
releaseLicenseabstract fun releaseLicense()
Releases the currently held offline license. When finished successfully OfflineContentManagerListener.onDrmLicenseUpdated will be called. Errors are transmitted by a OfflineContentManagerListener.onError call and an OfflineEvent.Error event.
renewOfflineLicenseabstract fun renewOfflineLicense()
Renews the already downloaded DRM license. When successfully finished OfflineContentManagerListener.onDrmLicenseUpdated will be called. Errors are transmitted by a OfflineContentManagerListener.onError call and an OfflineEvent.Error event.
resumeabstract fun resume()
Resumes all suspended actions.
suspendabstract fun suspend()
Suspends all active actions.