Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable download video option

i want to disable download video link from control panel of video tag.


     <video oncontextmenu="return false;" id="myVideo" autoplay controls>
        <source src="uploads/videos/<?php echo $vid;?>" type="video/mp4">
    </video>
like image 441
nik Avatar asked Dec 16 '16 09:12

nik


2 Answers

That's very easy it seems that your using the HTML 5 Video and using your sample above, below is the code:

<video oncontextmenu="return false;" id="myVideo" autoplay controls controlsList="nodownload">
    <source src="uploads/videos/<?php echo $vid;?>" type="video/mp4">
</video>

Just add controlsList="nodownload" in your video tag.

like image 64
Allan Avatar answered Oct 04 '22 21:10

Allan


Add below style to disable download link in video tag.

For Example:

<!DOCTYPE html>
<html>
<head>
<style>
   video::-internal-media-controls-download-button {
    display:none;
   }

   video::-webkit-media-controls-enclosure {
        overflow:hidden;
   }

   video::-webkit-media-controls-panel {
        width: calc(100% + 30px); 
   }
</style>
</head>

<body>

<video width="320" height="240" controls>
  <source src="add your video url" type="video/mp4">
</video>
</body>
</html>
like image 34
Mathankumar K Avatar answered Oct 04 '22 21:10

Mathankumar K