DRMtoday by castLabs is a popular DRM service provider. Radiant Media Player is compatible with DRMtoday technology to reliably deliver content with DASH in both Widevine and PlayReady DRM and with HLS in FairPlay DRM. You can review our compatibility table for DRM with DASH or HLS streaming here.
This documentation will guide you on how to easily implement DRMtoday with Radiant Media Player.
castLabs is a Radiant Media Player technology alliance partner.
First, you will need an account with DRMtoday by castLabs and to prepare your content for DASH streaming with Widevine and PlayReady DRM. Radiant Media Player will take care of loading and parsing the DASH manifest, contacting the DRM licensing servers and displaying content when authorised. Our DASH streaming & DRM implementation is based on Shaka player. Documentation for DASH streaming with Radiant Media Player can be found here. Documentation for using DRM with Radiant Media Player can be found here. Below you will find a complete example for using DRMtoday with Radiant Media Player.
<script src="https://cdn.radiantmediatechs.com/rmp/9.16.6/js/rmp.min.js"></script> <div id="rmp"></div> <script> // DASH streaming URL const src = { dash: 'https://your-dash-url.mpd' }; // license server for PlayReady const playReadyLaURL = 'https://aaa.bbb.drmtoday.com/license-proxy-headerauth/drmtoday/RightsManager.asmx'; // license server for Widevine const widevineLaURL = 'https://aaa.bbb.drmtoday.com/license-proxy-widevine/cenc/'; // create Radiant Media Player instance const rmp = new RadiantMP('rmp'); // custom response DRM filter for Radiant Media Player to properly access DRMtoday licensing servers const shakaCustomResponseFilter = function (type, response) { if (type !== shaka.net.NetworkingEngine.RequestType.LICENSE) { return; } const responseText = shaka.util.StringUtils.fromUTF8(response.data); if (responseText.indexOf('<AcquireLicenseResponse') > -1) { // If playready do nothing } else { try { // If widevine response const wrapped = JSON.parse(responseText); response.data = shaka.util.Uint8ArrayUtils.fromBase64(wrapped.license); } catch (e) { console.log(e); } } }; const settings = { licenseKey: 'your-license-key', src: src, width: 640, height: 360, contentMetadata: { poster: [ 'https://your-poster-url.jpg' ] }, // here we pass our custom DRM data shakaDrm: { servers: { "com.widevine.alpha": widevineLaURL, "com.microsoft.playready": playReadyLaURL } }, shakaRequestConfiguration: { license: { headers: { 'dt-custom-data': btoa(JSON.stringify({ userId: 'your-user-id', sessionId: 'your-sesson-id', merchant: 'your-merchant-id' })) } } }, shakaCustomResponseFilter: shakaCustomResponseFilter, // enables Google Cast with DRM content for DRMtoday (Widevine) googleCastDrmToday: true }; rmp.init(settings); </script>
We also support FairPlay streaming with DRMtoday by castLabs to Radiant Media Player. FairPlay streaming, which requires HLS, aims at providing support for DRM encrypted content to Apple devices, for us this is macOS Safari 11+, Safari for iOS 10+, iPadOS 13+ and iOS 13+ WebView. More information about FPS support in Radiant Media Player can be found here.
<script src="https://cdn.radiantmediatechs.com/rmp/9.16.6/js/rmp.min.js"></script> <div id="rmp"></div> <script> // HLS FPS streaming URL const src = { fps: 'https://fps-hls-url.m3u8' }; // FPS certificate URL const certificatePath = 'https://aaa.bbb.drmtoday.com/license-server-fairplay/cert/ccc'; // FPS license server URL const processSpcPath = 'https://aaa.bbb.drmtoday.com/license-server-fairplay/'; // HTTP headers for FPS license server URL const licenseRequestHeaders = [ { name: 'dt-custom-data', value: 'INSERT-YOUR-BASE64-ENCODED-CUSTOMDATA' }, { name: 'content-type', value: 'application/octet-stream' } ]; // Prepare body for license request const licenseRequestMessage = function (message) { return message; }; // Prepare contentId const extractContentId = function (initData) { const arrayToString = function (array) { const uint16array = new Uint16Array(array.buffer); return String.fromCharCode.apply(null, uint16array); }; const contentId = arrayToString(initData); const pattern = 'skd://'; let parameters; const idx = contentId.indexOf(pattern); if (idx > -1) { parameters = contentId.substring(idx + pattern.length); parameters = parameters.replace(/assetid/gi, 'assetId'); parameters = parameters.replace(/variantid/gi, 'variantId'); return parameters; } else { return ''; } }; // Player settings const settings = { licenseKey: 'your-license-key', src: src, width: 640, height: 360, fpsDrm: { certificatePath: certificatePath, processSpcPath: processSpcPath, licenseRequestHeaders: licenseRequestHeaders, licenseRequestMessage: licenseRequestMessage, extractContentId: extractContentId } }; const rmp = new RadiantMP('rmp'); rmp.init(settings); </script>
In real life case scenario, it is likely you will want to use a combination of DASH with Widevine and PlayReady DRM and FPS DRM to maximise device reach. When you provide both DASH DRM and FPS DRM data to Radiant Media Player it will automatically detect which is supported for the targeted device and use the related DRM information to playback content securely.
<script src="https://cdn.radiantmediatechs.com/rmp/9.16.6/js/rmp.min.js"></script> <div id="rmp"></div> <script> // DASH + FPS streaming URLs const src = { dash: 'https://your-dash-url.mpd', fps: 'https://fps-hls-url.m3u8' }; // DASH with Widevine and Playready DRM // license server for PlayReady const playReadyLaURL = 'https://aaa.bbb.drmtoday.com/license-proxy-headerauth/drmtoday/RightsManager.asmx'; // license server for Widevine const widevineLaURL = 'https://aaa.bbb.drmtoday.com/license-proxy-widevine/cenc/'; // custom response DRM filter for Radiant Media Player to properly access DRMtoday licensing servers const shakaCustomResponseFilter = function (type, response) { if (type !== shaka.net.NetworkingEngine.RequestType.LICENSE) { return; } const responseText = shaka.util.StringUtils.fromUTF8(response.data); if (responseText.indexOf('<AcquireLicenseResponse') > -1) { // If playready do nothing } else { try { // If widevine response const wrapped = JSON.parse(responseText); response.data = shaka.util.Uint8ArrayUtils.fromBase64(wrapped.license); } catch (e) { console.log(e); } } }; // FairPlay streaming // FPS certificate URL const certificatePath = 'https://aaa.bbb.drmtoday.com/license-server-fairplay/cert/ccc'; // FPS license server URL const processSpcPath = 'https://aaa.bbb.drmtoday.com/license-server-fairplay/'; // HTTP headers for FPS license server URL const licenseRequestHeaders = [ { name: 'dt-custom-data', value: 'INSERT-YOUR-BASE64-ENCODED-CUSTOMDATA' }, { name: 'content-type', value: 'application/octet-stream' } ]; // Prepare body for license request const licenseRequestMessage = function (message) { return message; }; // Prepare contentId const extractContentId = function (initData) { const arrayToString = function (array) { const uint16array = new Uint16Array(array.buffer); return String.fromCharCode.apply(null, uint16array); }; const contentId = arrayToString(initData); const pattern = 'skd://'; let parameters; const idx = contentId.indexOf(pattern); if (idx > -1) { parameters = contentId.substring(idx + pattern.length); parameters = parameters.replace(/assetid/gi, 'assetId'); parameters = parameters.replace(/variantid/gi, 'variantId'); return parameters; } else { return ''; } }; const settings = { licenseKey: 'your-license-key', src: src, width: 640, height: 360, contentMetadata: { poster: [ 'https://your-poster-url.jpg' ] }, // here we pass our custom DRM data shakaDrm: { servers: { "com.widevine.alpha": widevineLaURL, "com.microsoft.playready": playReadyLaURL } }, shakaRequestConfiguration: { license: { headers: { 'dt-custom-data': btoa(JSON.stringify({ userId: 'your-user-id', sessionId: 'your-sesson-id', merchant: 'your-merchant-id' })) } } }, shakaCustomResponseFilter: shakaCustomResponseFilter, googleCastDrmToday: true, fpsDrm: { certificatePath: certificatePath, processSpcPath: processSpcPath, licenseRequestHeaders: licenseRequestHeaders, licenseRequestMessage: licenseRequestMessage, extractContentId: extractContentId } }; const rmp = new RadiantMP('rmp'); rmp.init(settings); </script>
©2015-2024 Radiant Media Player. All Rights Reserved.