1

在过去的两天里,我一直在寻找解决此问题的方法,因此将不胜感激。

我在另一端使用带有 wowza 服务器的自定义令牌(我重新编译了插件 swf)。它工作正常,但人们仍然可以复制我们的播放器代码并通过链接到我们的 swf 在他们的网站上播放。

我想在我的安全流配置中实现时间戳。我添加了一个时间戳并将 urlResolvers 添加到剪辑部分,但后来我的 flowplayer 给了我一个错误,它找不到视频(无效链接带有哈希和时间戳)。

我的问题是,如果我在播放器中使用时间戳,我还需要做什么其他配置?我需要对我的 wowza 服务器做些什么吗?因为很明显,加上时间戳,服务器就找不到视频了。

请帮助我提供您拥有的任何信息。谢谢!:)

4

1 回答 1

0

时间戳用作安全令牌或混淆 url。你需要做的就是

// <![CDATA[
  window.onload = function () {
    $f("player", "flowplayer-3.2.16.swf", {
      plugins: {
        secure: {
          url: "flowplayer.securestreaming-3.2.8.swf",
          timestampUrl: "sectimestamp.php"
        }
      },
      clip: {
        baseUrl: "YOUR BASE URL",
        url: "trailer.flv",
        urlResolvers: "secure",
        scaling: "fit",
        onStart: function (clip) {
          document.getElementById("info").innerHTML = clip.baseUrl + "/" + clip.url;
        }
      }
    });
  };
  // ]]>
  </script>

在您的 sectimestamp.php 中,这是一个非常简单的代码行:

<?php
echo time();
?>

然后你在 video.php 文件中使用类似这样的东西

$hash = $_GET['h'];
$streamname = $_GET['v'];
$timestamp = $_GET['t'];
$current = time();
$token = '12359khlsdfhlasiu3'; // I recommend using a dynamically generated token
$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: /URL/');
}

这是在 flowplayer 中使用它的一个例子

于 2013-09-06T03:56:44.030 回答