Package com.castlabs.android.drm
Class DrmTodayConfiguration.Builder
- java.lang.Object
-
- com.castlabs.android.drm.DrmTodayConfiguration.Builder
-
- Enclosing class:
- DrmTodayConfiguration
public static class DrmTodayConfiguration.Builder extends Object
A builder implementation to create instances ofDrmTodayConfiguration
s
-
-
Constructor Summary
Constructors Constructor Description Builder(DrmTodayConfiguration drmTodayConfiguration)
Builder(String uri, String userId, String sessionId, String merchant)
Create a new builder with the given parameters using no explicit asset id and the best available DRM system.Builder(String uri, String userId, String sessionId, String merchant, Drm drm)
Create a new builder with the given parameters.Builder(String uri, String userId, String sessionId, String merchant, String assetId, Drm drm)
Create a new builder with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DrmTodayConfiguration.Builder
additionalAssetIds(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.DrmTodayConfiguration.Builder
assetId(String assetId)
Sets the assetId id.DrmTodayConfiguration.Builder
audioDrm(Drm audioDrm)
Set a dedicated DRM system for audio tracks.DrmTodayConfiguration.Builder
authToken(String authToken)
Set the DRMToday auth token when you are using upfront authentication.DrmTodayConfiguration.Builder
drm(Drm drm)
DrmTodayConfiguration.Builder
drmTodayMobile(boolean value)
Use this method to enable support for the DRMtoday-Mobile server.DrmTodayConfiguration.Builder
drmTodayMobileUrl(String url)
If you are using DRM-today Mobile, use this method to specify the base URL for the DRM-today Mobile server.DrmTodayConfiguration.Builder
forceWidevineL3(boolean forceWidevineL3)
If set to true, Widevine L3 will be enforced.DrmTodayConfiguration
get()
Create the configuration.DrmTodayConfiguration.Builder
keyRotation(boolean enabled)
Enforce Key-Rotation support also on older devices before Android M.DrmTodayConfiguration.Builder
mediaDrmProperties(Bundle mediaDrmProperties)
Sets the mediaDrmProperties bundleDrmTodayConfiguration.Builder
offlineId(String offlineId)
Set the ID that will be used to store the offline key for this DRM configuration.DrmTodayConfiguration.Builder
omaActivationServerUrl(String omaActivationServerUrl)
Set a dedicated Activation Server URL for OMA when using DRMtoday mobile.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.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.DrmTodayConfiguration.Builder
requestId(String requestId)
Sets the request id.DrmTodayConfiguration.Builder
variantId(String variantId)
Set the variant ID.
-
-
-
Constructor Detail
-
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
public Builder(@NonNull DrmTodayConfiguration drmTodayConfiguration)
-
-
Method Detail
-
assetId
public DrmTodayConfiguration.Builder assetId(@NonNull String 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
-
drmTodayMobile
public DrmTodayConfiguration.Builder drmTodayMobile(boolean value)
Use this method to enable support for the DRMtoday-Mobile server.- Parameters:
value
- the DRMTodayMobile flag value- Returns:
- The builder
-
drmTodayMobileUrl
public DrmTodayConfiguration.Builder drmTodayMobileUrl(String url)
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
public DrmTodayConfiguration.Builder additionalAssetIds(@Nullable 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. 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
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
public DrmTodayConfiguration.Builder variantId(String variantId)
Set the variant ID. This isnull
by default- Parameters:
variantId
- the variant ID- Returns:
- The builder
-
authToken
public DrmTodayConfiguration.Builder authToken(String authToken)
Set the DRMToday auth token when you are using upfront authentication.- Parameters:
authToken
- the DRMToday auth token- Returns:
- The builder
-
offlineId
public DrmTodayConfiguration.Builder offlineId(@Nullable String 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
public DrmTodayConfiguration.Builder drm(@NonNull Drm drm)
-
audioDrm
public DrmTodayConfiguration.Builder audioDrm(Drm audioDrm)
Set a dedicated DRM system for audio tracks.- Parameters:
audioDrm
- The DRM system used for audio tracks- Returns:
- The builder
-
omaActivationServerUrl
public DrmTodayConfiguration.Builder omaActivationServerUrl(String 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
public DrmTodayConfiguration.Builder keyRotation(boolean enabled)
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
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
public DrmTodayConfiguration.Builder forceWidevineL3(boolean 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
public DrmTodayConfiguration.Builder requestId(String 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
public DrmTodayConfiguration.Builder mediaDrmProperties(@NonNull Bundle mediaDrmProperties)
Sets the mediaDrmProperties bundle- Parameters:
mediaDrmProperties
- The properties of mediaDrm- Returns:
- the Builder
-
get
public DrmTodayConfiguration get()
Create the configuration.- Returns:
- The DRM configuration
-
-