DRM¶
Playing digital rights management (DRM)-protected content requires DRM configuration, and the details differ by DRM solution. PRESTOplay for Web Apps supports several DRM solutions out of the box through preconfigured DRM environments, and you can also register a custom environment for full control over license acquisition.
Code samples
Multiple DRM environments: plays assets whose licenses come from different DRM providers in the same player.
Note
Your website must be served over HTTPS to play DRM-protected content. HTTPS
is not required when testing on localhost.
See also Persistent DRM licenses for offline playback of DRM-protected content.
DRM environments¶
Pass DRM configuration under the drm key in the Player.open
call. drm.env selects the DRM environment, and drm.customData holds its
properties. Each environment has its own page:
CDM configuration¶
Depending on the device and platform, a content decryption module (CDM)
might require specific configuration to work. The distinctiveIdentifierRequired
and persistentStateRequired flags must be true on some platforms and
false on others.
Use the CDM probe page to check which CDMs and CDM configurations your browser supports.
With a custom DRM environment, configure these flags as follows:
const environment = new clpp.drm.DrmEnvironment('myDrm');
environment.setDrmSystem(clpp.drm.KeySystem.WIDEVINE, {
licenseUrl: '...',
distinctiveIdentifierRequired: true,
persistentStateRequired: true,
});
clpp.drm.registerDrmEnvironment(environment);
You can also pass them as Widevine custom data:
player.open({
source: 'https://example.com/Manifest.mpd',
drm: {
env: 'DRMtoday',
customData: {
userId: 'purchase',
widevineDistinctiveIdentifierRequired: true,
widevinePersistentStateRequired: true,
}
}
});
Customizing license requests¶
If your license server needs more than a built-in DRM environment offers, such as a token fetched at request time, a custom request body, a wrapped license response, or a custom FairPlay content ID, add modifiers to a custom DRM environment. See Customizing license requests.
Multiple DRM environments¶
When using multiple DRM solutions, give each DRM environment a unique name. Reusing a name can cause unspecified behavior, especially when multiple player instances are active at the same time.
Encrypted Media Extensions API¶
PRESTOplay for Web Apps uses the Encrypted Media Extensions (EME) API to decrypt content. Some platforms provide different versions or implementations of this API, and the SDK automatically selects the most suitable one.
Override this selection with the drm.emeApi configuration option, passing
a value from drm.eme.EmeFactory.Apis:
const player = new clpp.Player('video', {
drm: {
emeApi: clpp.drm.eme.EmeFactory.Apis.APPLE,
},
});
DRM providers and FairPlay¶
To use FairPlay with the MSE player on Safari alongside the default standard EME, your DRM provider must support it. DRMtoday provides full support for this scenario out-of-the-box.