|
|
#1 (permalink) |
|
Bow before Surpass!
Super #1
Joined in Sep 2004
1,547 posts
Gave thanks: 91
Thanked 49 times
|
Streaming
I am trying to have files not in the /public_html/ to use in a video player on a webpage. Aka, <embed>. So, I use something like /home/username/media/file.avi
Now, it doesnt see to work. My downloader works using that method, aka accessing the folder, but not the <embed> in streaming it. Any ideas of solutions? I am putting the fiels there so they can be ripped or leeched on. Mainly so they cant be ripped, as it requires a membership and script access to do so.
__________________
Wii Hotspot - Upcoming project! -http://www.wiihotspot.com
Make a cPanel Login Form | Why is my Account Suspended? |
|
|
|
|
|
#2 (permalink) |
|
minor deity
Super #1
Joined in Apr 2004
Lives in Georgia
Hosted on XEON
7,395 posts
Gave thanks: 28
Thanked 94 times
|
what's your embed object look like?
__________________
Proud to be a Surmunity Mod! XEON Make a fundamental difference! My Sites: Curious about Brewing Beer? Join the community! >>>>> Some Change is GOOD! Keep your paycheck! Support the Fair Tax Get into an Art museum Victorian London It's your brain -ON WEB - mybrainhost.com (under development) What SHOULD Government do? Much Less than it Does! |
|
|
|
|
|
#3 (permalink) |
|
after g, before i
Resident.
Joined in Jul 2004
Lives in N,BC,CA
8,092 posts
Gave thanks: 48
Thanked 131 times
|
This is a bit confusing.. are you using a script to access the file before passing it to the browser? A browser wouldn't be able to access any files not within public_html unless it's being proxy'd through a script that is in public_html.
That said, unless the mime-type is being sent properly, it likely won't stream. |
|
|
|
|
|
#4 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Jan 2007
5 posts
Gave thanks: 0
Thanked 2 times
|
for example...
H is right on the money. The browser can't see things outside of your webroot. Just to elaborate, you could do this a number of different ways. You could setup basic HTTP auth using a ".htaccess" file to password protect the directories containing this data. You could also do it the way H hinted at, which is to use a script to check if the user has logged in, if they have, read the AVI file, set the correct content header, and output the binary for the AVI directly. I'll include a small example in PHP.
test.php note: the "test.avi" file can be in any folder/remote location the webserver has access to. Code:
<?PHP
$avi = 'test.avi';
$fp = fopen($avi,'rb');
$contents = fread($fp, filesize($avi));
fclose($fp);
ob_start();
header('Content-type: video/x-msvideo');
print $contents;
exit;
?>
note: make sure you update the location of the test.php script. Code:
<body> <object id="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsm p2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows® Media Player components..." type="application/x-oleobject" width="280" height="256"> <param name="fileName" value="http://localhost/test/test.php"> <param name="animationatStart" value="true"> <param name="transparentatStart" value="true"> <param name="autoStart" value="true"> <param name="showControls" value="true"> <param name="Volume" value="-450"> <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="http://localhost/test/test.php" name="MediaPlayer1" width=280 height=256 autostart=1 showcontrols=1 volume=-450> </object> </body> |
|
|
|
| These users thank davesm for this great post! | GamingHybrid (January 22nd, 2007), H (January 22nd, 2007) |
|
|
#6 (permalink) |
|
Bow before Surpass!
Super #1
Joined in Sep 2004
1,547 posts
Gave thanks: 91
Thanked 49 times
|
Thank you davesm, very helpful and will try it now. I should have noticed something like that would work in this situation, and that was what I was trying to do
![]() Thanks again!
__________________
Wii Hotspot - Upcoming project! -http://www.wiihotspot.com
Make a cPanel Login Form | Why is my Account Suspended? |
|
|
|
|
|
#7 (permalink) |
|
Bow before Surpass!
Super #1
Joined in Sep 2004
1,547 posts
Gave thanks: 91
Thanked 49 times
|
http://www.gaminghybrid.com/stream.p...006&f=mgs4.avi
It works! Whoo! Thansk again! The only issue is that my firefox seems to be missing a plugin in which it needs to play it... yet it works in IE. Any ideas on the plugin? I'm sure it is refering to a WMP plugin...
__________________
Wii Hotspot - Upcoming project! -http://www.wiihotspot.com
Make a cPanel Login Form | Why is my Account Suspended? |
|
|
|
|
|
#8 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Jan 2007
5 posts
Gave thanks: 0
Thanked 2 times
|
hmm, it must be coming from the code i snag'd off the net.
try: Code:
<embed type="video/quicktime" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="http://localhost/test/test.php" name="MediaPlayer1" width=280 height=256 autostart=1 showcontrols=1 volume=-450> |
|
|
|