Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Icecast and Wimpy Player Not Working
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Listener Clients
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Tue Jul 31, 2007 7:10 pm    Post subject: Icecast and Wimpy Player Not Working Reply with quote

I'm using Icecast with the Wimpy Player and it works fine on every browser except IE7.

I've read through the following two threads:

http://forum.icecast.org/viewtopic.php?t=175
http://icecast.imux.net/viewtopic.php?t=2039

I've followed all the steps (got the source for Icecast 2.3.1, edited Content-Length in format_mp3.c, recompiled, and installed) and I still can't get it to work. I've also changed the IE7 security setting to be Medium instead of Medium-High.

I can see that the data is being streamed to the browser, it's just not playing. Does anyone have any more suggestions on how to get this to work?
Back to top
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Tue Jul 31, 2007 9:33 pm    Post subject: Reply with quote

I've yet to see any clear information on security with IE7 and plugins like flash. I can only presume that the problem is a restriction of security.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anonymous
Guest





PostPosted: Tue Jul 31, 2007 9:48 pm    Post subject: Reply with quote

Hmmm...this bites. Just to see, I added my URL to the list of safe sites and then set the security to low for that. It still doesn't work. I have a quick question about a comment in another post:

Quote:

3. flash .swf need to be stored on icecast web directory. Security restriction
like in the java to only open socket on the same host where applet is located.


This was a little bit confusing to me but I'm assuming this means that my .swf needs to be on the same domain as my Icecast web directory and not actually in the Icecast web directory. Is that a correct assumption?
Back to top
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Wed Aug 01, 2007 12:11 am    Post subject: Reply with quote

You may find that the browser will only permit access to the stream content from the plugin if you get it from the same place as the stream, which means the same host/ip and port.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anonymous
Guest





PostPosted: Tue Aug 21, 2007 1:41 am    Post subject: Quick Update Reply with quote

Just thought I would put an update on this thread for those that might be interested. Basically, I put some logging in the Icecast source code and it turns out that the following if statement was never getting executed:

Code:

    /* hack for flash player, it wants a length */
    if (httpp_getvar(client->parser, "x-flash-version"))
    {
        bytes = snprintf (ptr, remaining, "Content-Length: 250000000\r\n");
        remaining -= bytes;
        ptr += bytes;
    }


I simply removed the if statement and everything began to work on all browsers (including IE). Also, notice the length of the Content-Length. I used a higher value (3xxxxxxxx) and it didn't work then either.

I'm not sure my solution is great, but it works so I'll stop there. Just so everyone knows, here's what my code looks like now:

Code:

    /* hack for flash player, it wants a length */
    //if (httpp_getvar(client->parser, "x-flash-version"))
    //{
        //bytes = snprintf (ptr, remaining, "Content-Length: 200000000\r\n");
        bytes = snprintf (ptr, remaining, "Content-Length: 250000000\r\n");
        remaining -= bytes;
        ptr += bytes;
    //}


Thanks for the advice. Hope this can help someone else.
Back to top
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Tue Aug 21, 2007 2:40 pm    Post subject: Reply with quote

That would indicate that the useragent has changed, check the access log for what is actually sent. You should not be sending a content length for the stream as it's unknown but flash has traditionally needed it. If that useragent has changed then it won't get it anymore.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
scangwinnett



Joined: 04 Nov 2006
Posts: 14
Location: Dacula, Georgia

PostPosted: Fri Aug 31, 2007 12:42 am    Post subject: Reply with quote

karlH wrote:
That would indicate that the useragent has changed, check the access log for what is actually sent. You should not be sending a content length for the stream as it's unknown but flash has traditionally needed it. If that useragent has changed then it won't get it anymore.

When using Wimpy (and probably all Flash players) the user agent string that is sent is that of the web browser and isn't specific to Flash.

When using Internet Explorer a "x-flash-version" header is included, when using Firefox this header isn't sent. This "x-flash-version" header is what the code in format_mp3.c is looking for to determine when to send the Content-Length header.

I found a machine tonight in which the Wimpy player wouldn't play Icecast streams in Internet Explorer. The player connects to the Icecast server and begins downloading the stream data but it never begins playing it. I added some debug code to format_mp3.c and found that on this machine the flash player is not sending the x-flash-version header for some reason. Since the header is not being sent the Content-Length header is not being sent.

This machine is running IE version 6.0.2900.2180.xpsp_sp2_gdr.070227-2254 and the Flash player is version 6,0,88,0. The Wimpy flash player is supported on version 6,0,47,0 and later. I guess maybe the Flash player started sending this header in later releases.
Back to top
View user's profile Send private message Visit poster's website
scangwinnett



Joined: 04 Nov 2006
Posts: 14
Location: Dacula, Georgia

PostPosted: Fri Aug 31, 2007 1:23 am    Post subject: Reply with quote

I modified the function containing:

Code:
    /* hack for flash player, it wants a length */
    if (httpp_getvar(client->parser, "x-flash-version"))
    {
        bytes = snprintf (ptr, remaining, "Content-Length: 319324133\r\n");

        remaining -= bytes;
        ptr += bytes;
    }

so that, besides checking for the x-flash-version header, it also checks for "MSIE" in the user agent string and sends the Content-Length header if either is present.

After I made this change, the machine referenced in my previous post plays the stream just fine.

My change replaces:

Code:
    /* hack for flash player, it wants a length */
    if (httpp_getvar(client->parser, "x-flash-version"))
with
Code:
    int bMSIE = 0;
    char *tmp = httpp_getvar(client->parser, "user-agent");

    while (*tmp != 0 && bMSIE == 0) {
        if (strncmp(tmp, "MSIE", 4) == 0) {
            bMSIE = 1;
            break;
        }

        tmp++;
    }

    /* hack for flash player, it wants a length */
    if (httpp_getvar(client->parser, "x-flash-version") || bMSIE)
