Class OfflineLicenseHelper
- java.lang.Object
-
- com.google.android.exoplayer2.drm.OfflineLicenseHelper
-
@RequiresApi(18) @Deprecated public final class OfflineLicenseHelper extends Object
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.
-
-
Constructor Summary
Constructors Constructor Description OfflineLicenseHelper(DefaultDrmSessionManager defaultDrmSessionManager, DrmSessionEventListener.EventDispatcher eventDispatcher)Deprecated.Constructs an instance.
-
Method Summary
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 OfflineLicenseHelpernewWidevineInstance(String defaultLicenseUrl, boolean forceDefaultLicenseUrl, DataSource.Factory dataSourceFactory, DrmSessionEventListener.EventDispatcher eventDispatcher)Deprecated.Instantiates a new instance which uses Widevine CDM.static OfflineLicenseHelpernewWidevineInstance(String defaultLicenseUrl, boolean forceDefaultLicenseUrl, DataSource.Factory dataSourceFactory, Map<String,String> optionalKeyRequestParameters, DrmSessionEventListener.EventDispatcher eventDispatcher)Deprecated.Instantiates a new instance which uses Widevine CDM.static OfflineLicenseHelpernewWidevineInstance(String defaultLicenseUrl, DataSource.Factory dataSourceFactory, DrmSessionEventListener.EventDispatcher eventDispatcher)Deprecated.Instantiates a new instance which uses Widevine CDM.voidrelease()Deprecated.Releases the helper.voidreleaseLicense(byte[] offlineLicenseKeySetId)Deprecated.Releases an offline license.byte[]renewLicense(byte[] offlineLicenseKeySetId)Deprecated.Renews an offline license.
-
-
-
Constructor Detail
-
OfflineLicenseHelper
public OfflineLicenseHelper(DefaultDrmSessionManager defaultDrmSessionManager, DrmSessionEventListener.EventDispatcher eventDispatcher)
Deprecated.Constructs an instance. Callrelease()when the instance is no longer required.- Parameters:
defaultDrmSessionManager- TheDefaultDrmSessionManagerused to download licenses.eventDispatcher- ADrmSessionEventListener.EventDispatcherused to distribute DRM-related events.
-
-
Method Detail
-
newWidevineInstance
public static OfflineLicenseHelper newWidevineInstance(String defaultLicenseUrl, DataSource.Factory dataSourceFactory, DrmSessionEventListener.EventDispatcher eventDispatcher)
Deprecated.Instantiates a new instance which uses Widevine CDM. Callrelease()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 obtainDataSourceinstances.eventDispatcher- ADrmSessionEventListener.EventDispatcherused to distribute DRM-related events.- Returns:
- A new instance which uses Widevine CDM.
-
newWidevineInstance
public static OfflineLicenseHelper newWidevineInstance(String defaultLicenseUrl, boolean forceDefaultLicenseUrl, DataSource.Factory dataSourceFactory, DrmSessionEventListener.EventDispatcher eventDispatcher)
Deprecated.Instantiates a new instance which uses Widevine CDM. Callrelease()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 usedefaultLicenseUrlfor key requests that include their own license URL.dataSourceFactory- A factory from which to obtainDataSourceinstances.eventDispatcher- ADrmSessionEventListener.EventDispatcherused to distribute DRM-related events.- Returns:
- A new instance which uses Widevine CDM.
-
newWidevineInstance
public static OfflineLicenseHelper newWidevineInstance(String defaultLicenseUrl, boolean forceDefaultLicenseUrl, DataSource.Factory dataSourceFactory, @Nullable Map<String,String> optionalKeyRequestParameters, DrmSessionEventListener.EventDispatcher eventDispatcher)
Deprecated.Instantiates a new instance which uses Widevine CDM. Callrelease()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 usedefaultLicenseUrlfor key requests that include their own license URL.dataSourceFactory- A factory from which to obtainDataSourceinstances.optionalKeyRequestParameters- An optional map of parameters to pass as the last argument toMediaDrm.getKeyRequest(byte[], byte[], java.lang.String, int, java.util.HashMap<java.lang.String, java.lang.String>). May be null.eventDispatcher- ADrmSessionEventListener.EventDispatcherused to distribute DRM-related events.- Returns:
- A new instance which uses Widevine CDM.
- See Also:
DefaultDrmSessionManager.Builder
-
downloadLicense
public byte[] downloadLicense(Format format) throws DrmSession.DrmSessionException
Deprecated.Downloads an offline license.- Parameters:
format- TheFormatof the content whose license is to be downloaded. Must contain a non-nullFormat.drmInitData.- Returns:
- The key set id for the downloaded license.
- Throws:
DrmSession.DrmSessionException- Thrown when a DRM session error occurs.
-
renewLicense
public byte[] renewLicense(byte[] offlineLicenseKeySetId) throws DrmSession.DrmSessionExceptionDeprecated.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.
-
releaseLicense
public void releaseLicense(byte[] offlineLicenseKeySetId) throws DrmSession.DrmSessionExceptionDeprecated.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.
-
getLicenseDurationRemainingSec
public Pair<Long,Long> getLicenseDurationRemainingSec(byte[] offlineLicenseKeySetId) throws DrmSession.DrmSessionException
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.
-
release
public void release()
Deprecated.Releases the helper. Should be called when the helper is no longer required.
-
-