@@ -5,13 +5,15 @@ keywords: [DRM, DRM Plugin, DRM Plugin for Ant Media Server, Ant Media Server Do
55sidebar_position : 1
66---
77
8+ # DRM Plugin for Ant Media Server
9+
810The Digital Rights Management (DRM) Plugin for Ant Media Server enables secure streaming by integrating with the CPIX (Content Protection Information Exchange) API. It ensures that only authorized users can access your content through encryption and multi-DRM support (** Widevine, FairPlay, and PlayReady** ).
911
1012## Key Features
1113
12- - Seamless ** integration** with ** CPIX API** for content key management.
13- - Support for ** Dash** and ** HLS** output.
14- - ** Multi-DRM support** : Widevine, FairPlay, PlayReady.
14+ - Seamless integration with CPIX API for content key management.
15+ - Support for Dash and HLS output.
16+ - Multi-DRM support: Widevine, FairPlay, PlayReady.
1517
1618## Installation
1719
@@ -20,32 +22,32 @@ Ensure the Ant Media Server is already running on your machine or instance.
2022
2123### Step 1: Purchase and Install the DRM Plugin
2224
23- 1 . ** Purchase the Plugin**
24- - [ Get the DRM Plugin] ( https://antmedia.io/product/drm-plugin/ ) on a monthly subscription basis.
25- - Or write an email to contact@antmedia.io
25+ 1 . ** Purchase the Plugin**
26+ - [ Get the DRM Plugin] ( https://antmedia.io/product/drm-plugin/ ) on a monthly subscription basis.
27+ - Alternatively, send an email to contact@antmedia.io .
2628
27- 2 . ** Install the DRM Plugin**
28- - Download and copy the plugin JAR file to your Ant Media's plugin directory.
29+ 2 . ** Install the DRM Plugin**
30+ - Download and copy the plugin JAR file to your Ant Media ` plugins ` directory.
2931
30- ``` bash
31- sudo cp DRM-Plugin-bundle.jar /usr/local/antmedia/plugins
32- ```
32+ ``` bash
33+ sudo cp DRM-Plugin-bundle.jar /usr/local/antmedia/plugins
34+ ```
3335
34- - Restart the Ant Media Server to apply changes.
36+ - Restart the Ant Media Server to apply changes:
3537
36- ``` bash
37- sudo service antmedia restart
38- ```
38+ ``` bash
39+ sudo service antmedia restart
40+ ```
3941
4042### Step 2: Install Shaka Packager
4143
42- 1 . ** Download the Shaka Packager binary. **
44+ 1 . Download the Shaka Packager binary:
4345
4446 ``` bash
4547 wget https://github.com/shaka-project/shaka-packager/releases/download/v3.4.1/packager-linux-x64 -O shakapackager
4648 ```
4749
48- 2 . ** Move to the bin and make it executable. **
50+ 2 . Move it to the bin and make it executable:
4951
5052 ``` bash
5153 sudo cp shakapackager /usr/local/bin/
@@ -54,174 +56,157 @@ Ensure the Ant Media Server is already running on your machine or instance.
5456
5557## Configuration
5658
57- The DRM plugin settings are added under the ` customSettings ` in the application settings under Ant Media Server.
59+ DRM plugin settings are added under the ` customSettings ` in the application settings in Ant Media Server.
5860
5961### Step 1: Navigate to Custom Settings
6062
61- - Open the Ant Media Server web panel.
62- - Click your application on the left sidebar (e.g., ` live ` ).
63- - Click the ** Settings** tab and select ** Advanced** from the dropdown on the top-right .
64- - Find the ` customSettings ` property.
63+ 1 . Open the Ant Media Server web panel.
64+ 2 . Click your application on the left sidebar (e.g., ` live ` ).
65+ 3 . Go to the ** Settings** tab and select ** Advanced** .
66+ 4 . Locate the ` customSettings ` property.
6567
6668### Step 2: Add DRM Settings
6769
68- - Here's a minimal required configuration:
70+ Minimal required configuration:
6971
70- ``` json
71- "customSettings" : {
72- "plugin.drm-plugin" : {
73- "enabledDRMSystems" : [
74- " Widevine"
75- ],
76- "keyManagementServerURL" : " {KMS_URL}"
77- }
78- },
79- ```
80-
81-
82- - You can pass multiple DRM systems as well.
83-
84-
85- ``` json
72+ ``` json
73+ "customSettings" : {
74+ "plugin.drm-plugin" : {
8675 "enabledDRMSystems" : [
87- " Widevine" , " PlayReady "
76+ " Widevine"
8877 ],
89- ```
90-
91- ### Available Configuration Fields
92- - ** ` keyManagementServerURL ` ** * (Required)* :
93- URL to obtain encryption keys from your DRM provider using the CPIX API.
94-
95- - ** ` enabledDRMSystems ` ** * (Required)* :
96- JSON array of DRM systems: [ "` Widevine ` ", "` FairPlay ` ", "` PlayReady ` "] .
97-
98- - ** ` encryptionScheme ` ** :
99- "` cbcs ` " * (default)* or "` cenc ` ". ` cbcs ` supports all systems; ` cenc ` doesn’t support FairPlay.
78+ "keyManagementServerURL" : " {KMS_URL}"
79+ }
80+ }
81+ ```
10082
101- - ** ` hlsPlayListType ` ** :
102- "` LIVE ` " * (default)* , "` VOD ` ", or "` EVENT ` ".
83+ Multiple DRM systems can also be passed:
10384
104- - ** ` segmentDurationSecs ` ** :
105- Segment duration in seconds. The default is ` 2 ` .
85+ ``` json
86+ "enabledDRMSystems" : [
87+ " Widevine" ," PlayReady"
88+ ]
89+ ```
10690
107- - ** ` timeShiftBufferDepthSecs ` ** :
108- Buffer duration for live streams. The default is ` 60 ` seconds.
91+ ### Available Configuration Fields
10992
110- - ** ` segmentsOutsideLiveWindow ` ** :
111- Keeps extra segments outside the buffer window. The default is ` 5 ` .
93+ - ** ` keyManagementServerURL ` ** (Required): URL to obtain encryption keys from your DRM provider using the CPIX API.
94+ - ** ` enabledDRMSystems ` ** (Required): JSON array of DRM systems: [ "Widevine", "FairPlay", "PlayReady"] .
95+ - ** ` encryptionScheme ` ** : "cbcs" (default) or "cenc". ` cbcs ` supports all systems; ` cenc ` doesn’t support FairPlay.
96+ - ** ` hlsPlayListType ` ** : "LIVE" (default), "VOD", or "EVENT".
97+ - ** ` segmentDurationSecs ` ** : Segment duration in seconds. Default is 2.
98+ - ** ` timeShiftBufferDepthSecs ` ** : Buffer duration for live streams. Default is 60.
99+ - ** ` segmentsOutsideLiveWindow ` ** : Extra segments outside the buffer window. Default is 5.
112100
113101## DoveRunner Multi-DRM Integration (Widevine Example)
114102
115- This section walks you through securing a live stream with Widevine using DoveRunner.
116-
117103### Step 1: Get a KMS Token from DoveRunner
118104
119- - Log in to your [ DoveRunner Web Panel] ( https://doverunner.com/ ) .
120- - Navigate to Multi-DRM > DRM Settings.
121- - Copy your KMS Token.
122-
123- Your final ` keyManagementServerURL ` will be:
105+ 1 . Log in to your [ DoveRunner Web Panel] ( https://doverunner.com/ ) .
106+ 2 . Navigate to Multi-DRM > DRM Settings.
107+ 3 . Copy your KMS Token.
108+ 4 . Construct the ` keyManagementServerURL ` :
124109
125- ``` bash
126- https://kms.pallycon.com/v2/cpix/pallycon/getKey/{REPLACE_WITH_YOUR_KMS_TOKEN}
110+ ``` bash
111+ https://kms.pallycon.com/v2/cpix/pallycon/getKey/{REPLACE_WITH_YOUR_KMS_TOKEN}
127112 ```
128113
129- - Update your ` customSettings ` in the Ant Media Server web panel:
114+ 5 . Update your ` customSettings ` in the Ant Media Server web panel:
130115
131- ``` json
132- "plugin.drm-plugin" : {
133- "enabledDRMSystems" : [
134- " Widevine"
135- ],
136- "keyManagementServerURL" : " https://kms.pallycon.com/v2/cpix/pallycon/getKey/{REPLACE_WITH_YOUR_KMS_TOKEN}"
137- }
138- ```
116+ ``` json
117+ "plugin.drm-plugin" : {
118+ "enabledDRMSystems" : [
119+ " Widevine"
120+ ],
121+ "keyManagementServerURL" : " https://kms.pallycon.com/v2/cpix/pallycon/getKey/{REPLACE_WITH_YOUR_KMS_TOKEN}"
122+ }
123+ ```
139124
140- - Save the settings.
125+ 6 . Save the settings.
141126
142127### Step 2: Add Video.js Player for Playback
143128
144- - Clone DoveRunner's sample HTML5 player:
129+ Clone DoveRunner's sample HTML5 player:
145130
146- ``` bash
147- git clone https://github.com/doverunner/html5-player-drm-samples
148- ```
131+ ``` bash
132+ git clone https://github.com/doverunner/html5-player-drm-samples
133+ ```
149134
150- - Copy the files to your ` live ` app’s web directory:
135+ Copy the files to your ` live ` app’s web directory:
151136
152- ``` bash
153- cd html5-player-drm-samples
154- sudo cp videojs-doverunner-sample.html /usr/local/antmedia/webapps/live/
155- sudo cp js/videojs-sample.js /usr/local/antmedia/webapps/live/js/
156- sudo cp js/doverunner-sample-helper.js /usr/local/antmedia/webapps/live/js/
157- sudo cp css/* /usr/local/antmedia/webapps/live/css/
158- ```
137+ ``` bash
138+ cd html5-player-drm-samples
139+ sudo cp videojs-doverunner-sample.html /usr/local/antmedia/webapps/live/
140+ sudo cp js/videojs-sample.js /usr/local/antmedia/webapps/live/js/
141+ sudo cp js/doverunner-sample-helper.js /usr/local/antmedia/webapps/live/js/
142+ sudo cp css/* /usr/local/antmedia/webapps/live/css/
143+ ```
159144
160145### Step 3: Publish a WebRTC Stream
161146
162- - Publish a WebRTC stream from Chrome using your Ant Media Server Sample publish page.
163- - Check the [ WebRTC Publish Section] ( https://antmedia.io/docs/guides/publish-live-stream/webrtc/ )
164-
165- ::: info
166- Pay attention that we use ` stream007 ` as the ` streamid ` . It will be used to get a license from DoveRunner. You can use any ` streamId ` .
167- :::
168-
169- - Verify stream directory creation:
147+ 1 . Publish a WebRTC stream from Chrome using your Ant Media Server sample publish page. See the [ WebRTC Publish guide] ( https://antmedia.io/docs/guides/publish-live-stream/webrtc/ ) .
148+ 2 . Use ` stream007 ` as the ` streamId ` in this example. Verify that the stream directory has been created:
170149
171150 ``` bash
172151 sudo ls /usr/local/antmedia/webapps/live/streams/drm/stream007/
173152 ```
174153
175- - If you see ` master.mpd ` and ` master.m3u8 ` , Voila, your stream is DRM-protected!
154+ You should see ` master.mpd ` and ` master.m3u8 ` , confirming the stream is DRM-protected.
176155
177- - The HTTP endpoint templates will be like
156+ 3 . Example playback URLs:
178157
179- ``` bash
180- DASH: https://{YOUR_ANTMEDIA_SERVER}:5443/live/streams/drm/stream123/master.mpd
181- HLS: https://{YOUR_ANTMEDIA_SERVER}:5443/live/streams/drm/stream123/master.m3u8
182- ```
158+ ``` bash
159+ DASH: https://{YOUR_ANTMEDIA_SERVER}:5443/live/streams/drm/stream123/master.mpd
160+ HLS: https://{YOUR_ANTMEDIA_SERVER}:5443/live/streams/drm/stream123/master.m3u8
161+ ```
183162
184163### Step 4: Generate Widevine Token
185164
186- 1 . Visit [ DoveRunner Token Generator] ( https://devconsole.doverunner.com/drm-tools/license-token/#token-generator )
165+ 1 . Visit [ DoveRunner Token Generator] ( https://devconsole.doverunner.com/drm-tools/license-token/#token-generator ) .
1871662 . Fill in the following:
188-
189- - ** SITE ID, SITE Key, ACCESS Key** → Get from [ DRM Settings on DoveRunner] ( https://contentsecurity.doverunner.com/drm/setting ) .
190- - ** DRM Type** → ` Widevine ` because we used ` Widevine ` in this sample.
191- - ** CID** → Your streamId. ` stream007 ` in this sample.
192- - ** USER ID** → any unique identifier (for example, 1234 etc).
193- - Click ** Refresh Timestamp** , and leave the other fields with default values.
194-
195- 3 . Click the ` Generate Token ` button and copy the token in ` Result ` .
196- 4 . Open the below file:
167+ - ** SITE ID, SITE Key, ACCESS Key** : From DRM Settings on DoveRunner.
168+ - ** DRM Type** : ` Widevine ` .
169+ - ** CID** : Your streamId (e.g., ` stream007 ` ).
170+ - ** USER ID** : Any unique identifier (e.g., ` 1234 ` ).
171+ - Click ** Refresh Timestamp** and keep default values for the rest.
172+ 3 . Click ** Generate Token** and copy the result.
173+ 4 . Edit the following file:
197174
198175 ``` bash
199176 sudo nano /usr/local/antmedia/webapps/live/js/doverunner-sample-helper.js
200177 ```
201-
202- - ** Replace** :
203178
204- ``` js
205- dashUri = " https://{YOUR_ANTMEDIA_SERVER}:5443/live/streams/drm/stream007/master.mpd" ;
206- widevineToken = ' {PASTE_YOUR_GENERATED_TOKEN_HERE}' ;
207- ```
179+ Replace:
180+
181+ ``` js
182+ dashUri = " https://{YOUR_ANTMEDIA_SERVER}:5443/live/streams/drm/stream007/master.mpd" ;
183+ widevineToken = ' {PASTE_YOUR_GENERATED_TOKEN_HERE}' ;
184+ ```
208185
209- - Save the changes & exit the editor .
186+ 5 . Save and exit.
210187
211188### Step 5: Play Stream in Chrome
212189
213- Open the below URL with ` Chrome` because Widevine is supported by Chrome :
190+ Open the following URL in Chrome ( Widevine is supported) :
214191
215- ` ` ` css
192+ ``` html
216193https://{YOUR_ANTMEDIA_SERVER}:5443/live/videojs-doverunner-sample.html
217194```
218195
219- - Click Play
196+ Click Play. If successful, the stream will play as DRM-protected video using Widevine with Ant Media Server.
197+
198+ To confirm DRM protection, attempt to take a screenshot. If the captured screen is blank, DRM is active.
199+
200+ ---
201+
202+ ## Congratulations!
220203
221- - If it works , you are successfully playing a DRM - protected video using Widevine with your Ant Media Server.
204+ By completing these steps , you have:
222205
223- - Try to get the screenshot of that page and it should be blank.
206+ - Installed and configured the DRM Plugin for Ant Media Server.
207+ - Integrated the plugin with DoveRunner for Widevine DRM.
208+ - Published a DRM-protected live stream.
209+ - Successfully tested playback through a DRM-enabled player.
224210
225- ! [](@site / static / img / drm - test . webp )
211+ Your streams are now protected, ensuring that only authorized users can access the content.
226212
227- If it is blank, congratulations! 🎉 Your content is protected using the DRM , and no one can capture it.
0 commit comments