Add visible watermarks to protected playback
Send watermark settings from your trusted backend, render three visible styles with a compatible player, and verify the session lifecycle.
Integration tutorial
Add a viewer-specific visible watermark to a protected streaming session. Choose a random position, a moving diagonal layer, a full-screen grid, or a combination.
View the request exampleHow a visible watermark reaches the player
The authenticated backend selects the text and layers for the session.
- Cấp quyền
Check that the viewer may watch the requested content.
- Request
Send the watermark and compatible player capability with the playback-session request.
- Render
Load the authorized session in a player that can render the required layers.
1. Choose the watermark layers#
| Layer type | What the viewer sees | Settings to start with |
|---|---|---|
random-static | Upright text that stays still, then changes position. | intervalSeconds: 8 |
diagonal | Text moving diagonally across the video. | speed: "slow" |
full-screen | A repeating text grid over the video. | rows: 3, columns: 3 |
Each type may appear once in a session. Set opacity per layer and use a short, fictional viewer identifier when testing. The watermark is rendered by the player over the picture during streaming.
2. Add the watermark to your backend request#
Authenticate the viewer and check access to the selected Content ID in your backend. Derive the watermark text there. Forward watermarkVersion: 1 only when the selected player implements it.
Merge these fields into your existing authorized playback-session request to POST /api/v1/playback/environments/{environmentId}/sessions. Keep the existing DRM, subject, policy and session fields, plus any other supported capabilities.
{
"platformCapabilities": {
"clientPlatform": "web",
"watermarkVersion": 1
},
"watermark": {
"version": 1,
"text": "Demo viewer A104",
"layers": [
{ "type": "random-static", "opacity": 0.38, "intervalSeconds": 8 },
{ "type": "diagonal", "opacity": 0.30, "speed": "slow" },
{ "type": "full-screen", "opacity": 0.16, "rows": 3, "columns": 3 }
]
}
}
The text supports up to 512 UTF-8 bytes over at most three lines. Use plain text and one to three distinct layers. Omit watermark for an ordinary streaming session.
3. Try it with the PHP example#
Start with the SDK watermark evaluation. In your own copy of the PHP sample, set the watermark resolver in config/drmx.php. The sample resolves it after viewer and content authorization.
'watermark' => static function (string $viewerId, string $contentId): array {
return [
'text' => 'Demo viewer A104',
'layers' => [
['type' => 'random-static', 'opacity' => 0.38],
['type' => 'diagonal', 'speed' => 'slow'],
['type' => 'full-screen', 'opacity' => 0.16],
],
];
},
For production, resolve a short pseudonymous label from your own authorized viewer record. Keep credentials on the backend and keep viewer text out of URLs, logs, analytics and shared caches. Return the authorized player response with Cache-Control: no-store.
4. Render and verify on a compatible player#
Pass the normalized session response, including watermark, to the compatible Universal Player. On the web, use the supported <drmx-universal-player> component so the player owns the fullscreen overlay. Stop playback and release the reservation if the client cannot render a required layer.
| Integration | Availability |
|---|---|
| PHP Web demo | The evaluation uses a compatible Web SDK preview. Start here to test the three layers. |
| Public SDK and CMS packages | Verify watermark v1 support in the exact package you deploy. Existing download aliases and LMS plugins may use earlier players. |
| Native and TV | Source previews have platform-specific renderers. Verify the exact SDK and device before requiring the watermark in production. |
Test each layer separately and in combination. Pause, seek, resize and enter fullscreen, then stop and confirm the session releases. Check that older clients cannot start a session that requires a watermark they cannot render.
This tutorial covers visible overlays in streaming playback. Offline playback and video-only external playback require separate qualification.
DRM-X 6.0