Test

Your backend
Your frontend
Dailymotion
Who does what in DRM playback
You implement the purple parts. Click any step or call to see the details below.
Short-lived (5 min), signed with your private key
Checks signature, video ID, expiry and single use
Decryption key + usage rules (start window, duration)
Widevine, FairPlay or PlayReady
if valid
license
key never leaves
encrypted video
You implementYour code calls the playerDailymotion handlesBrowser (secure CDM)
Who does what in DRM playback
You implement the purple parts. Numbers show the playback order; tap a step for details.
You implementYour code calls the playerDailymotion handlesBrowser (secure CDM)
Your backend
Your frontend
Dailymotion
Who does what in DRM playback
You implement the purple parts. Numbers show the playback order; tap a step for details.
You implementYour code calls the playerDailymotion handlesBrowser (secure CDM)
Your backend2
Your frontend7
Dailymotion3
Select a step
Click any pill or code call to see what happens and what you need to write.
YOU IMPLEMENT
Check entitlement
Your backend decides, with your own business rules, whether this user may watch this specific video.
Only entitled users get a token: this is the gate that protects your content.
YOU IMPLEMENT
Sign a JWT
Build the payload and sign a short-lived token (5 min) with your RSA private key.
Dailymotion verifies it with the public key you registered once during setup.
const jwt = require('jsonwebtoken');
const { v4: uuidv4 } = require('uuid');
function generateDRMToken(videoId, privateKey) {
const iat = Math.floor(Date.now() / 1000);
const exp = iat + 300; // 5-minute expiration window
const jti = uuidv4();
const payload = {
videoId: videoId,
iat: iat,
exp: exp,
jti: jti
};
return jwt.sign(payload, privateKey, { algorithm: 'RS256' });
}
YOUR CODE
Fetch the token
Your frontend calls your own backend endpoint to get the signed JWT for the video about to play.
const response = await fetch('/api/get-drm-token?videoId=YOUR_VIDEO_KID'
if (!response.ok) throw new Error(`Token request failed: ${response.status}`)
const { token } = await response.json();
YOUR FRONTEND
User presses play
The flow starts on every protected playback. Create the player instance in its container first, before any DRM configuration.
const player = await dailymotion
  .createPlayer('player-wrapper');
YOUR CODE
setDrmConfig({ token })
Mandatory. Pass the JWT to the player before loading any content.
Skipping it, or calling it too late, makes the license request fail.
player.setDrmConfig({ token });
DAILYMOTION HANDLES
Dailymotion Player
Picks the DRM system for the browser or device (Widevine, FairPlay or PlayReady), requests the license and decrypts the stream. No configuration needed on your side.
YOUR CODE
loadContent(videoKid)
Load the protected video. The player then sends the license request with your JWT automatically.
player.loadContent({ video: YOUR_VIDEO_KID });
DAILYMOTION HANDLES
Validate the JWT
Dailymotion verifies the cryptographic signature, checks the video ID, and confirms the token has not expired or been used before.
DAILYMOTION HANDLES
Issue the license
The license contains the decryption key and the usage rules defined in your DRM protection settings.
DAILYMOTION HANDLES
Encrypted stream
The video stream is encrypted with Widevine, FairPlay or PlayReady. Without the matching decryption key it is unreadable.
BROWSER
Secure CDM
The browser's Content Decryption Module receives the license. The key stays inside this secure environment and never becomes accessible to external code.
BROWSER
Decrypt & render
The CDM decrypts the stream with the key and the player renders the video.

Did this page help you?