使用 PHP 为 divx 播放器隐藏文件源
我需要一种方法来隐藏 DivX 播放器嵌入代码中的文件源。
文件源是远程的。我正在尝试使用标头通过 php 文件流式传输文件。我用了 3 个部分。 1:定义会话中的文件路径。 2:嵌入视频阅读文件:stream.php。 3:重定向到视频源。
这是第 1 部分,定义文件源:
<?PHP session_start();
$_SESSION["url_vid"] = "http://remote-server.com/file.avi";
?>
这是嵌入代码(第 2 部分):
<object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="320" height="260" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">
<param name="custommode" value="none" />
<param name="autoPlay" value="false" />
<param name="src" value="stream.php" />
<embed type="video/divx" src="stream.php" custommode="none" width="850" height="400" autoPlay="false" pluginspage="http://go.divx.com/plugin/download/">
</embed>
</object>
这是stream.php 代码:
<?PHP
session_start();
header("Location :".$_SESSION["url_vid"]);
?>
这不起作用。
当 DivX 播放器运行时,它会发出警报:“DivX Plus Web 播放器无法下载视频,请检查您的互联网连接”,但是当直接转到stream.php 文件时,它会开始下载文件。
有谁知道隐藏文件路径的任何替代方法。或者通过某种方式处理stream.php 文件以使其通过DivX 播放器工作。
我需要使用 DivX 播放器,因为它可以读取 .avi 文件。
I need a method to hide the file source in embedding code for the DivX player.
The file source is remote. I am trying to stream the file through a php file using the header. I am using 3 parts. 1:define the file path in a session. 2:embed the video reading file : stream.php. 3: redirect to video source.
Here is part 1, define file source:
<?PHP session_start();
$_SESSION["url_vid"] = "http://remote-server.com/file.avi";
?>
Here is the embed code (part 2):
<object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="320" height="260" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">
<param name="custommode" value="none" />
<param name="autoPlay" value="false" />
<param name="src" value="stream.php" />
<embed type="video/divx" src="stream.php" custommode="none" width="850" height="400" autoPlay="false" pluginspage="http://go.divx.com/plugin/download/">
</embed>
</object>
here is the stream.php code :
<?PHP
session_start();
header("Location :".$_SESSION["url_vid"]);
?>
This isn't working.
When it the DivX player is ran, it alerts with : "The DivX Plus Web Player could not download the video, please check your Internet connection" But when going directly to the stream.php file it begins downloading the file.
Does anyone know of any alternative ways to hide the file path. Or some way to fuss with the stream.php file to get it working through the DivX player.
I need to use the DivX player because it can read .avi files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://labs.divx.com/node/1304
显然 DivX 也不做 cookie出色地。这可能就是解释。我认为不可能做到这一点。
您可能想考虑设置某种临时密钥来传递给stream.php,stream.php可以查找该临时密钥,然后匹配到要重定向到的URL(然后删除该密钥以防止人们复制链接)-是的,如果问题不是因为 DivX 不支持重定向。
http://labs.divx.com/node/1304
Apparently DivX doesn't do cookies too well. This could be the explanation. I don't think it's possible to do this.
You might want to look into setting some sort of a temporary key to pass to stream.php, which stream.php can lookup and then match to a URL to redirect to (and then delete the key preventing people from copying the link) - that is, if the problem isn't because DivX doesn't support redirects.
尝试
一下但是,即便如此,我也不确定你是否可以像这样拦截并重写流媒体请求。它们不是您习惯的简单的“请求内容、获取内容、完成”任务。
如果不出意外,媒体播放器将需要了解 HTTP
Location
标头,并支持基于此更改其目标 URL;您没有向我们表明您已经做过任何研究来确定情况是否如此。(最终,您应该记住
header("Location: abc")
并不是改变服务器端请求的灵丹妙药;您将 HTTP 标头发送回 客户端,邀请它使用不同的地址“重试”。)还需要考虑 cookie;您似乎正在使用基于会话的 cookie,除非您的播放器软件支持并使用它们,否则会话变量将不可见。
Try
But, even so, I'm not sure that you can intercept and re-write streaming media requests like this. They're not the simple "ask for content, get content, finish" tasks that you're used to.
If nothing else, the media player would need knowledge of the HTTP
Location
header and the support for changing its target URL based on that; you've not shown us that you've done any research to determine whether this is the case.(Ultimately, you should remember that
header("Location: abc")
is not a magic bullet that changes the request on the server-side; you're sending an HTTP header back to the client, inviting it to "try again" with a different address.)There are also cookies to consider; you appear to be using session-based cookies and unless your player software supports and uses them, the session variable won't be visible.