Solved

How to restrict video from playing on different sites?

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now