Re: trying to make apache a streaming server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, December 22, 2006 12:00 pm, ibanex22 wrote:
> I have recently installed apache on an OpenBSD system and have
> successfully
> gotten all my media on there.  It's great except I would really like
> for
> when someone clicks on an .mp3 to have it redirect it to a seperate
> frame.
> Therefore, they could click on a song and it would play in a seperate
> frame
> yet still continue to browse my files while the song plays.  Is there
> any
> way to do this?  Any suggestion would be great!

You can't make a single HTTP request have 2 different responses.

So the way to do this is to have the second frame be there from the
get-go, or to have the click go to a whole new page with 2 frames, one
with the MP3, one with the rest of the content.

The main page will have to "pass through" the MP3 to be played to the
sub-frame.

In PHP it would be like this:
(untested code, just as a crude example of the basics of "how")

PAGE #1:
<a href="mainpage.php?mp3=whatever.mp3">play mp3</a>


mainpage.php
<frameset rows="*,20">
  <frame src="maincontent.htm" />
  <frame src="playmp3.php?mp3=<?php echo $_GET['mp3']?>" />
</frameset>

maincontent.htm
Your normal page here

playmp3.php
<?php $mp3 = $_GET['mp3'];?>
<embed src="<?php echo $mp3?>" />


Now, some caveats:
#1
The above code is riddled with SECURITY HOLES for a cross-site script
attack as it blindly spews out whatever is in $_GET data, which even
the dubmest of the dumb Bad Guys could spoof.
Start reading here:
http://phpsec.org/

#2
The above uses frames, which suck, but are easier to demonstrate than
an IFRAME which would be prettier and nicer and more Web 2.0-y.

#3
Embedding the MP3 into your HTML page is really rude to those of us
who would prefer to queue things up in our MP3 player, and who already
have other music playing in that, thank you very much.

You should consider providing an alternative link to just get the MP3
so the user can CHOOSE how they'd like to get their media, rather than
forcing them to do it your way.

Or just bag the idea of embedding an AUDIO output into your web-page,
as it's a pretty dumb idea in the first, place, imho. :-) :-) :-)

There aren't any users who have any kind of plug-in to play the audio
that don't already have a better audio player software package
installed in the first place, so you might as well let them use their
superior software to listen instead of embedding the audio.

YMMV

Apologies for veering off of Apache and into HTML, PHP, and web-design.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux