Tutorials · 4 min read

Control Video Downloads with api.video

Enhancing Video Accessibility: Control Video Downloads with api.video

Learn how you and your users can have full control over video accessibility, and how you can enable or disable video downloads for your viewers in this short tutorial.

api.video

November 9, 2023

Video content is a critical digital media component, offering a dynamic way to share information and engage with audiences. api.video provides a robust video on demand platform, where you and your users can have full control over video accessibility. You can enable viewers to download the source videos directly from the api.video player, or from the player of your choice. Improve user experience and drive engagement in your solution by enabling viewers to access videos offline, or give content creators the ability to create backups of their media. It also works the other way around - you have the ability to disable video download functionality altogether and restrict access to the video source file, if that suits your use case better.

This article will explain the ways you can enable or disable video downloading through the api.video player using our API and the Dashboard, and will also give you a simple example for creating a custom download button for the player of your choice.

Download access control with a single setting

api.video simplifies the process of offering downloadable videos by providing a single property that can be set to either true or false when a video is uploaded. The mp4Support property decides whether your viewers can access and download the source file a of a video. When enabled, this feature introduces a download button directly on the api.video player, allowing viewers to download videos with a single click. Setting the property to false on the other hand disables the download option, giving creators more control over the distribution of their content.

The mp4Support property is enabled by default for all video uploads.

Control downloads via the API

Let’s dive into how you can control video downloads programmatically when integrating with one of api.video’s API clients.

This example uses api.video’s Node.Js API client. Check out our Libraries & SDKs for a complete list of available API clients.

Utilizing api.video’s /videos endpoint, you can enable or disable downloads for individual videos during upload, or you can update an already uploaded video to change download permissions.

Let’s see how this process looks like when uploading a video:

 

  1. Create a video object and define the mp4Support property

javascript

  1. Upload the video source file

javascript

Now let’s see how the same thing looks like for a video that is already hosted on api.video:

javascript

Check out the API reference for more details about the /videos endpoint, and take a look at the Video Download guide’s examples for other API clients.

Enable downloads through the Dashboard

When you are hosting your own content at api.video, the Dashboard gives you granular control over every video that you upload. Check out the Videos page to see a list of all your uploaded videos!

 

Let’s see how you can modify download access without writing a single line of code:

 

  1. Open the Details view for any specific video where you want to enable or disable download access:
Showing an uploaded video in the Dashboard
  1. On the Video details page, click on the Update video object button:
Showing the Video Settings page in the Dashboard
  1. Modify the MP4 support setting with a simple toggle and click on Update Video to save your changes:
Modifying the MP4 Support property

Once you save your changes, the download button will appear for this video in the api.video player.

Create a custom download button

Most video player solutions have native support for downloading the video’s source file. However, you can also add a download button to a custom player that does not have this functionality.

 

Leverage api.video’s API by sending a request that retrieves the video’s id, and then render a custom download button serves the mp4 asset for video.

 

Check out the Video download guide for a step-by-step walkthrough on how to create a custom download button using Node.Js, api.video’s Node.Js API client, npm, and React.

Conclusion

The ability to enable or disable video downloads is a fundamental aspect of content management, and api.video is here to offer a simple and intuitive solution for both developers and content creators.

 

Explore the capabilities of api.video! Check out our documentation, browse through the available Libraries & SDKs, and sign up to get started for free.

 

Start with api.video today to deliver a comprehensive, feature-rich video on demand service. The team is readily available to assist you with any inquiries or to help you discover the full potential of api.video.

Try out more than 80 features for free

Access all the features for as long as you need.
No commitment or credit card required

Video API, simplified

Fully customizable API to manage everything video. From encoding to delivery, in minutes.

Built for Speed

The fastest video encoding platform. Serve your users globally with 140+ points of presence. 

Let end-users upload videos

Finally, an API that allows your end-users to upload videos and start live streams in a few clicks.

Affordable

Volume discounts and usage-based pricing to ensure you don’t exceed your budget.