View previous topic :: View next topic |
Author |
Message |
vdborght
Joined: 09 Sep 2005 Posts: 14 Location: Belgium
|
Posted: Fri Sep 09, 2005 1:27 pm Post subject: Configurable headers |
|
|
Would it be possible to add configurable headers to the stream?
(Something like Apache mod_header does)
Ofcourse I can hack the source (and I will ) to create a one-time solution, but I'd like to see this part of the main branch so it becomes a more configurable solution useable for everyone.
Ofcourse you're now thinking: What the hell does this guy want?
Let me explain:
We're trying to play IceCast streams in Flash.
If you look around, you'll find other people have tried the same and got mixed results. In short, it works everywhere except in Internet Explorer.
Difficult to say if this is intentionally disabled by Macromedia or not, but that's the way it is.
However:
Inspection of HTML headers sent when playing an MP3 and an IceCast stream show some differences (obviously) and caused me to do some reasearch which shows that by tweaking the headers and using some flash code that intelligently handles the stream, you can do it.
Currently I've got a PHP page "proxying" the icecast stream and adding some headers on the way, but that causes an extra header to be added and the IceCast headers don't get interpreted correctly -- result is the bleeps & pops reported by users behind a corporate proxy that eats the headers _and_ quite some CPU consumption on the server that I can do without.
So -- the ideal solution is to tweak IceCast so it can be configured to send some extra header info and fool the Flash player.
If we can get this sorted out, I can publish a full howto and away we go to offer IceCast streaming to be embedded into any website. _________________ Regards,
Peter
TAATU - Create the World
www.taatu.com |
|
Back to top |
|
|
christocracy Guest
|
Posted: Tue Jan 17, 2006 5:40 am Post subject: How'd you make out with that? |
|
|
hey there. I'm interested in how you made out with that. I'm scratching my head trying to get embedded streaming to work for Win/MAC, FF/IE.
embedded mediaplayer with firefox plugin works great for me but not MAC, it seems. |
|
Back to top |
|
|
vdborght
Joined: 09 Sep 2005 Posts: 14 Location: Belgium
|
Posted: Tue Jan 17, 2006 8:33 am Post subject: Configurable Headers |
|
|
Hi,
So far I didn't get any reply from the Icecast team and haven't had the time to hack it in myself.
We're currently using FlashCOM for streaming, but since we're growing we soon need to look at using something else then FlashCOM because of cost.
I'll keep this list up to date as we go. _________________ Regards,
Peter
TAATU - Create the World
www.taatu.com |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Tue Jan 17, 2006 1:57 pm Post subject: |
|
|
The place to modify the headers is in the format.c format_*c files, but without knowing the specifics I can only guess.
karl. |
|
Back to top |
|
|
vdborght
Joined: 09 Sep 2005 Posts: 14 Location: Belgium
|
Posted: Tue Jan 17, 2006 1:59 pm Post subject: Configurable Headers |
|
|
Cool, I'll have a look there of the next weeks. _________________ Regards,
Peter
TAATU - Create the World
www.taatu.com |
|
Back to top |
|
|
Guest Guest
|
Posted: Mon Feb 20, 2006 10:08 pm Post subject: and the verdict is? |
|
|
So did this work out? |
|
Back to top |
|
|
Thierry Guest
|
Posted: Mon Apr 17, 2006 1:04 pm Post subject: icecast 1.3 |
|
|
Hello
Does anybody know of an icecast 1.3 streaming service ? Thanks |
|
Back to top |
|
|
EvilOverlord Forum Admin
Joined: 12 Jun 2005 Posts: 173 Location: Isle of Man
|
Posted: Thu Apr 20, 2006 2:49 pm Post subject: Re: icecast 1.3 |
|
|
Thierry wrote: |
Hello
Does anybody know of an icecast 1.3 streaming service ? Thanks |
for the love of god, why?!?! |
|
Back to top |
|
|
vdborght
Joined: 09 Sep 2005 Posts: 14 Location: Belgium
|
Posted: Tue May 02, 2006 4:43 pm Post subject: Success !!! |
|
|
Well, we finally found the time to hack it in and then when examining the code it looks like someone already added something into the main source tree, but -- for some reason -- put a content-length that is too high.
A quick cookbook for all of you out there:
On Icecast side
- Get the source for Icecast 2.3.1
- Edit format_mp3.c
- Search for "Content-Length"
(You'll see on the source comment that the code that's there is already
meant to handle the flash client)
- Replace the content-length that's there (3xxxx) by 200000000 (two-hundred million)
- Recompile
- Run!!!
On the flash side
Just open a sound object like you would any MP3 from a server.
Below is a small actionscript example. Paste this in your flash on frame 0.
----------------------------------------------
var globalsound = new Sound();
globalsound.loadSound("<PUT YOUR ICECAST URL HERE -- eg. http://mysite:8080/stream>",true);
globalsound.start(true);
stop();
----------------------------------------------
(Download an example flash file from http://www.taatu.com/download/PVA/pvplayer.fla)
Small word of caution
Because of this hack, the flash player will actually consider an icecast stream as a "regular" MP3 file -- this means it will play up to the specified length and then stop.
We've done a small calculation that learns that at 128Kbit, you should get about 1h45 of music out of a stream before it stops.
Ofcourse, it's a small job of writing a check to see that the music stops and reload it. _________________ Regards,
Peter
TAATU - Create the World
www.taatu.com |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Wed Jun 14, 2006 7:39 am Post subject: |
|
|
hey Peter,
thanks ever so much for posting these details, I've been pulling my hair out over the exact same issue. I knew it was possible but didn't know how.
I've asked my client to make the mods to their Icecast server. I was wondering if you could do me a favour and let me test a stream from your server in the meantime? It would allow me to show the client that it can be done.
Also would you be able for a couple of hours hired work in case the client needs help?
Feel free to email me privately if you don't want to share the server address:
stefan AT flashcomguru DOT com
It would help me tremendously.
Thanks
Stefan |
|
Back to top |
|
|
vdborght
Joined: 09 Sep 2005 Posts: 14 Location: Belgium
|
Posted: Wed Jun 14, 2006 8:54 am Post subject: Getting current song |
|
|
In addition to my post above, we also had the issue of getting to know what song is playing. Some music players can show this because they read shoutcast data in the stream, but Flash doesn't allow to do this and unfortunately the ezStream we're using doesn't send ID3 data which is compatible with Flash... so we needed something else.
After inspecting the status.xsl, I got the idea to change that to output XML and read the XML from Flash.
If you put the code below in a file and put that in your icecast "web" directory, it'll output an XML with all streams and the song that's playing:
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/icestats">
<root>
<xsl:for-each select="source">
<xsl:variable name="nameVal" select="./@mount"/>
<xsl:variable name="authorVal" select="./artist"/>
<xsl:variable name="titleVal" select="./title"/>
<stream>
<name>
<xsl:value-of select="$nameVal"/>
</name>
<author>
<xsl:value-of select="$authorVal"/>
</author>
<title>
<xsl:value-of select="$titleVal"/>
</title>
</stream>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
--------------------------------------------------------------------------------
Note: A big thanks to Mahesh for helping me out with the XSL
--------------------------------------------------------------------------------
Note to the IceCast developers:
A document describing the format of the XML data that IceCast combines with the XSL and the possibility to see the "raw XML" (without XSL applied) would be great! _________________ Regards,
Peter
TAATU - Create the World
www.taatu.com |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Wed Jun 14, 2006 9:04 am Post subject: |
|
|
hey Peter, did you see my post above?
thx
Stefan |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Fri Jun 16, 2006 1:58 pm Post subject: Hiya... |
|
|
One think you could do is pull the song title from the web page direct.
but still you may have a little sync problems |
|
Back to top |
|
|
vdborght
Joined: 09 Sep 2005 Posts: 14 Location: Belgium
|
Posted: Sun Jun 18, 2006 6:40 pm Post subject: |
|
|
Hi Abitar,
Actually, I'm doing exactly that.
But instead of fooling around and trying to parse HTML, I added my own XSL so the output is no longer the standard HTML "status.xsl" page, but an XML which is easily machine-readeable. _________________ Regards,
Peter
TAATU - Create the World
www.taatu.com |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Sun Jun 10, 2007 10:35 pm Post subject: Nice Post! |
|
|
Now i got it to work in IE,
but no sound in opera at all
Maybe someone knows the Content-length-maximum of opera? |
|
Back to top |
|
|
|