public final class OfflineLicenseHelper<T extends ExoMediaCrypto>
extends java.lang.Object
| Constructor and Description |
|---|
OfflineLicenseHelper(ExoMediaDrm<T> mediaDrm,
MediaDrmCallback callback,
java.util.HashMap<java.lang.String,java.lang.String> optionalKeyRequestParameters)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
downloadLicense(DrmInitData drmInitData)
Downloads an offline license.
|
android.util.Pair<java.lang.Long,java.lang.Long> |
getLicenseDurationRemainingSec(byte[] offlineLicenseKeySetId)
Returns the remaining license and playback durations in seconds, for an offline license.
|
static OfflineLicenseHelper<FrameworkMediaCrypto> |
newWidevineInstance(MediaDrmCallback callback,
java.util.HashMap<java.lang.String,java.lang.String> optionalKeyRequestParameters)
Instantiates a new instance which uses Widevine CDM.
|
static OfflineLicenseHelper<FrameworkMediaCrypto> |
newWidevineInstance(java.lang.String licenseUrl,
HttpDataSource.Factory httpDataSourceFactory)
Instantiates a new instance which uses Widevine CDM.
|
void |
release()
Releases the helper.
|
void |
releaseLicense(byte[] offlineLicenseKeySetId)
Releases an offline license.
|
byte[] |
renewLicense(byte[] offlineLicenseKeySetId)
Renews an offline license.
|
public OfflineLicenseHelper(ExoMediaDrm<T> mediaDrm, MediaDrmCallback callback, java.util.HashMap<java.lang.String,java.lang.String> optionalKeyRequestParameters)
release() when the instance is no longer required.mediaDrm - An underlying ExoMediaDrm for use by the manager.callback - Performs key and provisioning requests.optionalKeyRequestParameters - An optional map of parameters to pass as the last argument
to MediaDrm.getKeyRequest(byte[], byte[], String, int, HashMap). May be null.DefaultDrmSessionManager.DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm,
MediaDrmCallback, HashMap, Handler, EventListener)public static OfflineLicenseHelper<FrameworkMediaCrypto> newWidevineInstance(java.lang.String licenseUrl, HttpDataSource.Factory httpDataSourceFactory) throws UnsupportedDrmException
release() when the instance
is no longer required.licenseUrl - The default license URL.httpDataSourceFactory - A factory from which to obtain HttpDataSource instances.UnsupportedDrmException - If the Widevine DRM scheme is unsupported or cannot be
instantiated.public static OfflineLicenseHelper<FrameworkMediaCrypto> newWidevineInstance(MediaDrmCallback callback, java.util.HashMap<java.lang.String,java.lang.String> optionalKeyRequestParameters) throws UnsupportedDrmException
release() when the instance
is no longer required.callback - Performs key and provisioning requests.optionalKeyRequestParameters - An optional map of parameters to pass as the last argument
to MediaDrm.getKeyRequest(byte[], byte[], String, int, HashMap). May be null.UnsupportedDrmException - If the Widevine DRM scheme is unsupported or cannot be
instantiated.DefaultDrmSessionManager.DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm,
MediaDrmCallback, HashMap, Handler, EventListener)public void release()
public byte[] downloadLicense(DrmInitData drmInitData) throws java.io.IOException, java.lang.InterruptedException, DrmSession.DrmSessionException
drmInitData - The DrmInitData for the content whose license is to be downloaded.java.io.IOException - If an error occurs reading data from the stream.java.lang.InterruptedException - If the thread has been interrupted.DrmSession.DrmSessionException - Thrown when a DRM session error occurs.public byte[] renewLicense(byte[] offlineLicenseKeySetId)
throws DrmSession.DrmSessionException
offlineLicenseKeySetId - The key set id of the license to be renewed.DrmSession.DrmSessionException - Thrown when a DRM session error occurs.public void releaseLicense(byte[] offlineLicenseKeySetId)
throws DrmSession.DrmSessionException
offlineLicenseKeySetId - The key set id of the license to be released.DrmSession.DrmSessionException - Thrown when a DRM session error occurs.public android.util.Pair<java.lang.Long,java.lang.Long> getLicenseDurationRemainingSec(byte[] offlineLicenseKeySetId)
throws DrmSession.DrmSessionException
offlineLicenseKeySetId - The key set id of the license.DrmSession.DrmSessionException - Thrown when a DRM session error occurs.