Prohibition on downloading a video that is inside the video tag

Placing your video on your site, placing it in the tags < video src="video/test.mp4" >< /video >, when you click on the PCM, a menu appears in which it is available for downloading. Created it .htaccess with forbidding commands-it turned out to be zero sense.

Tell me, dear experts, how to prohibit downloading a video that is inside this tag?

Author: Виталина, 2015-03-17

4 answers

It is not possible to prevent the file from being downloaded in this case.
You can delete the direct link to the file, but nothing will work.
Because in order for the browser to view it, it must download it, which means that the user can catch what he downloads and save the file separately.

 2
Author: , 2015-03-17 08:20:20

You can cancel the PCM context menu action. You can cancel viewing the source code of the page by pressing Ctrl+U. But what's the use? Those who are in this rummage, will take what is needed: 1. Video-Enable Camtasia studio or any screen recording program. Set a timer for the end time of the video. Start the video in full-screen mode. Profit. 2. Click Settings - Source Code in the browser. Profit. Don't suffer from bullshit.

 1
Author: user252781, 2017-06-01 21:54:09

Here is a sample code with a ban on downloading videos.

<video width="512" height="380" controls controlsList="nodownload">
    <source data-src="mov_bbb.ogg" type="video/mp4">
</video>
 1
Author: Антон Пугачев, 2018-02-16 01:34:18

Unfortunately, the link to codepen, which was given in one of the comments to the question, no longer works. So I implemented my solution. The main idea is to cover the player with our element and thus hide the possibility of unauthorized saving of the video file on the device. However, this also implies the main disadvantage of the approach, which is that the controls have to be implemented independently.

And to bypass such an obstacle, it is enough to open select the item inspector from the context menu by clicking on the video, and delete the .video-curtain node.

/* простенькая реализация управлением проигрывателем */
document.getElementById("trigger-b").onclick = function() {
    var p = document.getElementById("player-e");
    if (p.paused) p.play();
    else p.pause();
}
.video-container > * {
    width: 640px;
    height: 360px;
}
.video-container {
    /* нужно для позиционирования потомка */
    position: relative;
}
.video-curtain {
    /* эти свойства перемещают блок поверх видео */
    position: absolute;
    top: 0px;
}
<div class="video-container">
    <video id="player-e" poster="https://i.stack.imgur.com/Wj3wy.png"
        src="http://stack.astra.mymedia.su/enjoykin-druzhko.mp4"></video>
    <div class="video-curtain" id="trigger-b">
    </div>
</div>

The example uses the song " Enjoykin-The Likes are Spinning (feat. Sergey Druzhko)".

 0
Author: mymedia, 2017-06-02 11:20:35