Documentation

Working With EZDRM

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/8.1.2/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  // DASH streaming URL
  const src = {
    dash: 'https://your-dash-url.mpd'
  };
  // EZDRM license server for PlayReady
  const playReadyLaURL = 'https://ezdrm-playready-license-server';
  // EZDRM license server for Widevine
  const widevineLaURL = 'https://ezdrm-widevine-license-server';
  // create Radiant Media Player instance
  const rmp = new RadiantMP('rmp');
  const 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 11+, Safari for iOS 12+, 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/8.1.2/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  const 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
  const extractContentId = function (initData) {
    const arrayToString = function (array) {
    const uint16array = new Uint16Array(array.buffer);
      return String.fromCharCode.apply(null, uint16array);
    };
    const uri = arrayToString(initData);
    let uriParts = uri.split('://', 1);
    const protocol = uriParts[0].slice(-3);
    uriParts = uri.split(';', 2);
    const contentId = uriParts.length > 1 ? uriParts[1] : '';
    return protocol.toLowerCase() == 'skd' ? contentId : '';
  };
  // licenseRequestMessage
  const licenseRequestMessage = function (message) {
    return new Blob([message], { type: 'application/octet-binary' });
  };
  // licenseRequestLoaded
  const licenseRequestLoaded = function (event) {
    const request = event.target;
    if (request.status == 200) {
      const blob = request.response;
      const reader = new FileReader();
      reader.addEventListener('loadend', function () {
        const array = new Uint8Array(reader.result);
        request.session.update(array);
      });
      reader.readAsArrayBuffer(blob);
    }
  };
  // processSpcPath
  const processSpcPath = 'https://fps.ezdrm.com/api/licenses/<ezdrm-token>' + '?p1=' + Date.now();
  // licenseRequestHeaders
  const licenseRequestHeaders = [
    {
      name: 'Content-type',
      value: 'application/octet-stream'
    }
  ];
  const 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
    }
  };
  const rmp = new RadiantMP('rmp');
  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/8.1.2/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  // DASH + FPS streaming URL (HLS)
  const src = {
    dash: 'https://your-dash-url.mpd',
    fps: 'https://your-fps-url.m3u8'
  };
  // EZDRM license server for PlayReady
  const playReadyLaURL = 'https://ezdrm-playready-license-server';
  // EZDRM license server for Widevine
  const widevineLaURL = 'https://ezdrm-widevine-license-server';
  
  // create Radiant Media Player instance
  const rmp = new RadiantMP('rmp');

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

  // passing our player settings
  const 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.

©2015-2022 Radiant Media Player. All Rights Reserved.