A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [F8] Streaming sound still takes forever to load in a website

  1. #1
    Junior Member
    Join Date
    Jan 2007
    Posts
    17

    [F8] Streaming sound still takes forever to load in a website

    I've been using Flash for a while, but I just recently started working more with sound and web publishing, and I'm a bit confused...

    I'm working with a file in Flash 8 using the screens mode. I added a voiceover to it by breaking up the original audio file into pieces that matched each slide, then importing them seperately. The audio files all together total about 1.5MB.

    I've set each file to the stream mode, but when I try to view it on the web it takes a very long time before it starts to play. I thought streaming meant everything didn't have to be downloaded before playback began?

    If it has anything to do with it, I also have a controller that allows the viewer to play, pause, or go to previous or next slide.

    I'm really confused and need to get this file to load faster on the web. I'd really appreciate any help you could give!

    EDIT: The sound files are all MP3s that I set to the lowest bit rate I could with Flash before they sounded unacceptable...the final SWF file is around 1.8MB.

  2. #2
    FK's Official Mac Hater jasonsplace's Avatar
    Join Date
    Mar 2002
    Location
    Provo, Utah
    Posts
    2,245
    Those are fairly large files for a website. Someone on a broadband connection shouldn't have any problem but that is going to take several minutes on dial-up or other slower connections.
    Jason L. Wright
    I'm not that hard to imitate. Just make some random negative claim at Apple or anything else for that matter and then have nothing to back it up.

  3. #3
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    Really? It takes a while to load on my broadband connection as well...

    Do you know of a way to compress the sound further without losing too much quality? Or another way to make it smaller? I have a few bitmaps in there, and the audio, but the rest is just text and simple graphics I drew in Flash...

  4. #4
    FK's Official Mac Hater jasonsplace's Avatar
    Join Date
    Mar 2002
    Location
    Provo, Utah
    Posts
    2,245
    For the Flash try reducing the bitmap quality. Usually 80 looks the same as 100 but i've even been able to take a few down to 35 or 40 if the bitmaps weren't super detailed. Also, what is the audio of? If it's just narration you can probably do mono instead of stereo and that will cut the size in half.
    Jason L. Wright
    I'm not that hard to imitate. Just make some random negative claim at Apple or anything else for that matter and then have nothing to back it up.

  5. #5
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    I have the audio on mono already, but thanks for the tip. I'll try playing around with the jpeg quality some more as well.

    Otherwise, I'm gonna try converting the movie part to a FLV and embedding it in a flash with just the controller. But I'm worried that some users will try to fast foward before the entire movie is loaded...

  6. #6
    Junior Member
    Join Date
    Jan 2007
    Posts
    17

    bitmap quality

    When I lowered the JPEG quality from 80 to 40, and the file size almost doubled! All of the other settings were the same... Why did that happen?

  7. #7
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    Also, is there anything special I need to do when I put it on the website to make sure it's streaming correctly for people?

  8. #8
    FK's Official Mac Hater jasonsplace's Avatar
    Join Date
    Mar 2002
    Location
    Provo, Utah
    Posts
    2,245
    I've never heard of filesize doubling from lowering the graphic quality. That doesn't make any sense to me. The best way to see if it's going to work for people is to test it on a few different machines.
    Jason L. Wright
    I'm not that hard to imitate. Just make some random negative claim at Apple or anything else for that matter and then have nothing to back it up.

  9. #9
    Knows where you live
    Join Date
    Oct 2004
    Posts
    944
    It depends on how you are streaming the sound. The stream setting in the properties manager doesnt actually stream, it just means that the sound is in sync with the timeline. To properly sync a sound, you need to load it using actionscript.
    The greatest pleasure in life is doing what people say you cannot do.
    - Walter Bagehot
    The height of cleverness is to be able to conceal it.
    - Francois de La Rochefoucauld

  10. #10
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    Oh! I didn't know that....that's the problem then!! I know almost nothing about actionscript... I'll look in a book I have and see if I can get it to work.

    Thank you!!!

  11. #11
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    Sorry, but do you know what the code is to stream the sound? I'm trying to find it online and in some books I have, but everything I'm finding just says to set the audio to stream in the property box.

  12. #12
    Knows where you live
    Join Date
    Oct 2004
    Posts
    944
    var sMusic = new Sound (_root.someMovieClip); //You need to give a movieClip as a parameter. Just use any random empty movieclip. Each sound needs a different one

    sMusic.loadSound ("Song.mp3",true); //The "true" represents the stream setting. It will commence playing as soon as the sound is loaded.

    From the help files:
    Code:
    my_sound.loadSound("url", isStreaming)
    
    Parameters
    url The location on a server of an MP3 sound file.
    
    isStreaming A Boolean value that indicates whether the sound is a streaming sound (true) or an event sound (false).
    
    Returns
    Nothing.
    
    Description
    Method; loads an MP3 file into a Sound object. You can use the isStreaming parameter to indicate whether the sound is an event or a streaming sound.
    
    Event sounds are completely loaded before they play. They are managed by the ActionScript Sound class and respond to all methods and properties of this class.
    
    Streaming sounds play while they are downloading. Playback begins when sufficient data has been received to start the decompressor. 
    
    All MP3s (event or streaming) loaded with this method are saved in the browser's file cache on the user's system.
    There is also a function that is called when the sound is loaded:
    sSong.onLoad = function () {
    trace ("Sound is started");
    }

    I have no idea if the streamed sounds set off the onLoad.

    Final code:
    Code:
    var sMusic = new Sound(_root.someMovieClip);
    sMusic.loadSound("Song.mp3", true);
    sSong.onLoad = function() {
    	trace("Sound is started");
    };
    The greatest pleasure in life is doing what people say you cannot do.
    - Walter Bagehot
    The height of cleverness is to be able to conceal it.
    - Francois de La Rochefoucauld

  13. #13
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    Thank you so much! I have to upload the audio files to the server but then I can try this.

  14. #14
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    Thanks! It worked great...except now I can't pause and resume the audio like I could when it was embedded in the swf. Now when I press the pause button, only the visuals pause, and the audio keeps going...is there any way to be able to pause and resume the sound when it's set up with the code above?

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