Explains how to integrate Axinom DRM into Akamai Adaptive Media Player. Shows how AMP is integrated into Axinom Video Test Bench and DRM Video Playback Tool.

Akamai Media Player

The Akamai Adaptive Media Player provides seamless integration and versatile customization options. In addition to common standard player features, it offers a unified viewing experience across various devices, pre-integrated analytics, and straightforward monetization capabilities.

It is supported for web (desktop and mobile), mobile (iOS and Android), and TV (tvOS, AndroidTV, FireTV, Chromecast). Axinom DRM can be used with the Akamai Player on all the mentioned platforms, but this documentation focuses on the HTML5 web scenario.

Code sample

Please refer to Akamai’s own Player documentation for instructions on initializing a player with a configuration JSON and configuring various DRM options.

In the Axinom DRM scenario, the configuration file required for player initialization is as follows:

{
  "media": {
    "source": [
      {
        "src": "https://DASH-URL-HERE.mpd",
        "type": "application/dash+xml"
      },
      {
        "src": "https://HLS-URL-HERE.m3u8",
        "type": "application/x-mpegURL"
      }
    ],
    "keys": {
      "com.widevine.alpha": {
        "serverURL": "https://drm-widevine-licensing.axprod.net/AcquireLicense",
        "httpRequestHeaders": {
          "X-AxDRM-Message": "AXINOM-LICENSE-TOKEN-JWT-HERE"
        }
      },
      "com.microsoft.playready": {
        "serverURL": "https://drm-playready-licensing.axprod.net/AcquireLicense",
        "httpRequestHeaders": {
          "X-AxDRM-Message": "AXINOM-LICENSE-TOKEN-JWT-HERE"
        }
      },
      "com.apple.fps.1_0": {
        "serverURL": "https://drm-fairplay-licensing.axprod.net/AcquireLicense",
        "cert": "https://CERTIFICATE-URL-HERE.cer",
        "httpRequestHeaders": {
          "X-AxDRM-Message": "AXINOM-LICENSE-TOKEN-JWT-HERE",
          "Content-Type": "application/octet-stream"
        }
      }
    }
  }
}

The configuration should be properly filled with valid playback URLs and license token JWTs. It can also contain a single source, for example, just DASH (with Widevine/PlayReady) or just HLS (with Apple FPS/certificate). Simply omit one set of source/keys-nodes in that case.

To initialize the player, reference an existing <div> element using a CSS query and pass the configuration above to the create function within the Akamais AMP global namespace:

const config = JSON.parse(the_above_json_as_string);
// <- insert here the below FariPlay logic if needed ->
akamai.amp.AMP.create("akamai-player-placeholder", config);

FairPlay specifics

The above configuration is sufficient for the DASH scenario to function. However, for proper functionality of the FairPlay scenario with Axinom DRM on Akamai Player, the configuration prior to being fed into player initialization should be expanded with the fps node. This node overrides extractContentId and requestLicense with the following custom logic:

config['fps'] = {
	extractContentId: function (initData, keyData) {
		var uint16array = new Uint16Array(initData.buffer);
		return String.fromCharCode.apply(null, uint16array).replace(/^.*:\/\//, '');
	},
	requestLicense: function (message, contentId, serverUrl, keys) {
		var request = {
			url: serverUrl,
			method: "POST",
			responseType: "arraybuffer",
			headers: keys["httpRequestHeaders"],
			data: new Uint8Array(message)
		};

		return akamai.amp.Utils.request(request).then(function (xhr) {
			return new Uint8Array(xhr.response); })
		.catch(function (error)
			{ throw "The license request failed"; });
	}
}

DRM Video Playback Tool in Portal

You can try out the Akamai Adaptive Media Player with Axinom DRM using the DRM Video Playback Tool. This tool allows you to play a DRM-protected video as well as generate and adjust the Entitlement Message. After providing your video information or picking one of our sample from the list, you receive a functional Akamai configuration JSON and are directed to our HTML5 Video Test Bench with integrated Akamai Adaptive Media Player.