docs/doc/reference/com/google/android/exoplayer2/drm/OfflineLicenseHelper.html
Package com.google.android.exoplayer2.drm
@RequiresApi(18)[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classOfflineLicenseHelperextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Helper class to download, renew and release offline licenses.
Constructors | Constructor | Description |
| --- | --- |
| OfflineLicenseHelper(DefaultDrmSessionManager defaultDrmSessionManager, DrmSessionEventListener.EventDispatcher eventDispatcher) |
Deprecated.
Constructs an instance. |
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| byte[] | downloadLicense(Format format) |
Deprecated.
Downloads an offline license.
|
| Pair<Long,Long> | getLicenseDurationRemainingSec(byte[] offlineLicenseKeySetId) |
Deprecated.
Returns the remaining license and playback durations in seconds, for an offline license.
|
| static OfflineLicenseHelper | newWidevineInstance(String defaultLicenseUrl, boolean forceDefaultLicenseUrl, DataSource.Factory dataSourceFactory, DrmSessionEventListener.EventDispatcher eventDispatcher) |
Deprecated.
Instantiates a new instance which uses Widevine CDM.
|
| static OfflineLicenseHelper | newWidevineInstance(String defaultLicenseUrl, boolean forceDefaultLicenseUrl, DataSource.Factory dataSourceFactory, Map<String,String> optionalKeyRequestParameters, DrmSessionEventListener.EventDispatcher eventDispatcher) |
Deprecated.
Instantiates a new instance which uses Widevine CDM.
|
| static OfflineLicenseHelper | newWidevineInstance(String defaultLicenseUrl, DataSource.Factory dataSourceFactory, DrmSessionEventListener.EventDispatcher eventDispatcher) |
Deprecated.
Instantiates a new instance which uses Widevine CDM.
|
| void | release() |
Deprecated.
Releases the helper.
|
| void | releaseLicense(byte[] offlineLicenseKeySetId) |
Deprecated.
Releases an offline license.
|
| byte[] | renewLicense(byte[] offlineLicenseKeySetId) |
Deprecated.
Renews an offline license. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public OfflineLicenseHelper([DefaultDrmSessionManager](DefaultDrmSessionManager.html "class in com.google.android.exoplayer2.drm")defaultDrmSessionManager,[DrmSessionEventListener.EventDispatcher](DrmSessionEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.drm")eventDispatcher)
Deprecated.
Constructs an instance. Call release() when the instance is no longer required.
Parameters:defaultDrmSessionManager - The DefaultDrmSessionManager used to download licenses.eventDispatcher - A DrmSessionEventListener.EventDispatcher used to distribute DRM-related events.
-
public static[OfflineLicenseHelper](OfflineLicenseHelper.html "class in com.google.android.exoplayer2.drm")newWidevineInstance([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")defaultLicenseUrl,[DataSource.Factory](../upstream/DataSource.Factory.html "interface in com.google.android.exoplayer2.upstream")dataSourceFactory,[DrmSessionEventListener.EventDispatcher](DrmSessionEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.drm")eventDispatcher)
Deprecated.
Instantiates a new instance which uses Widevine CDM. Call release() when the instance is no longer required.
Parameters:defaultLicenseUrl - The default license URL. Used for key requests that do not specify their own license URL.dataSourceFactory - A factory from which to obtain DataSource instances.eventDispatcher - A DrmSessionEventListener.EventDispatcher used to distribute DRM-related events.Returns:A new instance which uses Widevine CDM.
-
public static[OfflineLicenseHelper](OfflineLicenseHelper.html "class in com.google.android.exoplayer2.drm")newWidevineInstance([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")defaultLicenseUrl,
boolean forceDefaultLicenseUrl,[DataSource.Factory](../upstream/DataSource.Factory.html "interface in com.google.android.exoplayer2.upstream")dataSourceFactory,[DrmSessionEventListener.EventDispatcher](DrmSessionEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.drm")eventDispatcher)
Deprecated.
Instantiates a new instance which uses Widevine CDM. Call release() when the instance is no longer required.
Parameters:defaultLicenseUrl - The default license URL. Used for key requests that do not specify their own license URL.forceDefaultLicenseUrl - Whether to use defaultLicenseUrl for key requests that include their own license URL.dataSourceFactory - A factory from which to obtain DataSource instances.eventDispatcher - A DrmSessionEventListener.EventDispatcher used to distribute DRM-related events.Returns:A new instance which uses Widevine CDM.
-
public static[OfflineLicenseHelper](OfflineLicenseHelper.html "class in com.google.android.exoplayer2.drm")newWidevineInstance([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")defaultLicenseUrl,
boolean forceDefaultLicenseUrl,[DataSource.Factory](../upstream/DataSource.Factory.html "interface in com.google.android.exoplayer2.upstream")dataSourceFactory,
@Nullable[Map](https://developer.android.com/reference/java/util/Map.html "class or interface in java.util")<[String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang"),[String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")> optionalKeyRequestParameters,[DrmSessionEventListener.EventDispatcher](DrmSessionEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.drm")eventDispatcher)
Deprecated.
Instantiates a new instance which uses Widevine CDM. Call release() when the instance is no longer required.
Parameters:defaultLicenseUrl - The default license URL. Used for key requests that do not specify their own license URL.forceDefaultLicenseUrl - Whether to use defaultLicenseUrl for key requests that include their own license URL.dataSourceFactory - A factory from which to obtain DataSource instances.optionalKeyRequestParameters - An optional map of parameters to pass as the last argument to MediaDrm.getKeyRequest(byte[], byte[], java.lang.String, int, java.util.HashMap<java.lang.String, java.lang.String>). May be null.eventDispatcher - A DrmSessionEventListener.EventDispatcher used to distribute DRM-related events.Returns:A new instance which uses Widevine CDM.See Also:DefaultDrmSessionManager.Builder
-
public byte[] downloadLicense([Format](../Format.html "class in com.google.android.exoplayer2")format)
throws[DrmSession.DrmSessionException](DrmSession.DrmSessionException.html "class in com.google.android.exoplayer2.drm")
Deprecated.
Downloads an offline license.
Parameters:format - The Format of the content whose license is to be downloaded. Must contain a non-null Format.drmInitData.Returns:The key set id for the downloaded license.Throws:DrmSession.DrmSessionException - Thrown when a DRM session error occurs.
-
public byte[] renewLicense(byte[] offlineLicenseKeySetId)
throws[DrmSession.DrmSessionException](DrmSession.DrmSessionException.html "class in com.google.android.exoplayer2.drm")
Deprecated.
Renews an offline license.
Parameters:offlineLicenseKeySetId - The key set id of the license to be renewed.Returns:The renewed offline license key set id.Throws:DrmSession.DrmSessionException - Thrown when a DRM session error occurs.
-
public void releaseLicense(byte[] offlineLicenseKeySetId)
throws[DrmSession.DrmSessionException](DrmSession.DrmSessionException.html "class in com.google.android.exoplayer2.drm")
Deprecated.
Releases an offline license.
Parameters:offlineLicenseKeySetId - The key set id of the license to be released.Throws:DrmSession.DrmSessionException - Thrown when a DRM session error occurs.
-
public[Pair](https://developer.android.com/reference/android/util/Pair.html "class or interface in android.util")<[Long](https://developer.android.com/reference/java/lang/Long.html?is-external=true "class or interface in java.lang"),[Long](https://developer.android.com/reference/java/lang/Long.html?is-external=true "class or interface in java.lang")> getLicenseDurationRemainingSec(byte[] offlineLicenseKeySetId)
throws[DrmSession.DrmSessionException](DrmSession.DrmSessionException.html "class in com.google.android.exoplayer2.drm")
Deprecated.
Returns the remaining license and playback durations in seconds, for an offline license.
Parameters:offlineLicenseKeySetId - The key set id of the license.Returns:The remaining license and playback durations, in seconds.Throws:DrmSession.DrmSessionException - Thrown when a DRM session error occurs.
-
public void release()
Deprecated.
Releases the helper. Should be called when the helper is no longer required.