A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 29 of 29

Thread: Buffering Streaming Dynamicly Loaded mp3's?

  1. #21
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289
    As soon as it loads enuf to play (buffer), it will play. There's many variables that you're dealing with if you're just starting out with these new sound possibilities in MX. One example, like 'iaskwhy' was saying is to control them better using MC's. You can control each sound individually and have as many as 8 sounds going at once (if that's your thing). Fading, starting, stoping can all be controlled now dynamically. Along with duration, position and specific load information can all be achieved.
    Regards,

    Ron

  2. #22
    Junior Member
    Join Date
    Feb 2003
    Posts
    19
    hahaha... I have to be one dense mofo, because this is what I did step by step.
    Open Flash MX
    created an empty movie clip
    placed the clip on the main movie
    on frame one added the following code:
    _root.onLoad = function() {
    loadMovie ("mysongname.mp3", "_root.placeholder");
    mySound = new Sound();
    mySound.loadSound("mysongname.mp3", true);
    }

    only thing i changed was mysongname to "music.mp3"

    exported it.
    Made sure the mp3 file was in the same directory and heard silence....lol

    in advance thank you for the patience, I am usually not this dense, but I do have my moments

  3. #23
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    rhosk, Sorry I forgot to mention. I tried that buffering thing, and looked it up in the flash reference. It does say that the buftime is in seconds. I tried it though, with this code, and it didn't seem to matter. The sound still started as soon as enough had loaded to start playing. And I think that is controlled in flashplayer, which knows the connection speed. So, whatever the connection, the sound will always load just enough to start playing without hesitation. I have tested this idea with a few frineds connections, and it seemed to work just that way.

    A sound inside an swf will also stream when you load the swf. I got away from using that, partly because I don't have the need right now, and partly because doing it with load sound, I don't have to have a timeline, or the swf.

    But, you loose the looping unless you use an onSoundComplete and just load it again. That won't work for a true loop type sound, as there will be a pause between plays.

  4. #24
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289
    craigblitz, do this if you want to just hear that mp3.

    Frame 1
    mysound = new Sound();

    frame 2;
    mysound.loadsound(music.mp3, true);

    Guaranteed it will play. This is a "global" sound object.
    Regards,

    Ron

  5. #25
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289
    iask, of course it's seconds (buftime). I've tested these theories out also and try putting your framerate at 5 fps, then again at 25 fps. It makes a difference for stream (on slow connections). Flash somehow uses that timeline reference (not an expert, just played around with it). I had my buftime at default at first (5), then check it on a 33k connection, very bad! Increased it to 20 and it was gtg. Even if the player is stopped, it's still using your frame rate for reference and time sensitive issues. Maybe someone can elaborate.
    Regards,

    Ron

  6. #26
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Ah... I never tried it at a slow frame rate. In fact, I think I always had it at 40. Never had a problem on 56K.

    Thing about first frame sounds is, there is always going to be a wait, before it starts. Either because of a preloader, or because enough frames must load, any way you load it, before it will play. Add components or other sounds that load in first frame, and you add to the lag time.

  7. #27
    Junior Member
    Join Date
    Feb 2003
    Posts
    19
    hey guys thank you so much for the help.. I have discovered that there must be something wrong with the music file I was trying to use. I tried the techniques with the other things and what do you know no problems. Thanks for the patience and the help.

  8. #28
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289
    Yeah, watch your "bitrate" for mp3's. Flash won't take anything over, [I believe] 128K. Could be 164K, can't check right now. You don't need anything higher than @96K anyway (inaudible diff's).

    But hey, no prob. Took me awhile to learn some of this sound stuff; trial and error and I'm still learning. iask, nice converse. I think we all learned a little something.
    Regards,

    Ron

  9. #29
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Yeah, it's great to discuss this with others. MX is still so new that I don't think anyone yet knows all that it can do. And sounds is admittedly, one of the sore spots in flashplayer.

    Bitrate is one thing, but there are more than one flavor of mp3. I found you can test almost any sound file in windows sound recorder. Open C:\WINDOWS\Sndrec32.exe and then the file, and if it plays, it's not corrupted. From there, you can convert it to a number of different formats, at least one of which will play in flash. I didn't keep notes, so... In sndrec, there are all kinds of ways to convert or edit sounds. Unless you already have a sound editor, give it a try. It's amazing what it can do.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center