RE: op= streaming problems

"Disnard, Jon" <[email protected]> Thu, 13 Jun 2002 10:11:20 -0400
Newsgroups gmane.comp.apache.mod-mp3
Message-ID <[email protected]>
Howdy,

The reason your browser is downloading is because it doesn't know what to do
with the data.
That is what web-browsers do when they encounter funky data. Allow me to
explode the process of what is happening here:

1. Client makes http request for a resource.
2. Server says audio/mpeg (or whatever) followed by a stream of bytes.
3. The client doesn't understand the mime type it was just sent, and
attempts to look it up in a mapping of mime's to applications, and doesn't
find a match. Client browser checks the data stream to see if its plain
text, see it is not, and falls back on its only other option: to download.

Without cheating (looking at the source) I'd have to venture a guess and say
that in the two situations mod_mp3 is sending two different mime-types. I
will say that the op=play is designed to be given to a mp3 decoder app, not
a web browser, and to me it just seems logical that it would download rather
than play (from a web browser).

However, if you were to use op=m3u2&song= in a browser, it would probably
work. That way the odds of Netscape or IE finding the 'mpegurl' mime-type on
the mime/application map is much more likely than the one for 'audio/mpeg'.
It is far more common for the web browser to be made aware of the playlist
mime-type, and knows to pass to either XMMS or winamp, or whatever. Also,
the data sent by the op=m3u2 is plain text, and that is inherently viewable
by a web browser. 

You must realize that mod_mp3 is designed to work with the two crowds: mp3
decoders, and web browsers.

For WinAMP, XMMP, or whatever (mp3 decoders) you use:
op=play
Op=m3u
Op=m3u2 (preferred)
Op=pls
Op=pls2 (Preferred)

For a Web Browser, you should be using:
Op=list
Op=select	(good for testing)
Op=rss
Op=rdf
Op=index
Op=mbm
Op=m3u
Op=m3u2
Op=pls
Op=pls2


The former list is all text stuff (mod_mp3 is sending plain text), the only
situation that mod_mp3 is spewing non-text is in op=play. You will notice
that most good mp3 decoders can handle the m3u, and pls directly on the url
so both the browser, and mp3 decoder can use those playlist op's, those are
the only ones they share.

So the way you want to do this is to use op=m3u in your browser, the browser
passes the playlist to the mp3 decoder responsible for that data, and the
decoder then reads the playlist to get the url that has op=play&song=blah.
That way the decoder app gets the mpeg data, not the browser.

-Jon Disnard
http://www.audiodevil.org





-----Original Message-----
From: Troy Leaver [mailto:[email protected]] 
Sent: Wednesday, June 12, 2002 07:39
To: [email protected]
Subject: Re: [Mod_mp3] op= streaming problems


Brian.

Thanks for the quick response!

In answer to your questions.

1.  Yes, it works one way, but not the other.  I'll
send you a private e-mail with the URL so you can see
it for yourself.

2.  With the AddHandler added to http.conf, the file
still is treated like a regular audio file, the player
does begin to play it, but not streamed, it's
downloading in the background as it plays.

3.  Don't worry about this one.  The more I thought
about it, I think Ensim actually wraps the processes
with some kind of bandwidth monitoring whatsit, so I'm
pretty confident that the output from mod_mp3 will be
treated just like regular Apache http output.

--- Brian Aker <[email protected]> wrote:
> On Wed, 2002-06-12 at 15:56, Troy Leaver wrote:
> > 1.  When accessing http://severname:8000, my
> single
> > mp3 file streams great.  However, when using the 
> > http://servername:8000/?op=play&song=[MD5 of
> filename]
> > syntax, the browser downloads the mp3 first and
> then
> > plays it.  What causes this?  I really need to be
> able
> > to link to individual mp3 files from my web site.
> Not sure what is up with this. So it works on way
> but not the other?
> 
> > 2.  The FAQ mentions an AddHandler mp3-file *.mp3
> > entry to enable streaming of files intermixed with
> > other files.  Does this mean that I should just be
> > able to place an mp3 anywhere on my site, link to
> it
> > with standard syntax
> (http://servername/filename.mp3)
> That is the theory. It will stream just the one file
> (so no continues
> stream between songs) but it does work just fine.
> 
> 
> > 3.  I'm using the Ensim control panel on my
> server.
> > Ensim records the bandwidth consumption of Apache,
> > SMTP, POP/IMAP, etc.  I'm hoping that since this
> is an
> I would have to know how it work before I could tell
> you if it would
> work or not.
> 	-Brian
> --
>
_______________________________________________________
> Brian "Krow" Aker, [email protected]
> Slashdot Senior Developer
> Seattle, Washington
> http://tangent.org/~brian/
> http://askbrian.org/
>
_______________________________________________________
> You can't grep a dead tree.
> 
> _______________________________________________
> Mod_mp3 mailing list
> [email protected] 
> http://lists.tangent.org/mailman/listinfo/mod_mp3


=====
W. Troy Leaver
Systems Development Consultant
Solution Specialists, Inc.
888.668.9193

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
_______________________________________________
Mod_mp3 mailing list
[email protected] http://lists.tangent.org/mailman/listinfo/mod_mp3