-
I'm a seasoned Web Producer and Flash Coder looking for suggestions/feedback about streaming a large amount of audio. I searched for answers as best I could before posting this. If anyone can point me in new directions, or even better share some wisdom, I would appreciate it.
I have been asked to stream roughly 30 min of audio. It's a narration with background music and also some special effects. I am forced to stream it because there are sychronized animations to the audio. It must be as accurate as I can make it.
The audio will most likely be broken up into a few files, but the presentation must be seamless with no delay. Basically a 30 minute non-stop animated audio presentation. I am also assuming I must script a hefty preloader to buffer as much as I can to avoid dropping audio or frames. The delivery will be local but there is a chance to deliver from the web. This is what has me the most concerned.
Has anyone attempted streaming this much audio?
Can anyone share any precautions or tips to make this happen smoothly locally and possibly ways to convert it for the web?
I'm still playing with test-files and wouldn't mind sharing them... but who's going to be interested in dloading multiple sets of .swf's with 30min of audio!!??
Thanks again,
.8r14n
-
Streaming that length of audio isn't a problem over the net. I've streamed over an hour of music broken up into different songs at http://www.yourplayer.net.
The problem I see is with the 30 mins of animations and graphics. When streaming sound it is difficult to download anything else without causing skips and buffering. However prebuffering the graphic aspect of your presentation seems unrealistic.
Lets say you break up your prensentation into 5 minute chunks. Each chunk made up of one swf for streaming sound and one swf for the graphics. For best results each file should start with a blank stop command
These chucks will be handled by a another swf file. This is the shell for your presentation and it will handle all all the loading by monitoring the _framesloaded, _currentframe, and totalframes properties.
The first step will be to preload the entire first graphic swf. This can be loaded into a blank taget movieclip or any a level.
Once the graphics are loaded you can initiate the streaming sound file. This must be loaded into a level. Streaming sounds distort when not on a root timeline. Make sure your set the Sound Buffer Time property to zero. Since your streaming sound swf starts with a stop command this will best be handled through script. Simply monitor the _frameloaded of the level with the sound. Once 10-15 frames are loaded you can tell the level with the sound to play, and the target where you loaded the graphics to play.
Now here's the tricky part.
If your streaming sound is set to 16 bit compression it will download and stream just fine. In fact it will be completely downloaded between 1-2 mins before the first chunk of your presentaion is finished playing That is if your user is averaging a 4.0 kb/s connection speed.
In this time gap it might be possible to preload the next chunk of graphics.
If you monitor the streaming sound file to check if _framesloaded=_totalframes, you can then trigger the preloading of the next graphics file. This will need to be loaded into a target other than the one being used to currently play your presentation.
Once the graphics file is completely loaded you initiate the download of the next audio file into a new layer. Check it to see that that the first few frames are loaded like before, but don't tell it to play. This time the play action should be executed according to when _currentframe=_totalframes of the previous streaming sound.
If graphics file is small enough to preload in this gap, and still leave time to initiate the next streaming audio file everything should play smoothly by repeating this for each chunk. Once a chunk is finished playing it might be beneficial to unload the graphics and sound for that chunk to lessen the RAM load of your presentation.
Jason
-
Thanks jason. I understand what you're saying. I was just curious if anyone knew any pitfalls to avoid.
I suspected that all graphics would need to be loaded before I began loading and streaming the audio.
The graphics are in about 30 parts ie: 30 individual files loaded my a group of files I like to call an Engine (I think you referred to it as a Shell), I can chop the audio into 30 parts too, but I'm trying to avoid any stops in the audio. It needs to be clean as if it were playing a track from a CD or something.
I already thought about keeping the audio as one 30 min file a stream it at a different level, but it just seems too large (memory) to deal with in the player.
My next guess was to chop the audio file into parts. If I chop the audio into smaller parts and preload them with a stop action on the first frame to prevent them from playing until I need them, How accurate can I trust the movie timeline to show me when to script the next audio file to begin playing? Im assuming I will always be using the STREAM setting when I add the sound to the file.
Thanks again!
.8r14n