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.
Prerequisites
Section titled “Prerequisites”- 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.
Installation
Section titled “Installation”To enable DRM capabilities, you must install the specific DRM plugin and the Shaka Packager binary on your Ant Media Server instance.
1. Install the DRM Plugin
Section titled “1. Install the DRM Plugin”- Download the
DRM-Plugin-bundle.jarfile. - Copy the JAR file to the Ant Media
pluginsdirectory.Terminal window sudo cp DRM-Plugin-bundle.jar /usr/local/antmedia/plugins - Restart the Ant Media Server to apply changes.
Terminal window sudo service antmedia restart
2. Install Shaka Packager
Section titled “2. Install Shaka Packager”The plugin relies on Shaka Packager for encryption operations.
- 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 - 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
Configuration
Section titled “Configuration”DRM settings are applied at the application level (e.g., Live or WebRTCAppEE) using the Custom Settings feature in the web panel.
1. Obtain KMS URL
Section titled “1. Obtain KMS URL”First, construct your Key Management Server (KMS) URL using your DoveRunner credentials.
- Log in to the DoveRunner Console.
- Navigate to Multi-DRM > DRM Settings.
- Copy your KMS Token.
- Construct the URL as follows:
https://drm-kms.doverunner.com/v2/cpix/doverunner/getKey/{YOUR_KMS_TOKEN}
2. Configure Ant Media Server
Section titled “2. Configure Ant Media Server”- Open the Ant Media Server Web Panel.
- Select your application from the left sidebar (e.g.,
Live). - Navigate to Settings -> Advanced.
- Locate the
customSettingskey/value store. - Add or modify the
plugin.drm-pluginconfiguration 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" }}Configuration Parameters
Section titled “Configuration Parameters”| Field | Description |
|---|---|
| keyManagementServerURL | (Required) The CPIX API URL for obtaining encryption keys. |
| enabledDRMSystems | (Required) Array of supported DRMs: ["Widevine", "FairPlay", "PlayReady"]. |
| encryptionScheme | Encryption mode. "cbcs" (Default, supports all DRMs) or "cenc" (Does not support FairPlay). |
| hlsPlayListType | HLS Playlist type: "LIVE" (Default), "VOD", or "EVENT". |
| segmentDurationSecs | Duration of segments in seconds. Default is 2. |
| timeShiftBufferDepthSecs | Buffer depth for live streams. Default is 60. |
- Click Save to apply the settings.
Playback Verification
Section titled “Playback Verification”To verify the integration, publish a stream and test playback using a DRM-enabled player.
1. Publish a Stream
Section titled “1. Publish a Stream”- Publish a WebRTC stream (e.g., using the sample publish page).
- Set the Stream ID to
stream007(or your preferred ID). - Verify that the stream is being encrypted by checking the directory on the server:
You should see
Terminal window sudo ls /usr/local/antmedia/webapps/live/streams/drm/stream007/master.mpdandmaster.m3u8files in this directory.
2. Generate a License Token
Section titled “2. Generate a License Token”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.
3. Setup Test Player
Section titled “3. Setup Test Player”- Clone the sample player repository provided by DoveRunner.
Terminal window git clone https://github.com/doverunner/html5-player-drm-samples - Copy the player files to your application’s web directory.
Terminal window cd html5-player-drm-samplessudo 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/
4. Configure and Play
Section titled “4. Configure and Play”- Edit the helper file:
Terminal window sudo nano /usr/local/antmedia/webapps/live/js/doverunner-sample-helper.js - 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}';
- Save the file.
- Open the player page in Chrome:
https://{YOUR_ANTMEDIA_SERVER}:5443/live/videojs-doverunner-sample.html - Click Play. If the video plays, the DRM integration is successful.
Contact Information
Section titled “Contact Information”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