---
title: "Ant Media Server DRM Plugin Integration Guide"
description: "This document describes how to integrate DoveRunner Multi-DRM service in content packaging workflow using Ant Media Server's DRM plugin."
---
> For the complete documentation index, see [llms.txt](/llms.txt).

![](/img/content-security/ant-media-server-logo.png)

**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

*   **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

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

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

### 2. Install Shaka Packager

The plugin relies on Shaka Packager for encryption operations.

1.  Download the Shaka Packager binary.
    ```bash
    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.
    ```bash
    sudo cp shakapackager /usr/local/bin/
    sudo chmod +x /usr/local/bin/shakapackager
    ```

## 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

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}`

### 2. Configure Ant Media Server

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:

```json
"customSettings": {
  "plugin.drm-plugin": {
    "enabledDRMSystems": [
      "Widevine",
      "PlayReady",
      "FairPlay"
    ],
    "keyManagementServerURL": "https://drm-kms.doverunner.com/v2/cpix/doverunner/getKey/{YOUR_KMS_TOKEN}",
    "encryptionScheme": "cbcs"
  }
}
```

:::note

Replace `{YOUR_KMS_TOKEN}` with the actual token copied in the previous step.

:::

#### 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`. |

6.  Click **Save** to apply the settings.

## Playback Verification

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

### 1. Publish a Stream

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:
    ```bash
    sudo ls /usr/local/antmedia/webapps/live/streams/drm/stream007/
    ```
    *You should see `master.mpd` and `master.m3u8` files in this directory.*

### 2. Generate a License Token

Visit the [DoveRunner DevConsole](https://devconsole.doverunner.com/drm-tools/license-token/#token-generator) 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

1.  Clone the sample player repository provided by DoveRunner.
    ```bash
    git clone https://github.com/doverunner/html5-player-drm-samples
    ```
2.  Copy the player folders to your application's web directory. The sample uses relative paths, so keep the folder structure intact.
    ```bash
    cd html5-player-drm-samples
    sudo cp -r basic shared css media /usr/local/antmedia/webapps/live/
    ```

### 4. Configure and Play

1.  Edit the base helper file:
    ```bash
    sudo nano /usr/local/antmedia/webapps/live/shared/js/doverunner-base-helper.js
    ```
2.  Update the variables with your server details and the generated token:
    ```javascript
    const dashUri = "https://{YOUR_ANTMEDIA_SERVER}:5443/live/streams/drm/stream007/master.mpd";
    let widevineToken = '{PASTE_YOUR_GENERATED_TOKEN_HERE}';
    ```
3.  Save the file.
4.  Open the player page in Chrome:
    `https://{YOUR_ANTMEDIA_SERVER}:5443/live/basic/videojs/index.html`
5.  Click **Play**. If the video plays, the DRM integration is successful.

:::note

To confirm DRM is active, try taking a screenshot of the video player. If the video area appears black/blank in the screenshot, the content is securely protected by DRM.

:::

## 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](https://support.doverunner.com/)