Public versus Private videos
api.video avatar
Written by api.video
Updated over a week ago

Api.video gives you the ability to control whether the video you public can be consumed by anyone (like Youtube, Vimeo and etc.) or be a private video that can have restricted access for one or specific users (like Netflix, Hulu, Udemy and etc.)

Videos on api.video can be tagged public or private.

When you create a video, you can control if the video is private or public. By default, all videos that are created have the public attribute set to “true.” This means that anyone with the video url can watch the video. If you’d like to make your videos private, simply toggle public to false, and each video will be served with a unique token good for one viewing.

Public videos at api.video have the format:

https://embed.api.video/vod/vi5gpofvrrzjNSdiOiMWYItj3

The value after VOD is the videoId. Anyone with this link can watch this video.

What if we set the video to private? Well, first off, the URL format looks different:

https://embed.api.video/vod/vitkytkieTnEvUjKE0VQpd2?token=c259790d-352b-46c3-b0d0-f5d043adefc11

This video can be watched by exactly one user. Once it is viewed, the token is invalid, and the link will throw a 404 error (and the player will say “video not available.” This token is valid for the browser window session.

The second part of this is that the user must re-authenticate to watch again. You can use the api.video analytics to determine if the user has watched the video. Use our dynamic metadata 3 to tag the session with your user’s ID.

When you authenticate the user - you can check “has userX watched this video?” If no results come back - then you can obtain the private video URL. If results come back - then your business logic can decide if they watched enough to block them for a 2nd view.

Many users use private videos in their applications with great success.

You can find the documentation for Private Videos in our docs: https://docs.api.video/docs/private-videos

You can check out this great tutorial on how to handle private videos: https://api.video/blog/tutorials/tutorial-private-videos

Did this answer your question?