How AIR should NOT be used

Just checked out the Shu player. It`s an application that packages your AIR application as a standalone application and extends it`s functionality a bit.
This might sound intriguing first but it really only shows how people are not getting the advatages of AIR. Why is this a bad solution?

  • standalone means the AIR runtime is packaged into your app which bloats the installation size. This is one main advatage of AIR. You install the runtime once and then all the AIR apps are small in size
  • You`ll loose the smooth seamless installation functionality of AIR apps
  • What about autoupdate?
  • What if the runtime updates?

In the end this is nothing more then the good old projector tools and I think if you want something like this there is nothing better than Zinc 3.0.

That said I kind of understand the motivation behind this tool. On the first glance it adds some of the most missing features to AIR mainly being able to run native programs.
But as it at the same time destroys the real power of AIR this is a no go for me. Keeping thumbs crossed that AIR 2.0 soves this by adding those features.

The game is on: Parleys to switch from Flex to JavaFX to GWT to Flex to JavaFX to GWT to JavaFX…

… to Flex (had to make sure it ends on Flex ;-)) We`ll see who`ll win the game. This is actually a really cool use case. Stephan Janssen my current client is actually crazy enough to let develop three versions (if you count the current Ajax version it`s 4) of his famous parleys website. I`m currently developing the Flex and AIR version of it and I`m certainly biased as to which version i`ll prefer but from a technology point this is a really cool approach. I mean everyone is telling us that their technology is the best. Sun with JavaFX (mhhh), Google with GWT (mhhh) Adobe with Flex (yeah baby!) and now taking away all biased opinions we`ll actually be able to judge about the result rather some marketing material. We`ll see the exact same app build on top of those three technologies. I must admit that sometimes I have a hard time when my client pings me saying that there is a new feature in the JavaFX version that really rocks. But at the same time it motivates me to make the Flex version even better. I`m right in the war! And at the same time it`s also for me a great opportunity to compare those different approaches. But for all you Adobe people out there be warned you might be in the pole position now but others are catching up – well i believe it will stay like this for a looooong time 😉

The moment JavaFX and GWT are at the level of Flex/AIR Adobe will also have made some steps – that`s what I`m counting on and I hope that challenges like these will also motivate them to push even harder (also I think they are curretly doing agreat job at this :-))

We`re not quite ready to judge about the different versions yet as all of them are not ready. Currently you can see these versions:

– old Ajax version which

– Flex beta client (

– Flex AIR client (you can get it through the Flex client or download here )

I`ll post my views about this here as the development continues and make sure to post things that are only possible with one or the other technology as for me this is the most interesting part.
I`ll just start with some hints for Adobe what i think might become a downer for the Flex/AIR version :-) (vote,vote,vote!!!)
– allow the socket class to listen on ports to allow p2p functionality!!!
– Allow access of bytes from NetStream and Sound Objects
– Screensharing for at least all Media Server users

These are all things where maybe the JavaFX version will have advatages but mhhh maybe when they finally (if ever) finish JavaFX we`ll have this in Flex too 😉

Hey Adobe,Sun,Google this is not a game it`s a war let`s flood us developers with features :-)

Some interesting thoughts about this here.

Doing partial/resumable uploads with AIR

This post by Ryan Stewart motivated me for a little example with sockets in AIR. I wanted a way to upload files to a server with the possibility to interrupt uploads at any time and pick them up later.
So to do this I thought it would be cool if it works like streaming video to the client but just the other way around. I developed a mini protocol to do this. It works like this:

1. Client (AIR app) establishes a socket connection to Server (Java based in my case)

2. If connection is succesful client send a request which looks like this: 1 byte = operation type 1, length of the body, filename to upload as UTF bytes

3. Server checks if the file with the given filename already exists if so it responds with 1byte = operation type 1, a long (64bit) value which is the size of the file on the server or 0 if it does not yet exist.
4. Client send a package from the file starting at the size of the file on the server: operation type = 2 (1byte), length of body = length of the package, bytes of the package

and so on and so on… You get the idea.

With this mechanism the upload can be interupted and picked up any time. The client and the server always know what`s happening and were the bytes belomg to.

Warning! This is a very very over symplified, incomplete example. No real error handling, no handling for multiple clients, security?…
It`s just a prove of concept. I`m not a java developer and only hacked this together very quickly. The source is really ugly and normally I would not post something like this but as I always promise to clean up everything and post later (and rarely do ;-)) i just post them here so you can get the idea and build something sophisticated out of it.

Here is a screencast that shows the app in action.

Get the sources (again really dirty sources only use for inspiration)

