Radiant Media Player

Working with EZDRM



Guide sections


Scope of support

EZDRM is a popular DRM as a Service (DRMaaS) provider. Radiant Media Player is compatible with EZDRM technology to reliably deliver content with DASH with both Widevine and PlayReady DRM. Apple FairPlay Streaming is also supported. You can review our compatibility table for DRM with DASH or HLS streaming here.

This documentation will guide you on how to easily implement EZDRM with Radiant Media Player.

EZDRM is a Radiant Media Player technology alliance partner.


DASH with Widevine and PlayReady DRM

First, you will need an account with EZDRM 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. General documentation for 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 EZDRM with Radiant Media Player.

<script src="https://cdn.radiantmediatechs.com/rmp/5.9.2/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
  // DASH streaming URL
  var src = {
    dash: 'https://your-dash-url.mpd'
  };
  // EZDRM license server for PlayReady
  var playReadyLaURL = 'https://ezdrm-playready-license-server';
  // EZDRM license server for Widevine
  var widevineLaURL = 'https://ezdrm-widevine-license-server';
  // create Radiant Media Player instance
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);
  var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    },
    // here we pass our EZDRM DRM data
    shakaDrm: {
      servers: {
        "com.widevine.alpha": widevineLaURL,
        "com.microsoft.playready": playReadyLaURL
      }
    }
  };
  rmp.init(settings);
</script>

Apple FairPlay streaming (FPS)

We also support FairPlay streaming with EZDRM 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 10+, Safari for iOS 11.2+, 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/5.9.2/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
  var src = {
    fps: 'https://fps-hls-url.m3u8'
  };
  // we define our functions and variables to be passed to the player
  // this is specific to FairPlay streaming with EZDRM
  // extractContentId
  var extractContentId = function (initData) {
    var arrayToString = function (array) {
    var uint16array = new Uint16Array(array.buffer);
      return String.fromCharCode.apply(null, uint16array);
    };
    var uri = arrayToString(initData);
    var uriParts = uri.split('://', 1);
    var protocol = uriParts[0].slice(-3);
    uriParts = uri.split(';', 2);
    var contentId = uriParts.length > 1 ? uriParts[1] : '';
    return protocol.toLowerCase() == 'skd' ? contentId : '';
  };
  // licenseRequestMessage
  var licenseRequestMessage = function (message) {
    return new Blob([message], { type: 'application/octet-binary' });
  };
  // licenseRequestLoaded
  var licenseRequestLoaded = function (event) {
    var request = event.target;
    if (request.status == 200) {
      var blob = request.response;
      var reader = new FileReader();
      reader.addEventListener('loadend', function () {
        var array = new Uint8Array(reader.result);
        request.session.update(array);
      });
      reader.readAsArrayBuffer(blob);
    }
  };
  // processSpcPath
  var processSpcPath = 'https://fps.ezdrm.com/api/licenses/<ezdrm-token>' + '?p1=' + Date.now();
  // licenseRequestHeaders
  var licenseRequestHeaders = [
    {
      name: 'Content-type',
      value: 'application/octet-stream'
    }
  ];
  var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    },
    // we pass here our FPS setting through fpsDrm object
    fpsDrm: {
      certificatePath: 'https://ezdrm-url-to-certificate.cer',
      processSpcPath: processSpcPath,
      licenseResponseType: 'blob',
      licenseRequestHeaders: licenseRequestHeaders,
      certificateRequestHeaders: [],
      extractContentId: extractContentId,
      licenseRequestMessage: licenseRequestMessage,
      licenseRequestLoaded: licenseRequestLoaded
    }
  };
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);
  rmp.init(settings);
</script>

Maximizing device reach with FPS + DASH DRM

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/5.9.2/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
  // DASH + FPS streaming URL (HLS)
  var src = {
    dash: 'https://your-dash-url.mpd',
    fps: 'https://your-fps-url.m3u8'
  };
  // EZDRM license server for PlayReady
  var playReadyLaURL = 'https://ezdrm-playready-license-server';
  // EZDRM license server for Widevine
  var widevineLaURL = 'https://ezdrm-widevine-license-server';
  
  // create Radiant Media Player instance
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);

  // this is specific to FairPlay streaming with EZDRM
  // extractContentId
  var extractContentId = function (initData) {
    var arrayToString = function (array) {
    var uint16array = new Uint16Array(array.buffer);
      return String.fromCharCode.apply(null, uint16array);
    };
    var uri = arrayToString(initData);
    var uriParts = uri.split('://', 1);
    var protocol = uriParts[0].slice(-3);
    uriParts = uri.split(';', 2);
    var contentId = uriParts.length > 1 ? uriParts[1] : '';
    return protocol.toLowerCase() == 'skd' ? contentId : '';
  };
  // licenseRequestMessage
  var licenseRequestMessage = function (message) {
    return new Blob([message], { type: 'application/octet-binary' });
  };
  // licenseRequestLoaded
  var licenseRequestLoaded = function (event) {
    var request = event.target;
    if (request.status == 200) {
      var blob = request.response;
      var reader = new FileReader();
      reader.addEventListener('loadend', function () {
        var array = new Uint8Array(reader.result);
        request.session.update(array);
      });
      reader.readAsArrayBuffer(blob);
    }
  };
  // processSpcPath
  var processSpcPath = 'https://fps.ezdrm.com/api/licenses/<ezdrm-token>' + '?p1=' + Date.now();
  // licenseRequestHeaders
  var licenseRequestHeaders = [
    {
      name: 'Content-type',
      value: 'application/octet-stream'
    }
  ];

  // passing our player settings
  var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    },
    // here we pass our EZDRM FPS DRM data
    fpsDrm: {
      certificatePath: 'https://ezdrm-url-to-certificate.cer',
      processSpcPath: processSpcPath,
      licenseResponseType: 'blob',
      licenseRequestHeaders: licenseRequestHeaders,
      certificateRequestHeaders: [],
      extractContentId: extractContentId,
      licenseRequestMessage: licenseRequestMessage,
      licenseRequestLoaded: licenseRequestLoaded
    },
    // here we pass our EZDRM DASH DRM data
    shakaDrm: {
      servers: {
        "com.widevine.alpha": widevineLaURL,
        "com.microsoft.playready": playReadyLaURL
      }
    }
  };
  rmp.init(settings);
</script>
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.