Archive for July, 2005|Monthly archive page
Making NetStream a Flash Object Citizen
I was getting ready to write my own preloader class for a project recently and came across Moock’s “Petition to Macromedia: Better Preloading API” from way back in 2003. This led to Ralf Bokelberg’s LoaderClass, which led to erixtekila’s LoaderQueue, which led to Bryan Ledford’s AS2 implementation of that class. (At least I think that’s how the credits go.)
Started working with it and it seemed like a fit. SWFs? Check. JPGs? Check. Sounds? Check. FLVs? DOH!
FLVs break the system. Turns out that FLV’s would probably break any system used to preload other file types such as SWFs, JPGs and Sounds.
Why? Well it turns out that NetStream does not have the getBytesLoaded() and getBytesTotal() methods which is common to the MovieClip and Sound objects. NetStream definitely has the properties bytesTotal and bytesLoaded. Why Macromedia would chose not to include those functions is beyond me. Maybe it’s because NetStream is intended primarily for streaming and not preloading? I mean you can’t even use the progress component with it. (Well you can, but not using the same techniques as the other objects).
Dealing with FLV files involves using three objects: NetConnection, NetStream, and MediaDisplay. You can kind of think of NetStream as your FLV object since it is the object that you will address when downloading and playing the video file. The NetConnection just facilitates the connection to the server, and the MediaDisplay gives you a surface to display the video on – you can actually play the FLV/NetStream without it but you’ll only get sound. To preload a NetStream object, you need to call myNetStream.play(myUrl) followed immediately by myNetStream.pause(). This will get the file streaming.
The solution to the missing getBytesLoaded()/getBytesTotal() problem is a really simple extension of the NetStream class. In my case I called it com.dm.DMNetStream. Now remember I said this was really simple.
class com.dm.DMNetStream extends NetStream {
function DMNetStream(nc:NetConnection) {
super(nc);
}
function getBytesTotal():Number {
return bytesTotal;
}
function getBytesLoaded():Number {
return bytesLoaded;
}
}
Now just instantiate the com.dm.DMNetStream class instead of the NetStream class and you’re laughing!
I sumbitted the modified QueueItem class to Bryan Ledford so hopefully he’ll implement and post it soon. But if you want to add it you need to add a couple of lines to the LoaderItem class’ load() method:
(after the loc.loadSound.apply line)
…
else if( typeof( loc.setBufferTime) == ‘function’) //flv (NetStream Object)
{
loc.play.apply( loc, [sUrl].concat( aArgs));
loc.pause.apply(loc, null); //pause will continue download but not start streaming
} else
…
Remember this code has not been implemented in an actual deployment your mileage will vary!
Intown Atlantacast #2!
Just posted Intown Atlantacast #2. Gotta still set up www.intownatlantacast.com and figure out how to do the xml feed and crap and post to iTunes and the other agreggators but I had some stuff to say to I went ahead and did it.
Here it is: IAC_02_2005_07_24.mp3 (17:51). Music by The Plugz. I still have to figure out the podsafe music bit, but hopefully with 15 secondish clips and the fact that Better Luck has been out of print for 20 years or so I’m safe.
More talk of Infill, Mary Norwood, One Midtown Kitchen, Taka Sushi Cafe, AudioMulch.
Served by Advertising.com?
I really sucks how much web pages rely on advertising. Then again, I realize that advertising helps keep many of our browsing experiences free.
Apparently cnn.com and allmusic.com are using advertising.com to serve up ads on their sites. Maybe it’s a browser problem, but when a site has a “servedby.advertising.com” loading problem their pages DO NOT load whatsoever.
As I mentioned in a previous post I’m digitizing my CD collection and cross-checking the information from the CDs and iTunes/Gracenote to AllMusic. Well thanks to servedby.advertising.com the waits were horrendous. Checked cnn.com and apparently they use the same service because their pages weren’t loading either. I also scanned with AdAware just in case – nothing. Sucks cuz after a while I just quit.
WordPress Comment Question
So I’ve got my WordPress blog going, but I haven’t had time to address a couple of things, one being rss feeds per category and one being the comment submisison form. Does anyone know how to require a name and email and/or site url?
Brent
I’m Tired of CDs and iTunes
I’m sick of dealing with CDs and not having music where I want it. So I’m currently encoding them all paying strict attention to song, artist, and album names since I’m picky like that. They’re all getting encoded onto a 200 GB external drive at 192 AAC. Yes I’m using iTunes for Windows to do the encoding, but I really hate how iTunes organizes stuff so after I’m done, I’ll start using WinAmp for local playback. I’m hoping to find a good network audio device (any suggestions?) to use to distribute the audio to Joyce’s office and I’ll use TiVo to playback in the living room. Sonos looks really cool but a bit too expensive for my blood.
On a similar note, I’ve resolved to never buy anything from iTunes again. While I’m tired of CDs, I still like the idea of having the physical packaging around. I also like to be the one to determine the quality of the AAC files that I create from them. iTunes is tempting because of the instant gratification it can give but…must…resist….
Intown Atlantacast and WordPress
Well I finally did a lame-o podcast. The concept is still in the works. I’m thinking about calling it Intown Atlantacast. I’ll concentrate on Intown life in Atlanta, dining, live music, neighborhood issues, etc., but I’ll also probably talk music and tech as well. Here’s the initial podcast. Hopefully limiting my music clips to 15 seconds will limit my liablility on music front. I reviewed a local restaurant, Pura Vida, and talked about infill housing issues.
In doing research on how to post a feed for the podcast I started looking at WordPress. I’ve been unhappy with MovableType for some time and the installation of WordPress is approximately 1000% simpler than MT. Hopefully it’ll work for me. The only thing I have to do now is straighten out how to handle RSS feeds.
Let me know what you think!
OT: Archiving Dilemma
I know, wrong forum, but I’m trying to clean off a 200 GB drive and I have a 12 GB video file I need to archive and I’ll be damned if I can’t figure out how to split the file between multiple DVDs. Would be nice if there was something that might work to restore the file five years down the line.
Any suggestions out there?
Comments (7)
Comments (2)
Comments (1)


