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 of DrmTodayConfigurations
  • Constructor Details

  • Method Details

    • assetId

      @NonNull 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
    • preferManifestUrl

      @NonNull public DrmTodayConfiguration.Builder preferManifestUrl(boolean preferManifestUrl)
      Use to set if the manifest DRM Url shall be preferred
      Parameters:
      preferManifestUrl - true to prefer manifest DRM Url
      Returns:
      The builder
    • drmTodayMobile

      @NonNull 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

      @NonNull 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

      @NonNull 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

      @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 is true by default.
      Parameters:
      playClearSamplesWithoutKeys - play clear samples
      Returns:
      The builder
    • variantId

      @NonNull public DrmTodayConfiguration.Builder variantId(String variantId)
      Set the variant ID. This is null by default
      Parameters:
      variantId - the variant ID
      Returns:
      The builder
    • authToken

      @NonNull 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

      @NonNull 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 is null, offline key storage will be disabled
      Parameters:
      offlineId - the ID used to store offline keys for this DRM configuration or null to disable offline key sotrage
      Returns:
      The builder
    • drm

      @NonNull public DrmTodayConfiguration.Builder drm(@NonNull Drm drm)
      Set the default DRM system
      Parameters:
      drm - The default DRM system
      Returns:
      The builder
    • audioDrm

      @NonNull 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

      @NonNull 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

      @NonNull 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

      @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 in renewalThreshold 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 via PlayerController.setConfigurationProvider(ConfigurationProvider)

      Parameters:
      renewalThreshold - The expiration threshold time value
      timeUnit - The time unit of the renewalThreshold
      Returns:
      The builder
    • forceWidevineL3

      @NonNull 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

      @NonNull 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

      @NonNull public DrmTodayConfiguration.Builder mediaDrmProperties(@NonNull Bundle mediaDrmProperties)
      Sets the mediaDrmProperties bundle
      Parameters:
      mediaDrmProperties - The properties of mediaDrm
      Returns:
      the Builder
    • get

      @NonNull public DrmTodayConfiguration get()
      Create the configuration.
      Returns:
      The DRM configuration