Hide file source with PHP for divx player
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.
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.
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.)
- Update: Web player is supposed to support HTTP redirects properly as of version 2.1.
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.
精彩评论