How to integrate Panda Video's DRM via API?
Learn how to integrate our DRM with the player via API
In this article I will explain step by step how to integrate DRM into our player. If you still don't know about our DRM, how to create a group and the possibilities that exist, I advise you to read this article about DRM and its basic functionalities. Ready, aware of the possibilities that we offer you with DRM, let's go to the step by step.
How to integrate DRM into the player?
Initially, it is necessary that the DRM group is already created and with the videos or folder linked to the group. The groups are already created with a default configuration, which allows you to use them immediately, however, there is total possibility for customization.
Warning: The cost of DRM is $ 0,60/GB, in this article we explain well how the DRM charge works the amount that will be charged is totally linked to the percentage defined in your settings in Screen Time, as explained here.
Here is the time to get necessary information from DRM group. Inside your dahsboard, clicking on Security - DRM - Group (if you have already created it, if you haven't already, just select the "Add Group" option) - Settings, select the API option to release the group id and secret key field. You can get this information via Dashboard or via integration of our API
From here you can already create a private token to attach to the player. To do this, just create a script in your preferred language, we are using the NodeJS language as an example below:
const JWT = require('jsonwebtoken');
const jwtObj = {
drm_group_id: "", // DRM group id
string1: "Licensed to", // First field
string2: "Name: So-and-so", // Second field
string3: "CPF: XXXXXXXXXXX" // Third field
}
const expiresIn = 86400; // 24 hours in seconds
const secret = "" // DRM group secret key
const token = JWT.sign(jwtObj, secret, { expiresIn }) // generated token
This code above you have access to our documentation to have a better explanation.
The first, second and third fields you can use to identify the person watching the video with unique data (name, CPF, email or any other information). To validate that your token is being generated correctly, you can use this link to validate.
At the end, you need to attach this generated token to the player's embed code. Notice right after the video ID in the src attribute that we have the watermark parameter. The value of this attribute is the token generated in the previous step.
<!-- REPLACE THE EMBED CODE -->
<iframe
id="panda-9e8936e9-99d3-4af8-adaa-f17747c258db"
src="https://player-vz-82493b0a-26d.tv.pandavideo.com.br/embed/?v=9e8936e9-99d3-4af8-adaa-f17747c258db&watermark=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkcm1fZ3JvdXBfaWQiOiIzNzYxMDA1ZC02YzJkLTRmYTAtOTc4OS1iYjBhMGEwNGI0NWUiLCJzdHJpbmcxIjoiTGljZW5jaWFkbyBwYXJhIiwic3RyaW5nMiI6IkZ1bGFubyIsInN0cmluZzMiOiJYWFhYWFhYWCIsImV4cCI6MTY2ODA4NzE4OTQyMCwiYWxnIjoiSFMyNTYifQ.FJTAogcH_u2WilDD-99LI2hV59mLQ5kf1ELc48XVhoA"
style="border:none;position:absolute;top:0;left:0;"
allow="accelerometer;gyroscope;autoplay;encrypted-media;picture-in-picture"
allowfullscreen=true
width="100%"
height="100%">
</iframe>
Still have questions?
Call us at support and we'll do our best to help you integrate 100% DRM into your project. Just make sure that all steps are being followed to have a successful integration.
Updated on: 10/03/2023
Thank you!