1
我認爲我已經正確配置了所有內容,但我無法使用流式播放器傳輸任何視頻,並且this plugin已激活。使用FlowPlayer的安全HTTP流式處理插件總是說「流式傳輸未找到」
的文件的結構是:
index.php
sectimestamp.php
secure/
--.htaccess
--video.mp4 <-- Mi video (2.4 MB)
--video.php
flowplayer/
--flowplayer-3.2.18.swf
--flowplayer.controls-3.2.16.swf
--flowplayer.securestreaming-3.2.9.swf
(所有文件和顯示目錄755的權限設置)
在的index.php:
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- A minimal Flowplayer setup to get you started -->
<!--
include flowplayer JavaScript file that does
Flash embedding and provides the Flowplayer API.
-->
<!-- flowplayer depends on jQuery 1.7.1+ (for now) -->
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="flowplayer/flowplayer-3.2.13.min.js"></script>
<script>
$(document).ready(function() {
$f("player", "flowplayer/flowplayer-3.2.18.swf", {
plugins: {
secure: {
url: "flowplayer/flowplayer.securestreaming-3.2.9.swf",
timestampUrl: "sectimestamp.php"
}
},
clip: {
baseUrl: "secure",
url: "video.mp4",
autoPlay: false,
urlResolvers: "secure",
scaling: "fit",
}
});
});
</script>
</head><body>
<div id="player"></div>
</body></html>
sectimestamp.php:
<?php
echo time();
?>
video.ph電話號碼:
<?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');
}
?>
的.htaccess:
RewriteEngine on
RewriteBase /secure
RewriteRule ^(.*)/(.*)/(.*)$ video.php?h=$1&t=$2&v=$3
RewriteRule ^$ - [F]
RewriteRule ^[^/]+\.(flv|mp4)$ - [F]
現代重寫已在Apache啓用。
服務器信息:
PHP版本5.6.0-1 的Apache/2.4.10(Debian的)
什麼是我的問題嗎?提前致謝。
Ps。對不起,我的英語不好。
雖然此代碼段可以解決的問題,[包括一個解釋](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers)確實有助於改善您的帖子的質量。請記住,您將來會爲讀者回答問題,而這些人可能不知道您的代碼建議的原因。 – Bono 2015-03-21 12:41:53