Package com.castlabs.android.drm
Class DrmTodayConfiguration.Builder
java.lang.Object
com.castlabs.android.drm.DrmTodayConfiguration.Builder
- Enclosing class:
DrmTodayConfiguration
A builder implementation to create instances of
DrmTodayConfiguration
s-
Constructor Summary
ConstructorsConstructorDescriptionBuilder
(DrmTodayConfiguration drmTodayConfiguration) Create a new builder with the given parameters using no explicit asset id and the best available DRM system.Create a new builder with the given parameters.Create a new builder with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionadditionalAssetIds
(List<String> ids) If you are using the DRMtoday-Mobile Server, you can use this method to specify a list of additional Asset Ids for content with tracks encrypted with different keys.Sets the assetId id.Set a dedicated DRM system for audio tracks.Set the DRMToday auth token when you are using upfront authentication.Set the default DRM systemdrmTodayMobile
(boolean value) Use this method to enable support for the DRMtoday-Mobile server.drmTodayMobileUrl
(String url) If you are using DRM-today Mobile, use this method to specify the base URL for the DRM-today Mobile server.forceWidevineL3
(boolean forceWidevineL3) If set to true, Widevine L3 will be enforced.get()
Create the configuration.keyRotation
(boolean enabled) Enforce Key-Rotation support also on older devices before Android M.mediaDrmProperties
(Bundle mediaDrmProperties) Sets the mediaDrmProperties bundleSet the ID that will be used to store the offline key for this DRM configuration.omaActivationServerUrl
(String omaActivationServerUrl) Set a dedicated Activation Server URL for OMA when using DRMtoday mobile.playClearSamplesWithoutKeys
(boolean playClearSamplesWithoutKeys) If enabled and the stream contains clean samples at the beginning, the player will start playing while fetching the license key in background.preferManifestUrl
(boolean preferManifestUrl) Use to set if the manifest DRM Url shall be preferredrenewalThreshold
(long renewalThreshold, TimeUnit timeUnit) If set to a non-negative value, the Widevine key renewal will be enabled and expiring license will be automatically renewed inrenewalThreshold
before expiration.Sets the request id.Set the variant ID.
-
Constructor Details
-
Builder
public Builder(@NonNull String uri, @NonNull String userId, @NonNull String sessionId, @NonNull String merchant) Create a new builder with the given parameters using no explicit asset id and the best available DRM system.- Parameters:
uri
- The DRMToday URI. One ofDrmTodayConfiguration.DRMTODAY_TEST
,DrmTodayConfiguration.DRMTODAY_STAGING
, orDrmTodayConfiguration.DRMTODAY_PRODUCTION
userId
- The userIDsessionId
- The sessionIDmerchant
- The merchant
-
Builder
public Builder(@NonNull String uri, @NonNull String userId, @NonNull String sessionId, @NonNull String merchant, @NonNull Drm drm) Create a new builder with the given parameters.- Parameters:
uri
- The DRMToday URI. One ofDrmTodayConfiguration.DRMTODAY_TEST
,DrmTodayConfiguration.DRMTODAY_STAGING
, orDrmTodayConfiguration.DRMTODAY_PRODUCTION
userId
- The userIDsessionId
- The sessionIDmerchant
- The merchantdrm
- The DRM system
-
Builder
public Builder(@NonNull String uri, @NonNull String userId, @NonNull String sessionId, @NonNull String merchant, @Nullable String assetId, @NonNull Drm drm) Create a new builder with the given parameters.- Parameters:
uri
- The DRMToday URI. One ofDrmTodayConfiguration.DRMTODAY_TEST
,DrmTodayConfiguration.DRMTODAY_STAGING
, orDrmTodayConfiguration.DRMTODAY_PRODUCTION
userId
- The userIDsessionId
- The sessionIDmerchant
- The merchantassetId
- The asset IDdrm
- The DRM system
-
Builder
-
-
Method Details
-
assetId
Sets the assetId id. This overwrites the asset ID specified through the constructor call. You are encouraged to always specify a assetId, even for DRM setups where it is not strictly necessary.- Parameters:
assetId
- the asset ID- Returns:
- The builder
-
preferManifestUrl
Use to set if the manifest DRM Url shall be preferred- Parameters:
preferManifestUrl
- true to prefer manifest DRM Url- Returns:
- The builder
-
drmTodayMobile
Use this method to enable support for the DRMtoday-Mobile server.- Parameters:
value
- the DRMTodayMobile flag value- Returns:
- The builder
-
drmTodayMobileUrl
If you are using DRM-today Mobile, use this method to specify the base URL for the DRM-today Mobile server.- Parameters:
url
- The base URL to the DRMtoday-Mobile server- Returns:
- The builder
-
additionalAssetIds
If you are using the DRMtoday-Mobile Server, you can use this method to specify a list of additional Asset Ids for content with tracks encrypted with different keys. Please note that this setting has an effect only when you are using the DRMtoday-Mobile server.- Parameters:
ids
- The asset IDs- Returns:
- The builder
-
playClearSamplesWithoutKeys
@NonNull public DrmTodayConfiguration.Builder playClearSamplesWithoutKeys(boolean playClearSamplesWithoutKeys) If enabled and the stream contains clean samples at the beginning, the player will start playing while fetching the license key in background. This istrue
by default.- Parameters:
playClearSamplesWithoutKeys
- play clear samples- Returns:
- The builder
-
variantId
Set the variant ID. This isnull
by default- Parameters:
variantId
- the variant ID- Returns:
- The builder
-
authToken
Set the DRMToday auth token when you are using upfront authentication.- Parameters:
authToken
- the DRMToday auth token- Returns:
- The builder
-
offlineId
Set the ID that will be used to store the offline key for this DRM configuration. If this isnull
, offline key storage will be disabled- Parameters:
offlineId
- the ID used to store offline keys for this DRM configuration ornull
to disable offline key sotrage- Returns:
- The builder
-
drm
Set the default DRM system- Parameters:
drm
- The default DRM system- Returns:
- The builder
-
audioDrm
Set a dedicated DRM system for audio tracks.- Parameters:
audioDrm
- The DRM system used for audio tracks- Returns:
- The builder
-
omaActivationServerUrl
Set a dedicated Activation Server URL for OMA when using DRMtoday mobile. Note that this is only required if the activation server URL is different from the license server URL. The URL is used "as is".- Parameters:
omaActivationServerUrl
- The DRM system used for audio tracks- Returns:
- The builder
-
keyRotation
Enforce 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.- Parameters:
enabled
- Enable key rotation- Returns:
- The builder
-
renewalThreshold
@NonNull public DrmTodayConfiguration.Builder renewalThreshold(long renewalThreshold, TimeUnit timeUnit) If set to a non-negative value, the Widevine key renewal will be enabled and expiring license will be automatically renewed inrenewalThreshold
before expiration. Both license's expiration date-time and playback remaining time are taken into account. For instance, if the license has playback remaining of 60min and the renewalThreshold is set to 60sec then after 59min of playback the license will be renewed automatically. Note:offlineId(String)
has to be set as well for the automatic renewals to work Note: if the DRM configuration needs to be updated for the subsequent license requests then the callback shall be installed viaPlayerController.setConfigurationProvider(ConfigurationProvider)
- Parameters:
renewalThreshold
- The expiration threshold time valuetimeUnit
- The time unit of therenewalThreshold
- Returns:
- The builder
-
forceWidevineL3
If 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.- Parameters:
forceWidevineL3
- Force Widevine Level 3- Returns:
- The builder
-
requestId
Sets the request id. This is mainly designed to use for debugging purposes. Will be sent as "logRequestId" to the DRMToday backend. If left uninformed, a random request id will be generated.- Parameters:
requestId
- the request id- Returns:
- the Builder
-
mediaDrmProperties
@NonNull public DrmTodayConfiguration.Builder mediaDrmProperties(@NonNull Bundle mediaDrmProperties) Sets the mediaDrmProperties bundle- Parameters:
mediaDrmProperties
- The properties of mediaDrm- Returns:
- the Builder
-
get
Create the configuration.- Returns:
- The DRM configuration
-