Documentation

Working With BuyDRM

Scope of support

BuyDRM is a studio approved full spectrum DRM technology platform with encryption, license delivery and playback on consumer platforms. Radiant Media Player is compatible with BuyDRM 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 BuyDRM with Radiant Media Player.

BuyDRM is a Radiant Media Player technology alliance partner.

DASH with Widevine and PlayReady DRM

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

<script src="https://cdn.radiantmediatechs.com/rmp/9.15.4/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  // DASH streaming URL
  const src = {
    dash: 'https://your-dash-url.mpd'
  };
  // BuyDRM license server for PlayReady
  const playReadyLaURL = 'https://buydrm-license-server-url-playready';
  // BuyDRM license server for Widevine
  const widevineLaURL = 'https://buydrm-license-server-url-widevine';
  // 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 BuyDRM data
    shakaDrm: {
      servers: {
        "com.widevine.alpha": widevineLaURL,
        "com.microsoft.playready": playReadyLaURL
      }
    }, 
    shakaRequestConfiguration: {
      license: {
        headers: {
          'customdata': 'BASE64_ENCODED_CUSTOM_DATA' 
        }
      }
    }
  };
  rmp.init(settings);
</script>

Apple FairPlay streaming (FPS)

We also support FairPlay streaming with BuyDRM to Radiant Media Player. FairPlay streaming, which requires HLS, aims at providing support for DRM encrypted content to Apple devices. For Radiant Media Player, this is macOS Safari 11+, Safari for iOS 10+ and iPadOS 13+ and iOS 13+ and iPadOS 13+ WebView. More information about FPS support in Radiant Media Player can be found here.

<script src="https://cdn.radiantmediatechs.com/rmp/9.15.4/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  const src = {
    fps: 'https://fps-hls-url.m3u8'
  };
  // BuyDRM FPS configuration - replace certificatePath, processSpcPath, licenseRequestHeaders with your values
  const fpsDrm = {
    certificatePath: 'https://fp-keyos.licensekeyserver.com/cert/xxxxxxxxxxxxxxxxxxxxxxx.der',
    processSpcPath: 'https://fp-keyos.licensekeyserver.com/getkey',
    licenseRequestHeaders: [{
      name: 'customdata',
      value: 'license xxxxxxxxxxxxxxxxxxxxxx'
    }],
    extractContentId: function (initData) {
      const arrayToString = function (array) {
        const uint16array = new Uint16Array(array.buffer);
        return String.fromCharCode.apply(null, uint16array);
      };
      const contentId = arrayToString(initData);
      const idx = contentId.indexOf('skd://');
      if (idx > -1) {
        return contentId.substring(8, 40);
      }
      throw "Invalid Content ID format. The format of the Content ID must be the following: skd://xxx where xxx is the Key ID in hex format.";
    }
  };
  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: fpsDrm
  };
  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/9.15.4/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  // DASH streaming URL
  const src = {
    dash: 'https://your-dash-url.mpd',
    fps: 'https://fps-hls-url.m3u8'
  };
  // BuyDRM license server for PlayReady
  const playReadyLaURL = 'https://buydrm-license-server-url-playready';
  // BuyDRM license server for Widevine
  const widevineLaURL = 'https://buydrm-license-server-url-widevine';
  // BuyDRM FPS configuration - replace certificatePath, processSpcPath, licenseRequestHeaders with your values
  const fpsDrm = {
    certificatePath: 'https://fp-keyos.licensekeyserver.com/cert/xxxxxxxxxxxxxxxxxxxxxxx.der',
    processSpcPath: 'https://fp-keyos.licensekeyserver.com/getkey',
    licenseRequestHeaders: [{
      name: 'customdata',
      value: 'license xxxxxxxxxxxxxxxxxxxxxx'
    }],
    extractContentId: function (initData) {
      const arrayToString = function (array) {
        const uint16array = new Uint16Array(array.buffer);
        return String.fromCharCode.apply(null, uint16array);
      };
      const contentId = arrayToString(initData);
      const idx = contentId.indexOf('skd://');
      if (idx > -1) {
        return contentId.substring(8, 40);
      }
      throw "Invalid Content ID format. The format of the Content ID must be the following: skd://xxx where xxx is the Key ID in hex format.";
    }
  };
  const settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    },
    // here we pass our BuyDRM data
    shakaDrm: {
      servers: {
        "com.widevine.alpha": widevineLaURL,
        "com.microsoft.playready": playReadyLaURL
      }
    }, 
    shakaRequestConfiguration: {
      license: {
        headers: {
          'customdata': 'BASE64_ENCODED_CUSTOM_DATA' 
        }
      }
    },
    // we pass here our FPS setting through fpsDrm object
    fpsDrm: fpsDrm
  };
  const rmp = new RadiantMP('rmp');
  rmp.init(settings);
</script>
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.

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