Widevine Integration

Deploying video players with widevine licence server.

Enable DRM

DRM encryption needs to be enabled via profile settings first. Please go to video profiles section on Gumlet dashboard and either edit existing profile or create a new profile with DRM option enabled as shown in screenshot.

Enable DRM in profile section of GumletEnable DRM in profile section of Gumlet

Enable DRM in profile section of Gumlet

Once this is enabled, you can process a new video using this profile and that video will be DRM encrypted.

🚧

Heads Up!

By default, your account uses staging credentials for Widevine DRM. You can only process maximum of 5 videos with staging credentials.

Please contact [email protected] for production credentials for Widevine.

Playing DRM Content

Once a video is DRM encrypted, it can't be played only via playback URL. DRM playback also needs Licence Server URL along with playback URL to play the content. The licence server URL will inform player the place from where the licence can be acquired.

For security reasons, Licence Server URL needs authentication token to be passed so it knows the request for licence is legitimate.

Obtain Licence Server URL and Secret Key

Please go to DRM Credentials page on Gumlet dashboard to get:

Once you get them, following sample code can be used to generate auth token.

Create Auth Token

var crypto = require('crypto');

// Secret Key provided by Gumlet
var proxySecret = "abcdefghijklmn";

// Licence Server URL provided by Gumlet
var proxyUrl = "https://widevine.gumlet.com/licence/627b533efd2da43909008561"

proxySecret = Buffer.from(proxySecret, 'base64');

// expiration time in seconds
var tokenlifetime = 30;

var expiration = Math.round(Date.now() + tokenlifetime*1000);

var stringForTokenGeneration = `${proxyUrl.slice(35)}${expiration}`;

var signature = crypto.createHmac('sha1', proxySecret).update(stringForTokenGeneration).digest('hex');

console.log(`Auth Token: ${signature}`);

console.log(`Signed Licence Server URL: ${proxyUrl}?token=${signature}&expires=${expiration}`);

License Server URL with secure token should looks like this: https://widevine.gumlet.com/licence/627b533efd2da43909008561?token=9290ba08e7743655a450b9543bdca737ea973b61&expires=1652258263811

📘

Token Lifetime

You can't set token expiration time more than 30 seconds. This means for each video playback, you must generate new token from backend and send it to frontend to start playback.

This mechanism ensures only authorized users are allowed to view content and sharing video links will result in playback failure.

Use Licence Server URL with Video Players

Without configuring license proxy with your video players, players won't be able to play/decrypt encrypted videos. Following are the code snippets for configuring license proxy with various widely used video players.

Shaka Player

Add following code snippet after initializing shaka player.

shaka_player.configure({
    drm: {
        servers: {
            'com.widevine.alpha': "<LICENSE SERVER URL GOES HERE>"
        },
        advanced: {
            'com.widevine.alpha': {
                'videoRobustness': 'SW_SECURE_CRYPTO',
                'audioRobustness': 'SW_SECURE_CRYPTO'
            }
        }
    }
});

Did this page help you?