Package com.castlabs.android.drm
Class DrmConfiguration
java.lang.Object
com.castlabs.android.drm.DrmConfiguration
- All Implemented Interfaces:
Parcelable
- Direct Known Subclasses:
DrmTodayConfiguration
Basic DRM configuration that can be used to query keys from a widevine proxy.
Please note that this is not sufficient in combination with DRMToday. To query keys
from DRMToday, please use the
DrmTodayConfiguration configuration instead.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder implementation to create instances ofDrmConfigurationsNested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal DrmThe DRM system used for audio tracks.static final Parcelable.Creator<DrmConfiguration> Parcelable creator for DrmConfigurationstatic final DrmConfigurationDefault DRM configuration instancefinal DrmThe default DRM system.final booleanIf set to true, Widevine L3 will be enforced.final booleanEnforce Key-Rotation support also on older devices before Android M.final BundleThis bundle contains key-value pairs as the properties of Widevine mediaDrm.final StringThis is used to identify this DRM Configuration and its asset when storing offline keys.final booleanIf true, clear samples will be played while the key is fetchedfinal booleanIf true, then any non-empty DRM URL found in the manifest will be used instead ofurlDefault isPlayerSDK.DEFAULT_DRM_PREFER_MANIFEST_URLfinal longIf set to non-zero and non-negative value then the Widevine license will be automatically renewed beforerenewalThresholdMsmilliseconds of license expiration.final BundleBundle that can be used to put additional request (header) parameters that will be send to the DRM backend during license requests.final StringThe proxy URLFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionDrmConfiguration(String url, boolean playClearSamplesWithoutKeys) Deprecated.DrmConfiguration(String url, boolean playClearSamplesWithoutKeys, Drm drm) Deprecated.DrmConfiguration(String url, boolean playClearSamplesWithoutKeys, Drm drm, Drm audioDrm, String offlineId) Deprecated.DrmConfiguration(String url, boolean playClearSamplesWithoutKeys, Drm drm, Drm audioDrm, String offlineId, Bundle requestParameters) Deprecated.DrmConfiguration(String url, boolean playClearSamplesWithoutKeys, Drm drm, Drm audioDrm, String offlineId, Bundle requestParameters, boolean keyRotation, boolean forceWidevineL3) Deprecated.DrmConfiguration(String url, boolean playClearSamplesWithoutKeys, Drm drm, Drm audioDrm, String offlineId, Bundle requestParameters, boolean keyRotation, boolean forceWidevineL3, long renewalThresholdMs) Deprecated.DrmConfiguration(String url, boolean playClearSamplesWithoutKeys, Drm drm, Drm audioDrm, String offlineId, Bundle requestParameters, boolean keyRotation, boolean forceWidevineL3, long renewalThresholdMs, Bundle mediaDrmProperties, boolean preferManifestUrl) Deprecated.The constructor will have access level protected, useDrmConfiguration.Builderif not extendingDrmConfiguration(String url, boolean playClearSamplesWithoutKeys, Drm drm, String offlineId) Deprecated.DrmConfiguration(String url, boolean playClearSamplesWithoutKeys, String offlineId) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanGets the security level for the selected DRM on this device.inthashCode()booleanChecks if license renewal is enabled in the current configuration.The best available DRM if no explicit DRM was specified.The best available DRM if no explicit DRM was specifiedtoString()voidwriteToParcel(Parcel dest, int flags)
-
Field Details
-
CREATOR
Parcelable creator for DrmConfiguration -
DEFAULT
Default DRM configuration instance -
url
The proxy URL -
preferManifestUrl
public final boolean preferManifestUrlIf true, then any non-empty DRM URL found in the manifest will be used instead ofurlDefault isPlayerSDK.DEFAULT_DRM_PREFER_MANIFEST_URL -
playClearSamplesWithoutKeys
public final boolean playClearSamplesWithoutKeysIf true, clear samples will be played while the key is fetched -
offlineId
This is used to identify this DRM Configuration and its asset when storing offline keys. Offline key storage is disabled if this isnull. -
drm
The default DRM system. This is the requested DRM. If BestAvailable, useresolvedDrm()to get the one used on the device. -
audioDrm
The DRM system used for audio tracks. If this is nulldrmwill be used for both video and audio. This is the requested DRM. If BestAvailable, useresolvedAudioDrm()to get the one used on the device. -
requestParameters
Bundle that can be used to put additional request (header) parameters that will be send to the DRM backend during license requests. Note that all values need to be of type String! -
keyRotation
public final boolean keyRotationEnforce Key-Rotation support also on older devices before Android M. This is primarily indented for live content with changing keys where we need to enable session sharing support on older devices to make sure we can rotate keys. -
forceWidevineL3
public final boolean forceWidevineL3If set to true, Widevine L3 will be enforced. Note that this will prevent playback of DRM content where the license requires L1 security. This flag can be set for certain devices that are known to have broken secure decoder implementation to allow Widevine protected content playback. -
renewalThresholdMs
public final long renewalThresholdMsIf set to non-zero and non-negative value then the Widevine license will be automatically renewed beforerenewalThresholdMsmilliseconds of license expiration. Set toC.TIME_UNSETto disable the license renewal (default). Note:offlineIdhas to be set to a non-null and non-empty value as well -
mediaDrmProperties
This bundle contains key-value pairs as the properties of Widevine mediaDrm. Only values which are instances of String or byte[] will be applied and other value types will be ignored.
-
-
Constructor Details
-
DrmConfiguration
Deprecated.Create a new configuration with an empty offline id- Parameters:
url- The license server URLplayClearSamplesWithoutKeys- True if clear sample will be played while fetching the key
-
DrmConfiguration
@Deprecated public DrmConfiguration(@Nullable String url, boolean playClearSamplesWithoutKeys, @Nullable String offlineId) Deprecated.Create a new configuration using the best available DRM on the device- Parameters:
url- The license server URLplayClearSamplesWithoutKeys- True if clear sample will be played while fetching the keyofflineId- The ID used to identify this asset when storing offline keys
-
DrmConfiguration
@Deprecated public DrmConfiguration(@Nullable String url, boolean playClearSamplesWithoutKeys, @Nullable Drm drm) Deprecated.Create a new configuration using the best available DRM on the device- Parameters:
url- The license server URLplayClearSamplesWithoutKeys- True if clear sample will be played while fetching the keydrm- The DRM system
-
DrmConfiguration
@Deprecated public DrmConfiguration(@Nullable String url, boolean playClearSamplesWithoutKeys, @Nullable Drm drm, @Nullable String offlineId) Deprecated.Create a new configuration- Parameters:
url- The license server URLplayClearSamplesWithoutKeys- True if clear sample will be played while fetching the keydrm- The DRM systemofflineId- The ID used to identify this asset when storing offline keys
-
DrmConfiguration
@Deprecated public DrmConfiguration(@Nullable String url, boolean playClearSamplesWithoutKeys, @Nullable Drm drm, @Nullable Drm audioDrm, @Nullable String offlineId) Deprecated.Create a new configuration- Parameters:
url- The license server URLplayClearSamplesWithoutKeys- True if clear sample will be played while fetching the keydrm- The DRM systemaudioDrm- The DRM system used for audio tracks. If this is null, the main drm system will be used also for audio tracksofflineId- The ID used to identify this asset when storing offline keys
-
DrmConfiguration
@Deprecated public DrmConfiguration(@Nullable String url, boolean playClearSamplesWithoutKeys, @Nullable Drm drm, @Nullable Drm audioDrm, @Nullable String offlineId, @NonNull Bundle requestParameters) Deprecated.Create a new configuration- Parameters:
url- The license server URLplayClearSamplesWithoutKeys- True if clear sample will be played while fetching the keydrm- The DRM systemaudioDrm- The DRM system used for audio tracks. If this is null, the main drm system will be used also for audio tracksofflineId- The ID used to identify this asset when storing offline keysrequestParameters- The bundle with additional request parameters
-
DrmConfiguration
@Deprecated public DrmConfiguration(@Nullable String url, boolean playClearSamplesWithoutKeys, @Nullable Drm drm, @Nullable Drm audioDrm, @Nullable String offlineId, @NonNull Bundle requestParameters, boolean keyRotation, boolean forceWidevineL3) Deprecated.Create a new configuration- Parameters:
url- The license server URLplayClearSamplesWithoutKeys- True if clear sample will be played while fetching the keydrm- The DRM systemaudioDrm- The DRM system used for audio tracks. If this is null, the main drm system will be used also for audio tracksofflineId- The ID used to identify this asset when storing offline keysrequestParameters- The bundle with additional request parameterskeyRotation- Enable key rotation also on older devicesforceWidevineL3- Force Widevine L3
-
DrmConfiguration
@Deprecated public DrmConfiguration(@Nullable String url, boolean playClearSamplesWithoutKeys, @Nullable Drm drm, @Nullable Drm audioDrm, @Nullable String offlineId, @NonNull Bundle requestParameters, boolean keyRotation, boolean forceWidevineL3, long renewalThresholdMs) Deprecated.Create a new configuration- Parameters:
url- The license server URLplayClearSamplesWithoutKeys- True if clear sample will be played while fetching the keydrm- The DRM systemaudioDrm- The DRM system used for audio tracks. If this is null, the main drm system will be used also for audio tracksofflineId- The ID used to identify this asset when storing offline keysrequestParameters- The bundle with additional request parameterskeyRotation- Enable key rotation also on older devicesforceWidevineL3- Force Widevine L3renewalThresholdMs- License renewal threshold in milliseconds orC.TIME_UNSETto disable renewals, seerenewalThresholdMs
-
DrmConfiguration
@Deprecated public DrmConfiguration(@Nullable String url, boolean playClearSamplesWithoutKeys, @Nullable Drm drm, @Nullable Drm audioDrm, @Nullable String offlineId, @NonNull Bundle requestParameters, boolean keyRotation, boolean forceWidevineL3, long renewalThresholdMs, @NonNull Bundle mediaDrmProperties, boolean preferManifestUrl) Deprecated.The constructor will have access level protected, useDrmConfiguration.Builderif not extendingCreate a new configuration- Parameters:
url- The license server URLplayClearSamplesWithoutKeys- True if clear sample will be played while fetching the keydrm- The DRM systemaudioDrm- The DRM system used for audio tracks. If this is null, the main drm system will be used also for audio tracksofflineId- The ID used to identify this asset when storing offline keysrequestParameters- The bundle with additional request parameterskeyRotation- Enable key rotation also on older devicesforceWidevineL3- Force Widevine L3renewalThresholdMs- License renewal threshold in milliseconds orC.TIME_UNSETto disable renewals, seerenewalThresholdMsmediaDrmProperties- The properties of mediaDrmpreferManifestUrl- True, then any non-empty DRM URL found in the manifest will be used instead ofurl
-
-
Method Details
-
resolvedDrm
The best available DRM if no explicit DRM was specified- Returns:
- The source DRM or the best available DRM if the source selection is
Drm.BestAvailableornullif no supported DRM was found
-
resolvedAudioDrm
The best available DRM if no explicit DRM was specified.- Returns:
- Selects the audio drm system based on the given selection and the device
-
getSecurityLevel
Gets the security level for the selected DRM on this device.- Returns:
- the security level for the selected DRM on this device or
SecurityLevel.SOFTWAREif the selected DRM is not supported by the devices and the security level can not be determined.
-
renewalEnabled
public boolean renewalEnabled()Checks if license renewal is enabled in the current configuration.- Returns:
trueif the renewal is enabled in the current configuration, otherwisefalse. SeerenewalThresholdMs
-
toString
-
describeContents
public int describeContents()- Specified by:
describeContentsin interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcelin interfaceParcelable
-
hashCode
public int hashCode() -
equals
-
DrmConfiguration.Builder