2

Problem:

I am developing a video tutorial site in php. I do not want to anybody to download this file using "IDM" or "right click and save option" .

What I tried

1:

  <?php
   $data = file_get_contents($first->video, FILE_BINARY);
   ?>                                                       
   <video  src="data:video/mp4;base64,<?=base64_encode($data)?>"    controls></video>

2: Disabled right click

Results: it worked for me but it load full video on page so very slow.

I need any alternative for this? Thanks

Dharman
  • 30,962
  • 25
  • 85
  • 135

2 Answers2

3

Short answer: You cannot.

Long(er) answer: It is not possible to prevent a user from downloading anything you want him/her to be able to view online, for the simple reason that the browser has to download it in order to display it.

You can make it more difficult to retain it on the computer. This is done by setting up a streaming server (like Youtube et al), and adding DRM to the video. However, this is only mildly annoying for anyone attempting to "download" your video, and is circumvented by approximately 10 minutes of searching the web.
Compared to the days, or possibly weeks, you'll spend setting up something like this properly.

What I do recommend is to simply add a watermark to the video, so that when someone copies the tutorial. It is at least obvious where it came from.
Then you can apply the proper defense against copyright infringement: The law.

ChristianF
  • 2,068
  • 9
  • 14
  • 1
    ok thanks i only need to prevent download from IDM . is there any Way . method i use work but makes loading slow. can u please recommend proper implementation to stop. thanks –  Nov 14 '16 at 11:11
  • @ShuklaSurendra: Reason it's slow is because you've embedded the entire video in the HTML page itself, which means that they only have to use "File -> Save as" (CTRL + S shortcut) to get the video stored wherever they like. Circumventing the need for IDM. Disabling the right-click for the video, is probably the easiest and most effective answer to your question. This won't stop anyone who is determined, nor really slow them down, but you wont waste too much time implementing it. Compared to other solutions, which are basically equally ineffective. – ChristianF Nov 14 '16 at 11:22
-2

Use preload="none" in video tag and set poster="anyimage.jpg" hope it will reduce the loading time.

Abhinav Kumar
  • 2,883
  • 1
  • 17
  • 30