What DRM does
Without DRM, any viewer who obtains a stream URL can play it. DRM solves this by encrypting the media before it leaves your server and requiring each viewer’s device to obtain a license key before decryption is allowed. The device contacts a license server, proves the viewer is authorized, and — only then — receives the key to decrypt playback.Premium content protection
Prevent unauthorized redistribution of pay-per-view events, premium courses, or licensed broadcasts.
Subscription-gated streams
Restrict live stream access to authenticated subscribers and revoke access immediately when a subscription lapses.
Live event monetization
Charge per-event access with confidence that viewers cannot share or re-stream your content without authorization.
DRM systems supported via castLabs
Red5 Pro’s DRM integration uses castLabs DRMtoday, which provides a single multi-DRM backend covering all major DRM systems:| DRM system | Primary use case |
|---|---|
| Widevine | Chrome, Firefox, Android, Chromecast |
| PlayReady | Edge, Internet Explorer, Windows, Xbox |
| FairPlay | Safari on macOS and iOS, Apple TV |
How DRM works with Red5 Pro
DRM protection is applied at the WebRTC stream level using the Insertable Streams API, which allows media frames to be transformed in the browser before encoding or after decoding.Publisher encrypts the outgoing stream
On the publisher side, the Red5 Pro WebRTC SDK applies a castLabs
encrypt-worker transform to each video and audio frame before it is sent. The transform uses merchant keys provided by your DRMtoday account to encrypt the content.Encrypted stream travels through Red5 Pro
The encrypted frames pass through your Red5 Pro Origin and Edge nodes like any other WebRTC stream. The server does not need to decrypt or re-encrypt the content — encryption is end-to-end at the frame level.
Subscriber obtains a DRM license
When an authorized viewer connects, the Red5 Pro WebRTC SDK uses the castLabs
rtc-drm-transform library to request a license from the DRMtoday license server. The license server validates the viewer’s credentials and returns the decryption key.Prerequisites
Before you can use DRM with Red5 Pro, you need:- A castLabs DRMtoday account. You must have an environment and merchant account configured in DRMtoday. Contact castLabs to set this up.
- A licensed Red5 Pro deployment. DRM is available to Red5 Pro licensed customers.
- A browser that supports Insertable Streams. Chromium-based browsers (Chrome, Edge) have the most complete support. Check the MDN compatibility table before targeting other browsers.
- The castLabs SDK files. You will need
encrypt-worker.jsfor the publisher andrtc-drm-transform.min.jsfor the subscriber.
Configuration overview
Both the publisher and subscriber integrations require a set of DRMtoday-specific values. Your castLabs merchant account provides these.| Parameter | Description |
|---|---|
environment | The DRMtoday environment where your encrypted stream resides (e.g., staging or production). |
merchant | Your merchant account identifier within DRMtoday. |
encryption / encryption mode | The AES encryption mode used on the stream (e.g., cbcs for CBCS/FairPlay-compatible). |
keyId | The key identifier used in encryption and decryption. Provided by the merchant in base64 format. |
iv | The initialization vector for the encryption cipher. Provided by the merchant in base64 format. |
Code reference
Publishing an encrypted stream
The publisher uses the castLabsencrypt-worker.js alongside the Red5 Pro WebRTC SDK. The worker is applied as a transform during stream initialization.
publisher.js
Subscribing to an encrypted stream
The subscriber imports the castLabsrtc-drm-transform library and provides the transform functions to a WHEPClient. After the subscribe session starts, you call setDrm to pass the DRM configuration and video element to the library.
subscriber.js
Getting the full DRM integration guide
The complete DRM integration guide — including castLabs library setup, DRMtoday account configuration, and advanced encryption scenarios — is available to licensed Red5 Pro customers through the Red5 Pro support portal.Access the full DRM integration documentation and request implementation support at the Red5 Pro Support Portal. You will need to log in with your licensed customer account.
