api.video
SearchCtrl K

Features

Developers

Private live streams

February 16, 2021 - Doug Sillars in Private Live

One of our most popular video on demand features is the ability to turn a video ‘private,' where each url to the video has a one time token to prevent sharing. We have been asked many times about when the 'private' feature would be available for live streaming. We are very excited to release this as a new feature today!

When you set a video to private, the video link has a one use token connected to it. This token can be used exactly once (in a single web session). This means that the video cannot be shared, and any subsequent access of the url will throw an error. This also means that each time the video is shown, a new token must be requested from api.video via the Get video endpoint.

If you use the api.video player, this all works automatically. If you use a different player, we have a walkthrough of how you must handle the headers.

Private Live streaming

Starting today, now have a public attribute for all live streams. Setting this to

"public": false

will add a token to each url for viewing. With private live streams, you can be sure that your live video is not being shared outside your expected audience - perfect for live concert streaming, or classes.

Of course, just like the video on demand feature, you’ll need a new URL for the live video for each viewer. When you call the Get Livestream endpoint, each live for the m3u8, the player and the iframe will have the token attribute appended.

{
	"liveStreamId": "xxx",
	"createdAt": "2021-02-15T10:30:49+00:00",
	"updatedAt": "2021-02-15T10:30:49+00:00",
	"streamKey": "xxx",
	"name": "Dougs staging private livestream",
	"public": false,
	"record": false,
	"broadcasting": false,
	"assets": {
		"iframe": "<iframe src=\"https://embed.api.video/live/li4SB0HXeul4ITH5DXJFGPxT?token=4851b6b0-3c8a-4f15-8298-c2db754fa6ac\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"true\"></iframe>",
		"player": "https://embed.api.video/live/li4SB0HXeul4ITH5DXJFGPxT?token=4851b6b0-3c8a-4f15-8298-c2db754fa6ac",
		"hls": "https://live.api.staging/private/4851b6b0-3c8a-4f15-8298-c2db754fa6ac/li4SB0HXeul4ITH5DXJFGPxT.m3u8",
		"thumbnail": "https://live.api.staging/private/4851b6b0-3c8a-4f15-8298-c2db754fa6ac/li4SB0HXeul4ITH5DXJFGPxT/thumbnail.jpg"
	}
}

See it in action

Why URL tokens?

Our video tokens are completely server side, removing the need for developers to do any security development (unless you are integrating with a 3rd party player). The app makes an API call to the api.video server, receives the token, and can simply pass the value to their users.

Once the token is used, api.video removes the token from being able to be used again. As long as the user keeps their browser open, they can watch the video, but it cannot be shared, and if a new session is started, the user will need a new token.

Saved private live streams

One of the great features of our live streams is the ability to have it available as recorded Video on Demand after the stream is completed. To enable this, the “record: true” setting must be enabled before the stream starts.

If your stream is set to private and set to record, all of the recorded videos will also be set to private - and will require the equivalent private token for each view.

To make the example video above public, I had to update the video's setting to "public": true.

Current Limitations

As we test and tweak private live streams, we want to keep the audiences lower. Please limit all private live streams to audiences of 3,000 viewers or less. For larger audiences - you can use a public live stream.

With a few weeks of testing, we’ll be able to remove this cap, and allow for unlimited size of viewers for your private live stream.

Give it a try - we'd love to see what you've built - share a link in our forum

Doug Sillars

Head of Developer Relations

Create your free account

Start building with video now