Private video delivery with api.video players

The recommended way and easiest way to deliver private videos is with our in-house player. This method will allow you to delivery the private videos without additional coding efforts and without handling any extra parameters.

Embedded private video delivery to HTML

When delivering the embedded video, we will use our in-house player to playback the video. The steps for that are pretty simple as consuming public videos. In the example below you can consume it directly by passing in the private video URL into HTML:

<html>
  <head>
  </head>
  <body>
    <iframe src="https://embed.api.video/vod/{video id}?token={private token}" width="30%" height="30%" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>
  </body>
</html>

iframes in incognito mode

When playing an embedded private video in a browser that runs in incognito mode you'll have to leverage sessions. Check out the guide for retaining a private session here.

In order to build a dynamically served private videos, you can leverage the /videos endpoint in order to get the url of the video and private token. For example the following steps are possible:

  • Make a request to /videos endpoint
curl --request GET \
     --url https://ws.api.video/videos/ABC \
     --header 'accept: application/json' \
     --header 'authorization: Basic ZYX='
  • You will get the following response, where the private token is embedded in the url:
{
  "videoId": "ABC",
  "title": "test video",
  "description": "something that I wanted to share",
  "public": false,
  "panoramic": false,
  "mp4Support": true,
  "publishedAt": "2023-01-19T10:19:19+00:00",
  "createdAt": "2023-01-19T10:19:19+00:00",
  "updatedAt": "2023-01-26T16:55:41+00:00",
  "tags": [],
  "metadata": [],
  "source": {
    "type": "upload",
    "uri": "/videos/ABC/source"
  },
  "assets": {
    "iframe": "<iframe src=\"https://embed.api.video/vod/ABC?token=XYZ\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"true\"></iframe>",
    "player": "https://embed.api.video/vod/ABC?token=XYZ",
    "hls": "https://vod.api.video/vod/ABC/token/XYZ/hls/manifest.m3u8",
    "thumbnail": "https://vod.api.video/vod/ABC/token/XYZ/thumbnail.jpg",
    "mp4": "https://vod.api.video/vod/ABC/token/XYZ/mp4/source.mp4"
  }
}
  • All you have to do now is to get the iframe and pass it as a value to the HTML that will be generated by the server. We will handle the rest.

Use api.video Android SDK player to deliver private videos

The same method can be applied to the Android SDK player we offer. Playing the private video is simple as just passing in the video id and private token.

In the example folder you'll be able to find the implementation using just video id and the private token.

Was this page helpful?