0 Replies Latest reply on Apr 16, 2008 3:13 PM by lorenz.fischer

    How to flush the loaded bytes of a Sound object

    lorenz.fischer
      Hi all,

      I've now been looking for a solution to my problem for quite a while now, but so far without any success, so I thought I'll give this forum a try.. maybe someone in here can help ;-)

      Ok here's the deal: I'm trying to create a simple audio player in flex that is able to play mp3 audio streams. I'm not looking for a solution that works with an FMS (Flash Mediaserver) and I do also not need code that shows me how to play a remote mp3 file (which of course is also some sort of streaming streaming). I have an icecast internet radio server which is streaming a constant flow of mp3 encoded data. I can connect to that stream with standard media players like winamp or mplayer.

      I've been playing around with the URLRequest-SoundLoaderContext-Sound-SoundChannel-combo and tried many different combinations, but somehow the Sound object won't let go of the bytes it already played. The Sound.bytesLoaded will just keep increasing and my memory will just keep being eaten by the Flashplayer. Is there any way to free that memory again without having to destroy the Sound object? Or if I have to destroy it, how do I make sure that the user doesn't realize that I just switched the old Sound object with a fresh and empty one?

      I was also trying to get a NetConnection-NetStream-combo to play my stream, but here I failed even sooner: Even though the NetStream seems to be receiving the data from my server (Firefox states that it is receiving data after I invoke NetStream.play(url_to_stream)) I'm not able to get that data to come out of my speakers. I just can't hear anything :-(

      I'm pretty new to flex, as and flash, so please forgive me my ignorance ;) I really tried to figure this one out for about 3 days now..

      I'd be very grateful for any hints or advice :-)

      cheers,
      Lorenz

      Edit: oh yeah right: I don't know if this is too obvious, but I'm using flex3 :-)