View Single Post
  #2  
Old 12-01-2009, 11:16 PM
Stream Recorder
 
Posts: n/a
Default

Re: Problem with flash player for Shoutcast radio: browser crashes (memory leaks)


I've always used Winamp or similar player to listen to Shoutcast and Icecast streams, so I didn't even know that the problem exists. Draftlight offers extensive information about the problem:
Quote:
Originally Posted by Draftlight
Server software such as Icecast and Shoutcast use a concept called 'client pull webcasting' (CPW). Normally to supply a continual stream of music for a web radio station or live feed, authors use professional streaming servers such as Flash Media Server. These send the audio data in a series of tiny chunks that are thrown away by the client as soon as they're played - which makes it more secure and avoids filling the listener's computer with megabytes of data. Professional streaming servers cost a lot of money, and for the amateur market Icecast and Shoutcast provide a cheerful low-tech solution - but CPW is not streaming. We know both systems use the word 'stream' a lot in their documentation, but a stream is something with tiny chunks and some intelligence at the server end to 'negotiate' the data being sent. Instead of streaming the data, CPW servers just send out a single MP3 file. A huge MP3 file. In some cases if your webcast is running 24/7, it's an MP3 file of infinite size! The server limits the download speed so (if it all works properly) there's just enough data downloaded per second to keep up with the playback. All this data is delivered by HTTP - normal 'web' protocols - but the problem is what to do with this vast file when you're listening!

Plugins for OS-level players like Winamp throw away the data every so often to avoid clogging your computer's memory - but Flash Player doesn't understand how to do this. When Macromedia was developing the sound engine for Flash Player many years ago, they didn't include methods to cope with very big files - people who wanted never-ending music went out and bought a streaming server like FMS! Flash Player understands 'regular' MP3 files - a few megabytes and with a known size and duration. When you tell it to collect something from a CPW webcast it has a whole heap of problems:
  • The file has no 'size' so you can't tell how the download is progressing.
  • There's no 'ID3' metadata showing when a track starts and finishes.
  • Flash Player can't see how much memory the listener's computer has - so it will try to store music until the computer crashes!
  • There's an outstanding bug in Flash Player 8/9 that gives an incorrect value for the amount of data downloaded when looking at Icecast or Shoutcast streams (which don't set the 'content-length' header).
  • If the listener pauses playback the web browser (not Flash Player) can keep downloading the file in an attempt to help out and cache the content. It will carry on sucking until it falls over.

There are many solutions to the problem with shoutcast streams when using flash player, for example:
http://www.longtailvideo.com/support...cast-Streaming
http://blog.madarco.net/44/memory-le...eams-in-flash/
http://www.draftlight.net/dnex/mp3pl..._explained.php
Reply With Quote