Skip to content

Test DRM Playback

After creating a content key policy and streaming locator, test that your encrypted streams play correctly. MK.IO provides the MKPlayer testing page for quick validation. For integration into your own application, use the MKPlayer SDK.

  1. Navigate to the Assets page and select your asset.
  2. Select the streaming locator and a running streaming endpoint.
  3. Select Apply to generate the URLs.
  4. Copy the playback URL for your chosen protocol (HLS or DASH).
  5. Copy the license acquisition URL for your DRM system (Widevine, PlayReady, FairPlay, or ClearKey).
  1. Navigate to the MKPlayer page.
  2. Select the protocol (HLS or DASH).
  3. Select the DRM system that matches your content key policy.
  4. Paste the playback URL in Source URL.
  5. Paste the license acquisition URL in License URL.

Add authorization (token-protected content)

Section titled “Add authorization (token-protected content)”

If your content key policy uses token restriction, add the JWT token in the License request headers field:

{"Authorization": "Bearer <your-jwt-token>"}

See JWT token authentication to generate a token.

Select Play. If the configuration is correct, the player decrypts and plays the stream.

ErrorCauseSolution
DRM_FAILED_LICENSE_REQUESTMissing or invalid JWT token.Verify the token and add it to the license request headers.
License URL not populatedStreaming locator not applied.Select Apply on the streaming locator to generate URLs.
Playback fails on specific browserDRM system not supported on that browser.Select the correct DRM for the browser. See DRM support by platform.

For integration into your own application, use the MKPlayer SDK to configure DRM playback programmatically.

Create a source configuration object with your playback URLs and DRM license URLs. You can include multiple DRM systems in the configuration. The player automatically selects the most suitable one for the current platform.

const sourceConfig = {
title: "Title for your source",
description: "Description for your source",
hls: "HLS URL as copied from the Assets page",
dash: "DASH URL as copied from the Assets page",
drm: {
// For Safari Browser with HLS + FairPlay Content Protection
fairplay: {
LA_URL: "FairPlay License URL as copied from the Assets page",
certificateURL: "FairPlay Certificate URL as copied from the Assets page",
headers: {
"Authorization": "Bearer <jwtToken>"
}
},
// For Chrome, Edge browsers
widevine: {
LA_URL: "Widevine License URL as copied from the Assets page",
headers: {
"Authorization": "Bearer <jwtToken>"
}
},
// For Edge (Windows) browser
playready: {
LA_URL: "PlayReady License URL as copied from the Assets page",
headers: {
"Authorization": "Bearer <jwtToken>"
}
}
}
};

Each platform or browser has a preferred DRM system. If you are uncertain which DRM to use, include all applicable systems in the configuration. The player selects the best match for the current environment.

Remove the headers objects if your content key policy does not use token restriction.

Pass the source configuration to the player:

player.load(sourceConfig)
.then(() => {
console.log("Source loaded successfully");
})
.catch((error) => {
console.error("An error occurred while loading the source");
});

Refer to the MKPlayer documentation for additional configuration options and event handling.

© 2025–2026 MediaKind. All rights reserved.