使用 PHP 为 divx 播放器隐藏文件源

发布于 2024-11-26 15:07:05 字数 1254 浏览 1 评论 0原文

我需要一种方法来隐藏 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

双手揣兜 2024-12-03 15:07:05

http://labs.divx.com/node/1304

显然 DivX 也不做 cookie出色地。这可能就是解释。我认为不可能做到这一点。

我注意到,当网络播放器启动时,它会建立 2 个连接(对于任何
电影)。第一个连接下载 2.8 KB(我猜这是
标头告诉 divx 播放器该文件是否是电影),然后
第二个连接下载电影本身并播放。

我注意到,当身份验证“启用”时,divx 网络播放器
请求第一个连接“WITH COOKIES”,因此它将获得
标头正确,但是当涉及第二个(实际)连接时,它
不发送COOKIE,因此返回的电影是Access
拒绝文本。

您可能想考虑设置某种临时密钥来传递给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.

I noticed, when web player starts it makes 2 connections (for any
movie). the first connection downloads a 2.8 KB (I guess this is the
header which tells divx player if the file is a movie or not) and then
the 2nd connection which downloads the movie itself and plays it.

what I noticed is, when authentication is "enabled", divx web player
requests for the first connection "WITH COOKIES", so it will get the
header correctly, but when it comes to the 2nd (actual) connection, it
doesn't send the COOKIE, and therefor the returned movies is Access
denied text.

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.

雄赳赳气昂昂 2024-12-03 15:07:05

尝试

header("Location: " . $_SESSION["url_vid"]); // moved colon

一下但是,即便如此,我也不确定你是否可以像这样拦截并重写流媒体请求。它们不是您习惯的简单的“请求内容、获取内容、完成”任务。

如果不出意外,媒体播放器将需要了解 HTTP Location 标头,并支持基于此更改其目标 URL;您没有向我们表明您已经做过任何研究来确定情况是否如此。

(最终,您应该记住 header("Location: abc") 并不是改变服务器端请求的灵丹妙药;您将 HTTP 标头发送回 客户端,邀请它使用不同的地址“重试”。)

还需要考虑 cookie;您似乎正在使用基于会话的 cookie,除非您的播放器软件支持并使用它们,否则会话变量将不可见。

Try

header("Location: " . $_SESSION["url_vid"]); // moved colon

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文