Class DrmConfig

java.lang.Object
com.codename1.media.DrmConfig

public final class DrmConfig extends Object

How a StreamRequest obtains the keys of a protected stream: the scheme, the license server URL, and whatever that server needs to authorize the request.

The license exchange is made by the platform player, or by the port on the player's behalf. The request body is the opaque challenge the scheme defines and the response goes back to the player unread, so the license server is the only party that interprets either:

String playbackToken = "token-from-your-server";
DrmConfig drm = new DrmConfig(DrmScheme.WIDEVINE, "https://example.com/license/widevine")
        .addLicenseHeader("Authorization", "Bearer " + playbackToken);

DrmScheme.AES_128 needs no license URL: the key URL is in the playlist, and any token it needs belongs in that URL.

  • Constructor Details

    • DrmConfig

      public DrmConfig(DrmScheme scheme, String licenseUrl)

      Creates a configuration for the given scheme.

      Parameters
      • scheme: the protection scheme the stream is packaged with

      • licenseUrl: where the player posts its license challenge; may be null only for DrmScheme.AES_128, whose key URL is part of the playlist

  • Method Details

    • getScheme

      public DrmScheme getScheme()

      The protection scheme.

      Returns

      the scheme this configuration was created with

    • getLicenseUrl

      public String getLicenseUrl()

      Where the player posts its license challenge.

      Returns

      the license URL, or null for DrmScheme.AES_128

    • setCertificateUrl

      public DrmConfig setCertificateUrl(String certificateUrl)

      Sets the URL of the FairPlay application certificate, the DER file Apple issues to the content owner. Required for DrmScheme.FAIRPLAY and ignored by every other scheme.

      Parameters
      • certificateUrl: the certificate URL
      Returns

      this configuration, for chaining

    • getCertificateUrl

      public String getCertificateUrl()

      The FairPlay application certificate URL.

      Returns

      the certificate URL, or null when none was set

    • setContentId

      public DrmConfig setContentId(String contentId)

      Sets the FairPlay content identifier passed to the key request. When none is set, the host of the skd:// key URL in the playlist is used, which is the common convention.

      Parameters
      • contentId: the content identifier
      Returns

      this configuration, for chaining

    • getContentId

      public String getContentId()

      The FairPlay content identifier.

      Returns

      the content identifier, or null to derive it from the key URL

    • addLicenseHeader

      public DrmConfig addLicenseHeader(String name, String value)

      Adds an HTTP header sent with every license request, typically the authorization the license server checks the viewer's entitlement with.

      Parameters
      • name: the header name

      • value: the header value

      Returns

      this configuration, for chaining

    • getLicenseHeaders

      public Map<String,String> getLicenseHeaders()

      The headers sent with every license request.

      Returns

      a copy of the headers, keyed by name