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 of `DrmTodayConfiguration`s

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder(DrmTodayConfiguration drmTodayConfiguration)`
  Creates a new Builder instance.
  `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

  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)`
  Set the default DRM system
  `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 bundle
  `DrmTodayConfiguration.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`
  `preferManifestUrl(boolean preferManifestUrl)`
  Use to set if the manifest DRM Url shall be preferred
  `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.
  `DrmTodayConfiguration.Builder`
  `requestId(String requestId)`
  Sets the request id.
  `DrmTodayConfiguration.Builder`
  `variantId(String variantId)`
  Set the variant ID.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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 of `DrmTodayConfiguration.DRMTODAY_TEST`, `DrmTodayConfiguration.DRMTODAY_STAGING`, or `DrmTodayConfiguration.DRMTODAY_PRODUCTION`
      `userId` - The userID
      `sessionId` - The sessionID
      `merchant` - 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 of `DrmTodayConfiguration.DRMTODAY_TEST`, `DrmTodayConfiguration.DRMTODAY_STAGING`, or `DrmTodayConfiguration.DRMTODAY_PRODUCTION`
      `userId` - The userID
      `sessionId` - The sessionID
      `merchant` - The merchant
      `drm` - 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 of `DrmTodayConfiguration.DRMTODAY_TEST`, `DrmTodayConfiguration.DRMTODAY_STAGING`, or `DrmTodayConfiguration.DRMTODAY_PRODUCTION`
      `userId` - The userID
      `sessionId` - The sessionID
      `merchant` - The merchant
      `assetId` - The asset ID
      `drm` - The DRM system

  - ### Builder

    public Builder(@NonNull DrmTodayConfiguration drmTodayConfiguration)
    Creates a new Builder instance.
    Parameters:
      `drmTodayConfiguration` - The DRMToday configuration.

- ## 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