Back to top
View user's profile Send private message Visit poster's website
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Fri Aug 31, 2007 1:53 am    Post subject: Reply with quote

You could use the strstr function instead of the while loop. Can you confirm what the useragent is, I'm interested to see if it has anything in it that refers to flash?

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
scangwinnett



Joined: 04 Nov 2006
Posts: 14
Location: Dacula, Georgia

PostPosted: Fri Aug 31, 2007 2:32 am    Post subject: Reply with quote

karlH wrote:
You could use the strstr function instead of the while loop. Can you confirm what the useragent is, I'm interested to see if it has anything in it that refers to flash?

The user agent is "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" which is exactly what I see in my web server logs as well as in icecast's access.log.
Back to top
View user's profile Send private message Visit poster's website
scangwinnett



Joined: 04 Nov 2006
Posts: 14
Location: Dacula, Georgia

PostPosted: Fri Aug 31, 2007 4:17 pm    Post subject: Reply with quote

I discovered today that an additional header needs to be output anytime the Content-Length header is returned to keep a proxy server between the client and the server from caching what it thinks is an MP3 file.

While testing (from work, behind a proxy server) I discovered that after I closed the web browser containing the Flash player that the Icecast server still showed my client as being connected and that the Icecast error.log (with level 4 logging turned on) still showed data being sent to my client. I used a packet sniffer to verify that the PC that had been running the Flash player was no longer receiving network traffic. The proxy server in use where I work was attempting to finish downloading what it thought was an MP3 file so that it could cache it not realizing that the file would never end. After I modified format_mp3.c to output a header requesting that the "file" not be cached this behavior went away, now when the Flash player disconnects the disconnect happens immediately on the server side.

Here's my code now:

Code:
    /* hack for flash player, it wants a length */
    if (httpp_getvar(client->parser, "x-flash-version") ||
        strstr(httpp_getvar(client->parser, "user-agent"), "MSIE") != NULL)
    {
        bytes = snprintf (ptr, remaining, "Content-Length: 200000000\r\n");
        remaining -= bytes;
        ptr += bytes;

        // prevent proxy servers from cacheing what it thinks is an MP3 file
        bytes = snprintf (ptr, remaining, "Cache-Control: no-cache\r\n");
        remaining -= bytes;
        ptr += bytes;
    }
Back to top
View user's profile Send private message Visit poster's website
scangwinnett



Joined: 04 Nov 2006
Posts: 14
Location: Dacula, Georgia

PostPosted: Fri Aug 31, 2007 7:45 pm    Post subject: Reply with quote

I found another header that also needs to be output when Content-Length is being sent, an Expires header.

If I have a stream playing in a Flash player in IE 7 (I assume this "problem" exists in IE 6 as well) and the server goes down (or some sort of network problem occurs) the browser saves the portion of the MP3 stream that has been downloaded so far in the Cache directory. If the user presses Play to reconnect to the stream IE delivers to the Flash applet the cached audio instead of reconnecting to the server. After I added an "Expires" header with a date in the past Internet Explorer no longer caches the audio when the connection to the server is lost.

Here's my code:

Code:
    /* hack for flash player, it wants a length */
    if (httpp_getvar(client->parser, "x-flash-version") ||
        strstr(httpp_getvar(client->parser, "user-agent"), "MSIE") != NULL)
    {
        bytes = snprintf (ptr, remaining, "Content-Length: 200000000\r\n");
        remaining -= bytes;
        ptr += bytes;

        // prevent proxy servers from caching what it thinks is an MP3 file
        bytes = snprintf (ptr, remaining, "Cache-Control: no-cache\r\n");
        remaining -= bytes;
        ptr += bytes;

        // prevent Internet Explorer from caching the audio
        bytes = snprintf (ptr, remaining, "Expires: Mon, 26 Jul 1997 05:00:00 GMT\r\n");
        remaining -= bytes;
        ptr += bytes;
    }
Back to top
View user's profile Send private message Visit poster's website
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Fri Aug 31, 2007 9:08 pm    Post subject: Reply with quote

Now I'm just expecting an new version of IE to come out with a date problem

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
scangwinnett



Joined: 04 Nov 2006
Posts: 14
Location: Dacula, Georgia

PostPosted: Sat Oct 06, 2007 9:39 pm    Post subject: Reply with quote

I discovered that the code I included above was causing my server to crash every few days due to a client connecting that wasn't sending the User-Agent header.

The code below should be used instead of the code I posted previously:

Code:
    /* hack for flash player, it wants a length */
    char *psUserAgent = httpp_getvar(client->parser, "user-agent");

    if (httpp_getvar(client->parser, "x-flash-version") ||
        (psUserAgent != NULL && strstr(psUserAgent, "MSIE") != NULL))
    {
        bytes = snprintf (ptr, remaining, "Content-Length: 200000000\r\n");
        remaining -= bytes;
        ptr += bytes;

        // prevent proxy servers from caching what it thinks is an MP3 file
        bytes = snprintf (ptr, remaining, "Cache-Control: no-cache\r\n");
        remaining -= bytes;
        ptr += bytes;

        // prevent Internet Explorer from caching the audio
        bytes = snprintf (ptr, remaining, "Expires: Mon, 26 Jul 1997 05:00:00 GMT\r\n");
        remaining -= bytes;
        ptr += bytes;
    }
Back to top
View user's profile Send private message Visit poster's website
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Tue Oct 09, 2007 1:56 am    Post subject: Reply with quote

It has been reported that the lower content length size of 221183499 seems to work. The only change I would do to your patch is have the cache control header in the general headers section and leave the other two in here. I'll add it to kh22 so people can try it out

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Listener Clients All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber