Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class DrmConfig
- Object
- DrmConfig
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.
Constructors
public DrmConfig(DrmScheme scheme, String licenseUrl) | Creates a configuration for the given scheme. |
Methods
public DrmScheme getScheme() | The protection scheme. |
public String getLicenseUrl() | Where the player posts its license challenge. |
public DrmConfig setCertificateUrl(String certificateUrl) | Sets the URL of the FairPlay application certificate, the DER file Apple issues to the content owner. |
public String getCertificateUrl() | The FairPlay application certificate URL. |
public DrmConfig setContentId(String contentId) | Sets the FairPlay content identifier passed to the key request. |
public String getContentId() | The FairPlay content identifier. |
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. |
public Map<String, String> getLicenseHeaders() | The headers sent with every license request. |
Inherited methods
Constructor details
DrmConfig
public DrmConfig(DrmScheme scheme, String licenseUrl)Creates a configuration for the given scheme.
Parameters
schemeDrmScheme- the protection scheme the stream is packaged with
licenseUrlString- 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_128setCertificateUrl
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
certificateUrlString- 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
contentIdString- 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
nameString- the header name
valueString- 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