Skip to content

Ant Media Server DRM Plugin Integration Guide

DoveRunner Multi-DRM integration with Ant Media Server enables secure live streaming by leveraging the CPIX (Content Protection Information Exchange) API. This integration ensures that DASH and HLS outputs are encrypted and accessible only to authorized users via Widevine, PlayReady, and FairPlay DRM systems.

This guide provides step-by-step instructions for installing the necessary plugins, configuring DoveRunner as the key management server, and verifying playback.

  • Ant Media Server installed and running on your instance.
  • Ant Media DRM Plugin (Purchased or acquired via contact@antmedia.io).
  • Active account on DoveRunner Multi-DRM service.
  • Root or sudo access to the server.

To enable DRM capabilities, you must install the specific DRM plugin and the Shaka Packager binary on your Ant Media Server instance.

  1. Download the DRM-Plugin-bundle.jar file.
  2. Copy the JAR file to the Ant Media plugins directory.
    Terminal window
    sudo cp DRM-Plugin-bundle.jar /usr/local/antmedia/plugins
  3. Restart the Ant Media Server to apply changes.
    Terminal window
    sudo service antmedia restart

The plugin relies on Shaka Packager for encryption operations.

  1. Download the Shaka Packager binary.
    Terminal window
    wget https://github.com/shaka-project/shaka-packager/releases/download/v3.4.1/packager-linux-x64 -O shakapackager
  2. Move the binary to the system path and make it executable.
    Terminal window
    sudo cp shakapackager /usr/local/bin/
    sudo chmod +x /usr/local/bin/shakapackager

DRM settings are applied at the application level (e.g., Live or WebRTCAppEE) using the Custom Settings feature in the web panel.

First, construct your Key Management Server (KMS) URL using your DoveRunner credentials.

  1. Log in to the DoveRunner Console.
  2. Navigate to Multi-DRM > DRM Settings.
  3. Copy your KMS Token.
  4. Construct the URL as follows: https://drm-kms.doverunner.com/v2/cpix/doverunner/getKey/{YOUR_KMS_TOKEN}
  1. Open the Ant Media Server Web Panel.
  2. Select your application from the left sidebar (e.g., Live).
  3. Navigate to Settings -> Advanced.
  4. Locate the customSettings key/value store.
  5. Add or modify the plugin.drm-plugin configuration object as shown below:
"customSettings": {
"plugin.drm-plugin": {
"enabledDRMSystems": [
"Widevine",
"PlayReady",
"FairPlay"
],
"keyManagementServerURL": "https://drm-kms.doverunner.com/v2/cpix/doverunner/getKey/{YOUR_KMS_TOKEN}",
"encryptionScheme": "cbcs"
}
}
FieldDescription
keyManagementServerURL(Required) The CPIX API URL for obtaining encryption keys.
enabledDRMSystems(Required) Array of supported DRMs: ["Widevine", "FairPlay", "PlayReady"].
encryptionSchemeEncryption mode. "cbcs" (Default, supports all DRMs) or "cenc" (Does not support FairPlay).
hlsPlayListTypeHLS Playlist type: "LIVE" (Default), "VOD", or "EVENT".
segmentDurationSecsDuration of segments in seconds. Default is 2.
timeShiftBufferDepthSecsBuffer depth for live streams. Default is 60.
  1. Click Save to apply the settings.

To verify the integration, publish a stream and test playback using a DRM-enabled player.

  1. Publish a WebRTC stream (e.g., using the sample publish page).
  2. Set the Stream ID to stream007 (or your preferred ID).
  3. Verify that the stream is being encrypted by checking the directory on the server:
    Terminal window
    sudo ls /usr/local/antmedia/webapps/live/streams/drm/stream007/
    You should see master.mpd and master.m3u8 files in this directory.

Visit the DoveRunner DevConsole to generate a test token with information below.

  • SITE ID, Site Key, Access Key: Retrieve from DoveRunner Console > Multi-DRM > DRM Settings.
  • DRM Type: Select Widevine (for Chrome testing).
  • CID: Enter the Stream ID used above (e.g., stream007).
  • User ID: Enter any unique user string.
  • Click Generate Token and copy the result string.
  1. Clone the sample player repository provided by DoveRunner.
    Terminal window
    git clone https://github.com/doverunner/html5-player-drm-samples
  2. Copy the player files to your application’s web directory.
    Terminal window
    cd html5-player-drm-samples
    sudo cp videojs-doverunner-sample.html /usr/local/antmedia/webapps/live/
    sudo cp js/videojs-sample.js /usr/local/antmedia/webapps/live/js/
    sudo cp js/doverunner-sample-helper.js /usr/local/antmedia/webapps/live/js/
    sudo cp css/* /usr/local/antmedia/webapps/live/css/
  1. Edit the helper file:
    Terminal window
    sudo nano /usr/local/antmedia/webapps/live/js/doverunner-sample-helper.js
  2. Update the variables with your server details and the generated token:
    dashUri = "https://{YOUR_ANTMEDIA_SERVER}:5443/live/streams/drm/stream007/master.mpd";
    widevineToken = '{PASTE_YOUR_GENERATED_TOKEN_HERE}';
  3. Save the file.
  4. Open the player page in Chrome: https://{YOUR_ANTMEDIA_SERVER}:5443/live/videojs-doverunner-sample.html
  5. Click Play. If the video plays, the DRM integration is successful.

For assistance with the plugin installation or purchase, please contact Ant Media. For issues related to keys, tokens, or playback licenses, please contact DoveRunner support.

  • Ant Media Support: contact@antmedia.io
  • DoveRunner Support: Help Center