DRM *** DRM overview for PRESTOplay for Web Apps. Built-in DRM environments (DRMtoday, DRMtoday Onboard, header-based, Verimatrix VCAS Ultra) and custom DRM environments each have their own page. This page covers CDM configuration, multiple DRM environments, and the Encrypted Media Extensions (EME) API. Code samples: * Multiple DRM environments (https://raw.githubusercontent.com/castlabs/prestoplay-web-code-samples/refs/heads/main/examples/drm/multiple_environments.js): 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" (https://players.castlabs.com/web/latest/docs/api/clpp.Player.md#open) call. "drm.env" selects the DRM environment, and "drm.customData" holds its properties. Each environment has its own page: * DRMtoday (drm-drmtoday.txt): Play DRM-protected content with the preconfigured DRMtoday environment: the DRMtoday and DRMtoday_STAGING environments and their customData properties. * DRMtoday Onboard (drm-drmtoday-onboard.txt): Get licenses from a DRMtoday Onboard server on a private network, such as on a plane or ship: the cl.onboard component and its customData properties. * Header-based DRM (drm-header.txt): Integrate a custom license server with the header-based DRM environment: license URLs, custom request headers, and robustness levels. * Verimatrix VCAS Ultra (drm-verimatrix.txt): Play content protected with Verimatrix VCAS Ultra: the cl.verimatrix component and its customData properties. * Custom DRM environment (drm-custom.txt): Register a custom DRM environment with drm.DrmEnvironment for full control over license acquisition. 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 (https://demo.castlabs.com/cdm) 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" (https://players.castlabs.com/web/latest/docs/api/clpp.drm.eme.EmeFactory.Apis.md): 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. * Persistent DRM licenses (persistent-licenses.txt): Store and remove persistent DRM licenses, with or without a player instance, and use custom session storage. * Customizing license requests (drm-modifiers.txt): Customize DRM license and certificate requests and responses with modifiers: auth tokens, custom payloads, wrapped responses, and FairPlay content IDs.