public class OfflineLicenseManager<T extends com.google.android.exoplayer2.drm.ExoMediaCrypto> extends java.lang.Object implements LicenseManager
CR_TOKEN_HEADER
Constructor and Description |
---|
OfflineLicenseManager(com.google.android.exoplayer2.drm.ExoMediaDrm<T> mediaDrm,
com.google.android.exoplayer2.drm.MediaDrmCallback callback,
java.util.HashMap<java.lang.String,java.lang.String> optionalKeyRequestParameters)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
downloadLicense(java.lang.String manifestUriString,
CustomerRightsToken customerRightsToken)
Downloads an offline license.
|
java.lang.String |
getPropertyString(java.lang.String key)
Gets the specified property.
|
android.util.Pair<java.lang.Long,java.lang.Long> |
getRemainingLicenseDuration(byte[] licenseKeySetId)
Returns license and playback durations remaining in seconds of the given offline license.
|
void |
releaseLicense(byte[] licenseKeySetId)
Releases an offline license.
|
void |
releaseResources()
Releases the used resources.
|
byte[] |
renewLicense(byte[] licenseKeySetId)
Renews an offline license.
|
void |
setPropertyString(java.lang.String key,
java.lang.String value)
Sets the specified property.
|
public OfflineLicenseManager(com.google.android.exoplayer2.drm.ExoMediaDrm<T> mediaDrm, com.google.android.exoplayer2.drm.MediaDrmCallback callback, java.util.HashMap<java.lang.String,java.lang.String> optionalKeyRequestParameters)
releaseResources()
when you're done with it.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.public void releaseResources()
LicenseManager
releaseResources
in interface LicenseManager
public void setPropertyString(java.lang.String key, java.lang.String value)
LicenseManager
setPropertyString
in interface LicenseManager
public java.lang.String getPropertyString(java.lang.String key)
LicenseManager
getPropertyString
in interface LicenseManager
@Nullable public byte[] downloadLicense(java.lang.String manifestUriString, @NonNull CustomerRightsToken customerRightsToken) throws java.io.IOException, java.lang.InterruptedException, DrmException
LicenseManager
downloadLicense
in interface LicenseManager
manifestUriString
- the URL to the DASH manifest file.customerRightsToken
- the customer rights token that describes the license type and limitations.java.io.IOException
- If an error occurs while attempt to read the manifest from the stream.java.lang.InterruptedException
- If the thread has been interrupted.DrmException
- Thrown when there is an error during DRM session.@Nullable public byte[] renewLicense(byte[] licenseKeySetId) throws DrmException
LicenseManager
renewLicense
in interface LicenseManager
licenseKeySetId
- The key set id of the license to be renewed.DrmException
- Thrown when there is an error during DRM session.public void releaseLicense(@Nullable byte[] licenseKeySetId) throws DrmException
LicenseManager
releaseLicense
in interface LicenseManager
licenseKeySetId
- The key set id of the license to be released.DrmException
- Thrown when there is an error during DRM session.@Nullable public android.util.Pair<java.lang.Long,java.lang.Long> getRemainingLicenseDuration(byte[] licenseKeySetId) throws DrmException
LicenseManager
Pair.first
value in the result will provide the remaining license duration as total
number of seconds, while Pair.second
value will provide the remain play duration as
total number of seconds.getRemainingLicenseDuration
in interface LicenseManager
licenseKeySetId
- The key set id of the license.DrmException