Solved

How to restrict video from playing on different sites?

Posted on 2014-03-12
3
184 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

772 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