Solved

How to restrict video from playing on different sites?

Posted on 2014-03-12
3
185 Views
Last Modified: 2014-03-14
We are going to be using HTML5 video to be playing some members only content. The problem is, the Rackspace CDN allows videos to be played from anywhere on any website.

So, my thought is: there must be a way to use Javascript to prevent people from being able to scrape the content.

Obfuscation?
IP Address validation?

What's the best way to ensure that our videos are ONLY played on OUR sites?

PS. If need be, we could always host the videos on our own servers if an Apache directive would accomplish the task...
0
Comment
Question by:DrDamnit
3 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39924576
Go to Adobe or Real Networks, they propose solutions doing this.
Not sure you can found a free Helix anymore : http://en.wikipedia.org/wiki/Helix_(multimedia_project)
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39924783
I have an article here that goes in a similar direction - it watermarks any image that is "hotlinked" from a foreign web site.  You might be able to use a similar design strategy.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_10065-Adding-a-Watermark-to-an-Image.html
0
 
LVL 32

Accepted Solution

by:
DrDamnit earned 0 total points
ID: 39930612
I figured it out. It was pretty simple really:

On the HTML side:
<!--DOCTYPE htmli-->
<html>
<head>
</head>
<body>
<video controls width="720" height="306">
  <source type="video/mp4" src="http://www.highpoweredhelp.com/videotest/videos/
</video>
</body>
</html>

Open in new window


Then, there is a PHP script that serves videos from videotest/videos/index.php.

Then I wrote a class called "coldlinker" that handles all the permissions, but the code is pretty easy: build logic that discovers if the link is from an allowed domain, and if it is, serve the correct video. If not, serve something else or a broken one.

if(isset($_SERVER['HTTP_REFERER']))
{
        if($cl->refererAllowed($_SERVER['HTTP_REFERER']))
        {
                $cl->logger->log("Referer allowed: " . $_SERVER['HTTP_REFERER']);
                $path = 'http://1fe0653317283bdcaf77-9b1608f07c89c6f698961f2c1f14233d.r49.cf1.rackcdn.com/goodvideo.mp4';
        } else {
                $cl->logger->log("Referer : DISALLOWED " . $_SERVER['HTTP_REFERER']);
                $path = 'http://1fe0653317283bdcaf77-9b1608f07c89c6f698961f2c1f14233d.r49.cf1.rackcdn.com/youareathief.mp4';
        }
} else {
        $cl->logger->log("No referer present.");
        $path = 'http://1fe0653317283bdcaf77-9b1608f07c89c6f698961f2c1f14233d.r49.cf1.rackcdn.com/goodvideo.mp4';
}
header("location: $path");

Open in new window


The logger class referenced is our open source logger class:
http://svn.highpoweredhelp.com/logger/logger.class.php
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question