Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7006541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:29:27+00:00 2026-05-27T21:29:27+00:00

I have some audio files on my http server, and I would like to

  • 0

I have some audio files on my http server, and I would like to write a Flash client in ActionScript3 to load those audio file and play them smoothly. Of course I can just create a Sound object and load it by .load() with a URL request. But for saving the bandwidth, I prefer to load audio file chunks on demand. For example, there is an audio file let’s say 100MB. If we try to load as fast as possible when user open the page

<--------- 100MB ----------->

The downloading may finished within minutes, but let’s say, if user stop listener in halfway, that’s kind of waste to load whole soundtrack at first.

<--------- 100MB ----------->
   ^--- user may stop here

To solve the problem, I think it’s better to split the big audio file into small chunks, load and play them on demands.

<--- 10MB ---><--- 10MB ---><--- 10MB ---> ...
                                     ^--- user current position

I want to design the player, let it load audio chunk by chunk, and only load it when it’s near the end of current chunk.

Here comes the question – How to load those chunks and play them smoothly? I can probably create Sound object for each chunks. But how to play them seamless?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:29:28+00:00Added an answer on May 27, 2026 at 9:29 pm

    You probably will want to use SoundChannel, and see the example there, and the tutorial. Once you get a sound loaded, you can play the sound, store the position, and get the length to find out the time left to play. From there, probably dispatch an event to load up the next sound. Derived from the second example (you will have to put it your class structure):

    // Note that you will need some type of sound management 
    // class to listen to events and to play the series of sounds.  
    // That is not documented here.
    
    import flash.events.Event; 
    import flash.media.Sound; 
    import flash.net.URLRequest; 
    
    var snd:Sound = new Sound(); 
    var req:URLRequest = new URLRequest("sound1.mp3"); 
    snd.load(req); 
    
    var channel:SoundChannel; 
    channel = snd.play(); 
    addEventListener(Event.ENTER_FRAME, onEnterFrame); 
    channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete); 
    
    function onEnterFrame(event:Event):void 
    { 
        var estimatedLength:int =  
            Math.ceil(snd.length / (snd.bytesLoaded / snd.bytesTotal)); 
        var playbackPercent:uint =  
            Math.round(100 * (channel.position / estimatedLength)); 
        if( playbackPercent > 75) 
            loadNextSound();
        trace("Sound playback is " + playbackPercent + "% complete."); 
    } 
    
    function loadNextSound() 
    {
        // In whatever sound manager class you create, 
        // listen for this "loadNextSound" event, 
        // and start the next sound loading when it occurs.
        dispatchEvent(new Event("loadNextSound"));
    
    }
    
    
    function onPlaybackComplete(event:Event) 
    { 
        trace("The sound has finished playing."); 
        removeEventListener(Event.ENTER_FRAME, onEnterFrame); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to stream some audio files I have on my server to an
I am using AVAudioplayer to play some audio files. I have some controls like
I have an application that will record and play audio files. Some of the
I have some audio files saved under the Documents directory. I just want to
I'd like to protect some audio files I'm streaming. I can live without being
I would like to create some instruments for Android using generative audio. I really
I have some audio files of different types -- .mp3, .amr -- saved on
I have an interesting question today. I need to convert some pokemon audio files
Have some audio and video files that users are to download, however depending on
We have some raw voice audio that we need to distribute over the internet.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.