DEV Community

Sh Raj
Sh Raj

Posted on • Originally published at codexdindia.blogspot.com

Disable Download option in HTML5 Video

  See Video Documentation :- 

 

Before - When video tag Download is Enabled .

Here is a Simple Video Tag :-

 


    <video width\="320" height\="240" controls loop\>

        <source src\="https://www.w3schools.com/tags/movie.mp4" type\="video/mp4"\>

        Your browser does not support the video tag.

    </video\>
Enter fullscreen mode Exit fullscreen mode

-- Preview --

Your browser does not support the video tag.

For Disabling the Download Option 

After Disabling Download

Add This Attribute 

controlslist\="nodownload"

Now the Full Code Will Look Like :-

 

    <video width\="320" height\="240" controls loop controlslist\="nodownload"\>

        <source src\="https://www.w3schools.com/tags/movie.mp4" type\="video/mp4"\>

        Your browser does not support the video tag.

    </video\>
Enter fullscreen mode Exit fullscreen mode

-- Preview --

Your browser does not support the video tag.

Possible controlslist Values :- 

  • nofullscreen
  • nodownload
  • noremoteplayback

Download Files Used in This Video :-  https://github.com/CXDI/youtube-files/blob/main/Tips/Disable_Download_option_in_HTML5_Video.html

Top comments (1)

Collapse
 
lionelrowe profile image
lionel-rowe • Edited

Worth mentioning that this does nothing to stop a user downloading the video on their own, only hides the option in the controls menu. It's trivial to grab the src from your site's source code:

<video controls controlslist="nodownload">
    <source src="https://www.w3schools.com/tags/movie.mp4" type="video/mp4">
</video>
Enter fullscreen mode Exit fullscreen mode

And download it using wget or any number of other methods:

wget https://www.w3schools.com/tags/movie.mp4
Enter fullscreen mode Exit fullscreen mode