5 Replies Latest reply on Jun 4, 2007 1:33 PM by kglad

    How to stream sound in AS3

    GrouchoKen Level 1
      In AS2 you can stream a sound by using s.loadSound("mysound.mp3",true) where the second parameter of loadSound indicates that you want the sound streamed.
      How do you do this in AS3?
      Thanks for your help.
      Ken
        • 1. Re: How to stream sound in AS3
          kglad Adobe Community Professional & MVP
          your sound will stream.

          you can use the bufferTime property of the soundLoaderContext class and use your soundLoadContext in you sound's load() method to control the length of buffering before streaming begins. by default bufferTime is 1 second
          • 2. Re: How to stream sound in AS3
            GrouchoKen Level 1
            Thanks for your quick reply. Are you saying that using
            s.load("mysound.mp3") will automatically stream?
            I see that soundLoaderContext class can control the buffering, but what causes the streaming to occur?
            • 3. Re: How to stream sound in AS3
              kglad Adobe Community Professional & MVP
              yes, your sound will play (as soon as the amount of buffered data has been downloaded) when you execute your load() method (as long as you execute your sound's play() method after the load() method).
              • 4. Re: How to stream sound in AS3
                GrouchoKen Level 1
                Thanks. I really appreciate your answer.
                My last question is what exactly makes a sound stream or not stream? How do you control that?
                • 5. Re: How to stream sound in AS3
                  kglad Adobe Community Professional & MVP
                  when you execute your load(), the sound file begins to download. that will continue unless you execute a close() method.

                  your sound will begin to play when you execute your your play() method or after the bufferTime has been met, whichever occurs later.

                  the real question is how do you prevent streaming in as3. and that's easily done by using the sound's complete event to trigger the play() method. if the play() method is executed before loading is complete AND bufferTime is less than the load time, your sound will stream.