Reputation: 21
My client wants his videos hidden and not having the possibility to be downloaded or copied (or at least to make it difficult to do).
I'm trying to use flowplayer secure streaming, but I cannot make it work!
I'm getting this error:
200, Stream not found, NetStream.Play.StreamNotFound, clip: '[Clip] 'secure/ad722768cfa6f10b51b7e317c8dd1ca4/1417957647/v.mp4"
It says the video was not found, but it's placed on secure/v.mp4 as it should (right?)
UPDATE1
I forgot to mention that I have the required apache rewrite rule inside secure folder…
secure/.htaccess
RewriteEngine on
RewriteBase /secure
RewriteRule ^(.*)/(.*)/(.*)$ video.php?h=$1&t=$2&v=$3
RewriteRule ^$ - [F]
RewriteRule ^[^/]+\.(flv|mp4)$ - [F]
UPDATE2
I did it! It was a dumb simple thing:
I was testing with easyphp webserver, and the url was localhost/v/index.html
I did a test moving all the content from /v folder to the root and it worked!
And now I learned in htaccess I need to put the full path on RewriteBase starting from the root, in my case I needed to set this:
RewriteBase /v/secure
The codes:
index.html
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="flowplayer-3.2.13.min.js"></script>
<script>
$(document).ready(function() {
$f("player", "flowplayer-3.2.18.swf", {
plugins: {
secure: {
url: "flowplayer.securestreaming-3.2.9.swf",
timestampUrl: "sectimestamp.php"
}
},
clip: {
baseUrl: "secure",
url: "v.mp4",
urlResolvers: "secure",
scaling: "fit",
}
});
});
</script>
</head>
<body>
<div id="player"></div>
</body>
sectimestamp.php
<?php
echo time();
?>
secure/video.php
<?php
$hash = $_GET['h'];
$streamname = $_GET['v'];
$timestamp = $_GET['t'];
$current = time();
$token = 'sn983pjcnhupclavsnda';
$checkhash = md5($token . '/' . $streamname . $timestamp);
if (($current - $timestamp) <= 2 && ($checkhash == $hash)) {
$fsize = filesize($streamname);
header('Content-Disposition: attachment; filename="' . $streamname . '"');
if (strrchr($streamname, '.') == '.mp4') {
header('Content-Type: video/mp4');
} else {
header('Content-Type: video/x-flv');
}
header('Content-Length: ' . $fsize);
session_cache_limiter('nocache');
header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
header('Pragma: no-cache');
$file = fopen($streamname, 'rb');
print(fread($file, $fsize));
fclose($file);
exit;
} else {
header('Location: /secure');
}
?>
I already tried this > Flowplayer Secure Streaming with Apache but I also get the error above.
Does anyone use flowplayer secure streaming? What am I doing wrong?
Upvotes: 0
Views: 838
Reputation: 21
I figured out what was wrong, in htaccess you need to put the full path on RewriteBase starting from the root, in my case I needed to set this:
RewriteBase /v/secure
Upvotes: 1