Cloud DRM is a leading Digital Rights Management as a Service (DRMaaS) provider. Radiant Media Player is fully compatible with Cloud DRM technology, enabling reliable delivery of secure content using various DRM schemes across multiple platforms. This guide provides instructions on how to implement Cloud DRM with Radiant Media Player for different streaming protocols and DRM systems
Cloud DRM is a Radiant Media Player technology alliance partner.
To start, you will need to prepare your content for MPEG-DASH streaming with Widevine and PlayReady DRM using your Cloud DRM account. Radiant Media Player, leveraging the Shaka player implementation, handles the loading and parsing of the MPEG-DASH manifest, contacts the Cloud DRM licensing servers, and displays the content upon authorization. Below is a complete example demonstrating how to configure the player settings for Widevine and PlayReady using license server URLs provided by Cloud DRM. General documentation for MPEG-DASH streaming with Radiant Media Player can be found here. General documentation for using DRM with Radiant Media Player can be found here.
Below you will find a complete example for using Cloud DRM with Radiant Media Player.
<script src="https://cdn.radiantmediatechs.com/rmp/10.7.5/js/rmp.min.js"></script> <div id="rmp"></div> <script> // Cloud DRM token const token = "your-cloud-drm-token"; // MPEG-DASH streaming URL const src = { dash: 'https://your-dash-url.mpd' }; // Cloud DRM license server for PlayReady const playReadyLaURL = 'https://drm.cloud-playready-license-server'; // Cloud DRM license server for Widevine const widevineLaURL = 'https://drm.cloud-widevine-license-server'; // create Radiant Media Player instance const rmp = new RadiantMP('rmp'); const settings = { licenseKey: 'your-license-key', src, width: 640, height: 360, contentMetadata: { poster: [ 'https://your-poster-url.jpg' ] }, // Here we pass our Cloud DRM DRM data shakaDrm: { servers: { "com.widevine.alpha": widevineLaURL, "com.microsoft.playready": playReadyLaURL } } }; // add user token to the license server urls Object.entries(settings.shakaDrm.servers).forEach(([key, value]) => { const urlObject = new URL(value); urlObject.searchParams.set("usertoken", token); settings.shakaDrm.servers[key] = urlObject.toString(); }); async function initRmpPlayer() { try { await rmp.init(settings); } catch (error) { console.error('Radiant Media Player failed to initialize', error); } } initRmpPlayer(); </script>
FairPlay Streaming (FPS) requires HLS streaming and is essential for delivering DRM-encrypted content to Apple devices (macOS Safari 12+, iOS/iPadOS). More information about FPS support in Radiant Media Player can be found here.
<script src="https://cdn.radiantmediatechs.com/rmp/10.7.5/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
function rewriteUrlParams(sourceUrl, targetUrl) {
const sourceParams = new URL(sourceUrl).searchParams;
const target = new URL(targetUrl);
sourceParams.forEach((value, key) => {
target.searchParams.set(key, value);
});
return target.toString();
}
function shakaCustomRequestFilter(type, request) {
if (type !== shaka.net.NetworkingEngine.RequestType.LICENSE) {
return;
}
if (request.drmInfo.keySystem === "com.apple.fps") {
const skdUri = shaka.util.StringUtils.fromBytesAutoDetect(
request.initData
);
// VideoKit Cloud DRM requires passing parameters from the skd uri to the license server URL
const modifiedLicenseServerUrl = rewriteUrlParams(
skdUri,
request.drmInfo.licenseServerUri
);
request.uris = [modifiedLicenseServerUrl];
return;
}
return;
}
// Cloud DRM token
const token = "your-cloud-drm-token";
// copy your license acquisition and certificate urls from: https://console.videokit.cloud/dashboard/drm/configuration
const fairplayLicenseUrl = "your-cloud-drm-fairplay-license-url";
const fairplayServerCertificateUrl = "your-cloud-drm-fairplay-server-certificate-url";
const settings = {
licenseKey: "your-radiant-media-player-license-key",
src: {
hls: "your-cloud-drm-fairplay-hls-url.m3u8",
},
width: 640,
height: 360,
skin: "s1",
hlsEngine: "shakaplayer",
shakaDrmEmeFairPlay: true,
shakaCustomRequestFilter: shakaCustomRequestFilter,
shakaDrm: {
servers: {
"com.apple.fps": fairplayLicenseUrl,
},
advanced: {
"com.apple.fps": {
serverCertificateUri: fairplayServerCertificateUrl,
},
},
},
};
// add user token to the license server urls
Object.entries(settings.shakaDrm.servers).forEach(([key, value]) => {
const urlObject = new URL(value);
urlObject.searchParams.set("usertoken", token);
settings.shakaDrm.servers[key] = urlObject.toString();
});
const elementID = "rmp";
const rmp = new RadiantMP(elementID);
async function initRmpPlayer() {
try {
await rmp.init(settings);
} catch (error) {
console.error("Radiant Media Player failed to initialize", error);
}
}
initRmpPlayer();
</script>
Note: The functions and parameters shown above are specific to the Cloud DRM implementation details. You should obtain the exact values and logic from your Cloud DRM documentation.
In most production scenarios, you will want to use a combination of MPEG-DASH with Widevine and PlayReady DRM (for non-Apple devices) and FPS DRM (for Apple devices) to ensure the broadest compatibility. When both DRM configurations are provided to Radiant Media Player, it automatically detects the most suitable DRM system for the client device and uses the related configuration data to play back content securely.
<script src="https://cdn.radiantmediatechs.com/rmp/10.7.5/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
async function checkDRM() {
if (typeof navigator.requestMediaKeySystemAccess === "function") {
const config = [
{
initDataTypes: ["cenc"],
audioCapabilities: [{ contentType: 'audio/mp4;codecs="mp4a.40.2"' },],
videoCapabilities: [{ contentType: 'video/mp4;codecs="avc1.42E01E"' },],
},
];
const drmSystems = [
{ keySystem: "com.widevine.alpha", name: "Widevine" },
{ keySystem: "com.microsoft.playready", name: "PlayReady" },
{ keySystem: "com.apple.fps.1_0", name: "FairPlay" },
];
const supportedDRMs = [];
return Promise.all(drmSystems.map((keySystem) =>
navigator.requestMediaKeySystemAccess(keySystem.keySystem, config).
then(() => supportedDRMs.push(keySystem.name)).
catch((error) => { }))).
then(() => supportedDRMs);
} else {
return Promise.reject("EME API not supported in this browser.");
}
}
function rewriteUrlParams(sourceUrl, targetUrl) {
const sourceParams = new URL(sourceUrl).searchParams;
const target = new URL(targetUrl);
sourceParams.forEach((value, key) => {
target.searchParams.set(key, value);
});
return target.toString();
}
function shakaCustomRequestFilter(type, request) {
if (type !== shaka.net.NetworkingEngine.RequestType.LICENSE) {
return;
}
if (request.drmInfo.keySystem === "com.apple.fps") {
// VideoKit Cloud DRM requires passing parameters from the skd uri to the license server URL
const skdUri = shaka.util.StringUtils.fromBytesAutoDetect(request.initData);
const modifiedLicenseServerUrl = rewriteUrlParams(skdUri, request.drmInfo.licenseServerUri);
request.uris = [modifiedLicenseServerUrl];
return;
}
return;
}
// Cloud DRM token
const token = "user-token";
// copy your license acquisition and certificate urls from: https://console.videokit.cloud/dashboard/drm/configuration
const widevineLicenseUrl = "https://example-tenant-codename.la.drm.cloud/acquire-license/widevine?BrandGuid=11111-1111-1111-1111-1111111";
const playreadyLicenseUrl = "https://example-tenant-codename.la.drm.cloud/acquire-license/playready?BrandGuid=11111-1111-1111-1111-1111111";
const fairplayLicenseUrl = "https://example-tenant-codename.la.drm.cloud/acquire-license/fairplay?BrandGuid=11111-1111-1111-1111-1111111";
const fairplayServerCertificateUrl = "https://example-tenant-codename.la.drm.cloud/certificate/fairplay?BrandGuid=11111-1111-1111-1111-1111111";
const settings = {
licenseKey: "player-key",
src: {
dash: "https://example.com/dash/index.mpd",
hls: "https://example.com/hls/index.m3u8",
},
width: 640,
height: 360,
skin: "s1",
hlsEngine: "shakaplayer",
shakaDrmEmeFairPlay: true,
shakaCustomRequestFilter: shakaCustomRequestFilter,
shakaDrm: {
servers: {
"com.apple.fps": fairplayLicenseUrl,
"com.microsoft.playready": playreadyLicenseUrl,
"com.widevine.alpha": widevineLicenseUrl,
},
advanced: {
"com.apple.fps": { serverCertificateUri: fairplayServerCertificateUrl, },
},
},
};
Object.entries(settings.shakaDrm.servers).forEach(([key, value]) => {
const urlObject = new URL(value);
urlObject.searchParams.set("usertoken", token);
settings.shakaDrm.servers[key] = urlObject.toString();
});
const elementID = "rmp";
const rmp = new RadiantMP(elementID);
async function initRmpPlayer() {
try {
const supportedDrmSystems = await checkDRM();
const isFairPlaySupported = supportedDrmSystems.includes("FairPlay");
if (!isFairPlaySupported) {
// prevents Radiant Player from trying to play hls stream if FairPlay is not supported
delete settings.src.hls;
}
await rmp.init(settings);
} catch (error) {
console.error("Radiant Media Player failed to initialize", error);
}
}
initRmpPlayer();
</script>
©2015-2025 Radiant Media Player. All Rights Reserved.