Documentation

Apple FairPlay Streaming

Apple FairPlay Streaming scope of support

Information on Apple FairPlay Streaming can be found here.

Supported environments for Apple FairPlay HLS Streaming with Radiant Media Player:

  • Safari 11+ on macOS
  • Safari for iOS 10+
  • Safari for iPadOS 13+
  • WebView on iOS 13+ and iPadOS 13+

Our implementation is based on the reference sample provided by Apple with the FairPlay Streaming Server SDK v3. We have extended this implementation through advanced player settings to provide support for virtually any standard-compliant DRM service providers. If you need additional tuning for your Apple FairPlay Streaming setup please contact technical support.

FairPlay Streaming is not available for audio-only streams through the HTML5 audio element.

Player settings

Apple reference example

In its simple form we just comply with the Apple reference sample. For such a use case you just need to pass to the player your HLS URL, your server certificate URL and server processSPC URL.

<!-- Include Radiant Media Player JavaScript file in your <body> or <head> -->
<script src="https://cdn.radiantmediatechs.com/rmp/9.15.19/js/rmp.min.js"></script>
<!-- Player container element -->
<div id="rmp"></div>
<!-- Set up player configuration options -->
<script>
const src = { 
  fps: 'https://your-url-to-fps-hls.m3u8' 
};
const settings = {
  licenseKey: 'your-license-key',
  src: src,
  width: 640,
  height: 360,
  contentMetadata: {
    poster: [
      'https://your-poster-url.jpg'
    ]
  },
  // passing FPS DRM settings
  fpsDrm: {
    certificatePath: 'https://your-url-to-server-certificate.cer',
    processSpcPath: 'https://your-url-to-server-processSPC'
  }
};
const rmp = new RadiantMP('rmp');
rmp.init(settings);
</script>

Configuration options

fpsDrm: Object

This setting holds the required information to be passed to the player for proper retrieval of FPS licenses.

fpsDrm.certificatePath: String

The server path/URL to your FPS certificate. This is a required setting.

fpsDrm.processSpcPath: String

This is the path/URL to the keyserver module that processes the SPC and returns a CKC. This is a required setting.

fpsDrm.licenseResponseType: String

Specifies the responseType for the XMLHttpRequest when requesting the FPS license to the server. The default value is 'text' (as provided by the Apple reference sample). Other possible values are 'arraybuffer', 'json', and 'blob'.

fpsDrm.licenseRequestHeaders: Array

This setting specifies an Array of Object to set the request headers for the XMLHttpRequest when requesting the FPS license from the server. Each item of the array should be an object containing a name property and a value property both set as String. Default [] (as provided by the Apple reference sample).

fpsDrm.certificateRequestHeaders: Array

This setting specifies an Array of Object to set the request headers for the XMLHttpRequest when requesting the FPS certificate from the server. Each item of the array should be an object containing a name property and a value property both set as String. Default (as provided by the Apple reference sample):

[{
  name: 'Pragma',
  value: 'Cache-Control: no-cache'
}, {
  name: 'Cache-Control',
  value: 'max-age=0'
}];

fpsDrm.extractContentId: Function

This function specifies how to extract the content id which is part of the session data used to initialize the keySession. Default (as provided by the Apple reference sample):

function (initData) {
  const arrayToString = function (array) {
    const uint16array = new Uint16Array(array.buffer);
    return String.fromCharCode.apply(null, uint16array);
  };
  const contentId = arrayToString(initData);
  const link = document.createElement('a');
  link.href = contentId;
  return link.hostname;
};

fpsDrm.licenseRequestMessage: Function

This function specifies how the received license key message is treated by the player and return the message to be sent to the license server. Default (as provided by the Apple reference sample):

function (message, session) {
  return 'spc=' + base64EncodeUint8Array(message) + '&assetId=' + encodeURIComponent(session.contentId);
};

the base64EncodeUint8Array function is provided internally by the player for the default value so you do not need to provide it.

fpsDrm.licenseRequestLoaded: Function

This function specifies the callback function when the license is succesffuly loaded from the server. Default (as provided by the Apple reference sample):

function (event) {
  const request = event.target;
  const session = request.session;
  const keyText = request.responseText.trim();
  if (keyText.substr(0, 5) === '<ckc>' && keyText.substr(-6) === '</ckc>') {
    keyText = keyText.slice(5, -6);
  }
  const key = base64DecodeUint8Array(keyText);
  session.update(key);
};

fpsDrm.keySystem: String

Sets the key system that will be used for the FairPlay streaming session. Default: 'com.apple.fps.1_0'. Other possible values include: 'com.apple.fps.3_0', 'com.apple.fps.2_0' or 'com.apple.fps'. Unless asked by your DRM service provider or by Radiant Media Player team to change that setting you should use the default.

EZDRM example

Refer to our working with EZDRM guide.

PallyCon example

Refer to our working with PallyCon guide.

BuyDRM example

Refer to our working with BuyDRM guide.

DRMtoday by castLabs example

Refer to our working with DRMtoday by castLabs guide.

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.