Don`t even think about buying Flex Builder standard edition!

I was just working on some performance improvements for parleys while I encountered a big memory leak.
If you run into problems like these (and you will sooner or later :-)) Flex Builder professional saves your day. The profiler alone is worth every extra penny.
Not only should you take care to use weak references with listeners but also watch for your Bindings. If you use the Binding tag their is no way to remove the reference and therefore your objects will never be ready for garbage collection. So i get used to replace my binding tags to ChangeWatchers which gives me the ability to unwatch them.   With the profiler it`s really easy to find and fix performance and memory issues like these. I was able to reduce the memory usage by 2/3 in 30 min of work.
These otpimisations are not yet in the current parleys beta version (will be next week) – so watch out for the difference :-)

So please do yourself a favor and don`t be stingy – get yourself the full monty and buy Flex Builder Pro!
Espacially if you`re a dirty hacker like me Flex BuilderPro will help you improve your skills 😉

Stitch Flv files with RichFLV

In my last post about the RichFLV AIR 1.0 update I forgot to mention the biggest new feature :-)
You can now stitch together flv files! It`s not really implemented in the most comfortable way and the feature is not really tested but for most cases it should work.
In the file menu you`ll have a new option Import > FLV (stitch). This will import a new flv to the flv currently in RichFLV and stitch them together.
Check out this screencast to see how it works.

Again this is not deeply tested so be carefull and let me know if you run into problems. Some of my observations are:

– different fps might give audio sync problems

– different resolutions work!

– different codecs work

Let me know what results you get. This is a feature i will implement in RichFLV NextGen in a much better way so your feedback here will really help me make this cool.



Get RichFLV for AIR 1.0  + See the new feature in action

[kml_flashembed movie=”” height=”180″ width=”217″ fvars=”appname=RichFLV&appurl=” /]

My take on sequencing Cairngorm events

I`m working with Cairngorm in nearly all of my projects and I like it because it somehow forces me to work structured. But there are some things that I don`t like or don`t get. For example sequencing of Commands in Cairngorm is done by subclassing SequenceEvent and putting all the logic for which event comes next directly into the Command itself. By doing so the command looses a lot of reusability. What if I want to use the same command outside of a sequence chain?
I would have to code two commands – one for the sequence and one that lives on it`s own. The other thing is that when i fire a cairngorm event from my view i have no way to know when the corresponding command is done. Only way would be through some sort of state variables in my model that keep track of the process. I believe that this approach is quite fragile because sometimes you might have to commands of the same instance running and you`ll never know which of same changed your model. And a model with hundreds of state variables just doesn`t look clean to me.
I lived with all these problems for some time know and never really thought about forking the original cairngorm framework because I like to work with the original framework to be safe for future changes.
But now I just can`t live with these problems anymore – so here is my first try into improving this stuff.
Continue reading

Adobe Premiere in AIR…

… not really 😉 but it`s impressive how far one can get in a few hours.
In this new version it`s now possible to edit multiple flv files and multiple mp3 files and combine them to one flv.
The binary stuff works pretty well but my main problem is the internal preview. It`s really difficult (impossible???) to play flvs and audio files and synchronize them.
Any suggestions?
So the solution for now is that everytime one clip is cut or the audio changes i create a new flv file in memory with all the changes applied and load that back into the preview.
Sure this takes some seconds and gets harder the bigger the files are but still it`s not that bad and you`ll get 100% accuracy.

Check out my screencast of the current progress here


Next Generation RichFLV preview

I`m currently loaded with exciting work so i rarely feel the need to work on my private projects like RichFLV. But today was one of those days.
While making RichFLV more stable i started working on a completely new version. One of the needed features is support for editing multiple flv files.
I want to be able to import some flv files and stitch them together and even edit and cut the individual clips and later export them to one single flv file.

Well it`s working! Have a look at this feature in this very early preview screencast I made. Don`t worry this is not how RichFLV will look like it`s just a dummy to test the functionality 😉
I think it`s really crazy that you can do stuff like this with AIR – it just rocks!

A basic implementation will be added to the current RichFLV next week (or so :-)). You`ll be able to import another flv and stitch them together but without the advanced control of individual clips.

Watch the screencast here

this is how the new timeline looks:


RichFLV for AIR Beta 3 released

I made a quick update to RichFLV. It should now work with Beta 3 of AIR.
Haven`t really had the time to make lot of bugfixes so let me know if you need something fixed.

[kml_flashembed movie=”” height=”180″ width=”217″ fvars=”appname=RichFLV&appurl=” /]

You`ll need Flash Player 9 Update 3 for the seanless install to work. If you don`t have it yet you can download the air file manually here.