Skip to main content

Private Videos

Restricting Playback

This guide is helpful for when you have a video you want to secure. This video could be paid content or sensitive.

By signing, even if someone has the playback ID, they cannot play the video back.

What This Does Not Accomplish

This does not make a video bulletproof unpirate-able.

DRMs protect videos, not JWTs.

It does, however, make the process of stealing and disseminating a video much more challenging.

High-Level Workflow

  1. Lock the video. Create or update an Edge ID with the is_private boolean set to true.
  2. Sign. Your backend code will generate a JSON Web Token (JWT) using your private signing key.
  3. Play. Take the JWT you generate and add it to the URL of the video.

Step 1: Generating Your Signing Key

Under “API Keys” in your app.hesedvid.com dashboard, select the option to create a new signing key.

You can choose to create a signing key which works for all your environments in your organization, or scoped to development, staging or production.

Save both the signing key and the key ID.

Step 2: Creating a JWT For Playback

When you create your JWT, there are a few arguments you should be aware of which you’ll be using in your code.

FieldTypeDescription
substringSubject. Pass through one edge ID or ”*” to allow playback of all signed videos.
kidstringKey ID. Include the ID of the key you generated in step 1.
expiresInnumberExpiration. How long the video can be watched, in seconds, before a new token is needed.

Step 3: Playing Back Your Video

From step 2 you have a string. This is your JWT.

When you embed a URL, this key must be present to play your video.

Whereas before you might have had a video look like this:

<!-- Iframe example for public video -->
<iframe
src="https://worker.hesedvid.com/v1/{edgeID}/master.m3u8"
frameborder="0"
allowfullscreen>
</iframe>

Your protected video needs to look like this:

<!------------------------- Add the key as a URL parameter here ⬇️ -->
<iframe
src="https://worker.hesedvid.com/v1/{edgeID}/master.m3u8?jwt={jwt}"
frameborder="0"
allowfullscreen>
</iframe>

Caution

TODO: Verify that thumbnails are made private

Using Other Players

Under “Playing Videos” on the left, we have a few examples of video players you can use.

With each player, you pass through a URL like:

https://player.hesedvid.com/v1/{edgeID}/master.m3u8

Similar to the iframe, add the jwt URL param like so:

https://player.hesedvid.com/v1/{edgeID}/master.m3u8?jwt={jwt}

Secure Thumbnails

When a video is secure, so is a thumbnail. Similar to videos, when referencing a private thumbnail, you must pass through the key.

Whereas before you may have passed through a thumbnail to a public Edge ID like so:

<video
id="video"
controls
poster="https://player.hesedvid.com/v1/{edgeID}/thumbnail.png"
></video>

Similarly to the video process, add your key as a URL parameter.

<!-- Add the key as a URL parameter here ⬇️ -->
<video
id="video"
controls
poster="https://player.hesedvid.com/v1/{edgeID}/thumbnail.png?jwt={jwt}"
></video>