使用FlowPlayer的安全HTTP流媒体插件始终显示“未找到流”

时间:2014-09-29 01:08:51

标签: php apache .htaccess flowplayer

我认为我已正确配置了所有内容,但我无法使用流动播放器流式传输任何视频并且this plugin已激活。

文件的结构是:

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.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');
}
?>

htaccess的:

RewriteEngine on
RewriteBase /secure

RewriteRule ^(.*)/(.*)/(.*)$ video.php?h=$1&t=$2&v=$3

RewriteRule ^$ - [F]
RewriteRule ^[^/]+\.(flv|mp4)$ - [F]

在apache中启用了Mod Rewrite。

服务器信息:

PHP版本5.6.0-1 Apache / 2.4.10(Debian)

Test URL

我的问题是什么?提前谢谢。

聚苯乙烯。抱歉我的英语不好。

1 个答案:

答案 0 :(得分:0)

   RewriteRule ^(.*)/(.*)/(.*)$ /FULLPATH/video.php?h=$1&t=$2&v=$3