flowplayer、php和javascript:隐藏流名称
因此,我使用flowplayer播放rtmp流,但当前流的web视图显示流“键”或url 如果这是真的,其他用户将能够“接管”我们不想要的流。。所以我需要能够在web代码中隐藏“键”或url。我不想要任何身份验证,因为许多comon RTMP拖缆程序在流式传输时不支持这一点 在你说之前,我已经看过了,但是我不能让它和RTMP流一起工作,只有一个固定的.flv流 这是我的代码顺便说一下:flowplayer、php和javascript:隐藏流名称,php,javascript,rtmp,flowplayer,Php,Javascript,Rtmp,Flowplayer,因此,我使用flowplayer播放rtmp流,但当前流的web视图显示流“键”或url 如果这是真的,其他用户将能够“接管”我们不想要的流。。所以我需要能够在web代码中隐藏“键”或url。我不想要任何身份验证,因为许多comon RTMP拖缆程序在流式传输时不支持这一点 在你说之前,我已经看过了,但是我不能让它和RTMP流一起工作,只有一个固定的.flv流 这是我的代码顺便说一下: <a style="display:block;width:960px;height:540px;m
<a
style="display:block;width:960px;height:540px;margin:10px auto"
id="stream">
</a>
<script type="text/javascript">
flowplayer("stream", "http://xxx.net/live/files/flowplayer-3.2.15.swf",
{
clip: {
url: 'stream name url key goes here',
live: true,
provider: 'rtmp'
},
plugins: {
rtmp: {
url: 'http://xxx.net/live/files/flowplayer.rtmp-3.2.11.swf',
netConnectionUrl: 'rtmp://xxx.net/live'
}
}
}
);
</script>
flowplayer(“流”http://xxx.net/live/files/flowplayer-3.2.15.swf",
{
剪辑:{
url:'流名称url键位于此处',
现场直播:没错,
提供者:“rtmp”
},
插件:{
rtmp:{
网址:'http://xxx.net/live/files/flowplayer.rtmp-3.2.11.swf',
网络连接URL:'rtmp://xxx.net/live'
}
}
}
);
您需要使用php文件(或其他替代文件)动态提供URL,它必须是服务器端代码
<?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: /url/');
}
<script type="text/javascript">
// <![CDATA[
window.onload = function () {
$f("player", "flowplayer-3.2.16.swf", {
plugins: {
secure: {
url: "flowplayer.securestreaming-3.2.8.swf",
timestampUrl: "sectimestamp.php"
}
},
clip: {
url: "trailer.flv",
urlResolvers: "secure",
scaling: "fit",
onStart: function (clip) {
document.getElementById("info").innerHTML = clip.baseUrl + "/" + clip.url;
}
}
});
};
// ]]>
</script>