I`m just developing an AIR project were the client needs to be able to synchronize big loads of data. So I thought it would be cool if the user can pause and resume downloads.
I first thought that this would not be possible but then i looked at the Adobe Media Player and he does it as well (Look into the Download Manager). The trick seems to be easy.
After a quick search through the Http specification i found out that you can write a custom header to use with the URLStream class. With Http specification 1.1 you can define a range of bytes you want to download so you don`t have to start from the beginning.
Here is how a sample Request looks like:
GET /files/richflv/help/ExportOptions.flv HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; en) AppleWebKit/420+ (KHTML, like Gecko) AdobeAIR/1.0
In Actionscript we can write a custom header like this:
var header1:URLRequestHeader = new URLRequestHeader(“range”,”bytes=”+currentBytesPosition+”-“+toRange);
var re:URLRequest = new URLRequest(downLoadURL);
currentBytesPosition = toRange;
This should work with most servers/files. To make sure it works you can first make a request and analyse the response header. It should include something like this:
I think you get the idea! This is pretty powerfull especially if you want to synchronize big chunks of binary data and the client closes the client in between.
On the next startup you can simply resume the download at the position were the client closed your AIR app. There are so many hidden goodies in AIR/AS3.0!
During the nights of MAX Europe i worked a bit on my wav mixer tool (now oficially called RichWav ;-)) and made some nice improvements.
You can now create multiple tracks and have a library of wav files that you just drag to a track. Every track can have multiple samples.
If you press play every track gets converted internally to a wav wich is embedded in an swf and returned to the Loader. This works pretty fast even for a lot of tracks.
The best thing for sure is that you can save the whole thing down to one wav on your harddisk. Just wanted to give an update to what i`m doing in my free time right
now as an excuse for not updating RichFLV to Beta 2. I did it already but need some tweaking – if one needs a Beta2 update of RichFLV very urgent let me know and i send you what i have so far
Finally here are my slides from my session about “Bits And Bytes With AIR”. You can get the Flex sample project here.
It shows you how to analyze an flv file and extract the sound data as an mp3 file.
The whole presentation itself is done in AIR. It might be a bit difficult to navigate.
You the cursor keys to go back and forward. Sometimes you can trigger animations or different states within one screen. You can do this with the Up and Down keys.
I know it`s not very userfriendly but i thought it would be cool to give a presentation about AIR in AIR 😉
The original reason i did it in AIR was that i was sick of my boring powerpoint presentations. I was really envious about all the people that could use keynote on their Macs.
So i build this little presentation tool with Flex and AIR with some funky transitions done with Papervision 3D. You can change the transition type with these keys:
– R = Replace
– B = Box
– S = Switch
– I = Inside Box
– N = None
Use those keys to change the transition types and then the cursor keys to actually switch the slides.
Below are some screens from the transitions. Is there still anyone thinking Flex is not as expressive as Flash? 😉
Because I was a bit late with submitting details about my talk at MAX in Barcelona i`ll do some advertisement here
I will show some examples (RichFLV, RichMP3, WaveMixer), some theoretical background (bitwise operators…), talk about IDataInput/IDataOutput classes and walk through a full example of how to analyze an flv and extract the sound data out of it as an mp3.
The main motivation to give this presentation is that I`m still fascinated how powerfull this stuff is. I`ve always been a Flash/Flex developer and therefore have never worked with really low-level stuff.
When i realized how much power you gain if you learn a bit of this dry stuff I knew it is worth the effort. So if you`re like me – an actionscript developer that until now never really had the need to learn the basics about bits and bytes come and join my talk on monday 10am-11am. Also I`m really nervous about speaking at MAX I put a lot of effort into this talk and want to have a full house 😉
I think MAX will really rock and i`m looking forward meeting all my heroes, especially Ty Lettau who in my opinion is the first real RIA designer out there. Be sure to catch his talks!
Got a lot of requests for a beta 2 update for RichFLV. I`ll do it next week – promised. I`m really busy working on my presentation for MAX.
After that you can expect updates for RichFLV, WaveMixer and i`ll finally release the code for RichMp3.
Hope to see a lot of you at MAX!
At the AIR Summer Camp in Belgium i had the honor to meet the Media Republic team from Amsterdam.
We had a great time in the jungle and on the battlefield.
The whole time i was envious about their cool custom made AIR shirts and now they`ve sent one to me in Berlin!
You guys rock big time! Thanks so much