Question

How can I protect my videos from hotlinking?

For example: http://vk.com/video215336036_165406371

when you look at the source code, vk.com provides an one-time usage video path such as

http://cs523402v4.vk.me/u215336036/videos/d436dc950c.240.mp4

Was it helpful?

Solution

You could have a directory inaccessible from the outside world where you have all your video files. Then you could have a database table with a structure like:

videos
---------------
id
uri
temp_url
timeout

Where uri is the location of your real video file and temp_url is a random URL that you generate. The timeout field contains a timestamp describing when the temp_url expires and you have to generate a new one. You could set the timeout to 5 minutes from when you generate a new temp_url or 10 minutes. Up to you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top