Tuesday, November 24, 2009

VacuumTube: The YouTube downloader

A couple of months ago, I was given an iPod Touch. It is, quite simply, an amazing device (posts on that surely to follow). Part of the coolness of an iDevice is that it allows you to stream YouTube video in h.264 format (and not the usual FLV/FlashVideo format that other browsers see). Unfortunately, if you don't want to run up your iPhone data plan costs or, like me, ride the bus a lot, then being able to download YouTube vids while on WiFi for viewing later would be a godsend.

Enter VacuumTube

Well, I saw a need and filled it. Here is VacuumTube, a YouTube browser/downloader written in Flex and run in AIR, the Adobe Integrated Runtime.

The main part of this exercise was to allow me to watch videos on my long and tedious bus treks, the other was to demonstrate just how quickly I could create an Internets-aware application in AIR that provides a usable (if simple) interface. It took me, all told, around 5 hours to make, including subsequent bug fixes.

Be forewarned

Using this tool will contravene YouTube's "Terms of Service" agreement, which states that you may access User Submissions solely for Streaming.

I wrote this as an experiment more than anything, so please don't abuse it. In fact, I debated whether or not to even post it to the public for this very reason. I provide no warranty, express or implied that VacuumTube will still be working by the time you download it. YouTube already changed their code once on me, making VacuumTube useless (a fix was ready after maybe an hour of coding).

How Was it Done?

AIR provides UI components that leverage the open source WebKit for rendering HTML and handling JavaScript (see here). I basically leveraged that provided foundation to create a custom browser that provides special functionality that invokes the existing YouTube scripting.

For those who are paying attention/care, vanilla Flex provides a means of interacting with the HTML document that wraps around the Flash plug-in in which the executable SWF is running. AIR, on the other hand, provides a means of rendering HTML inside the actual application (there is no wrapper for AIR, it is a desktop app, after all).

What does it prove?

That Flex/AIR are indeed incredibly well suited for developing networked RIAs with rich UIs in very little time (like I said previously: around 5 hours total). Also, that they interact well with Javascript outside (Flex) or inside (AIR) the application.

Enjoy the app and please leave a comment with your impressions.

Download VacuumTube. Right-click and select "Save Link As" or equivalent. When I have time, I'll create an AIR installer badge to make this simpler and prettier...

No comments:

Post a Comment