There’s a lot of good things about working around The Nerdery (free crack/energy drinks, four-legged vacuum cleaners, rad people, etc.), but my new favorite perk is learning about the population that lives in
agency world ecosystem.
From my naive vantage point, agencies fit into one of two silos: those that take themselves way too seriously, or those that have a goofy amount of fun with their job and push the interactive agency space into cool places. Guess which one I like working with?
Enter: BooneOakley.
On the scene since 2000, these guys just launched a YouTube site. No, I’m not saying that like “they’re on The Facebook.” They literally launched a YouTube site, powered by YouTube, and getting ALL traffic
redirected from http://www.booneoakley.com.
Here’s the real fun. It’s functional. Fully. Functional. Leveraging embeddable annotations, you can fully navigate through different parts of the site. And you should, especially the bios with the pooping dog.
These guys get it, have fun with their work, are pushing it ahead, and hopefully will return my phone calls. If there’s one thing nerds like, it’s partnering with agencies that get it, have fun, and do innovative
work.
The YouTube video player is currently written in ActionScript 2.0 and integrating it into an AIR application requires a few additional steps. There are many solutions available that reverse engineer the URL to get access to the source video FLV, however, this breaks the terms of service and is not officially supported by YouTube or the API.
By taking advantage of the HTMLLoader class we are able to load the YouTube Chromeless video player into AIR without breaking the terms of service. It essentially loads up a web page within the AIR application and uses JavaScript to control the video.
Lets start by creating the JavaScript / HTML portion of the application that the HTMLLoader will consume. Resources for this can be found here; YouTube Chromeless Player Example page.
Simplified JavaScript functions for this example (includes Play, Pause and Load):
Next we will use the SWFObject to load in the YouTube Chromeless video player. Notice the use of wmode: "opaque" in this example. Without this you will not be able to place any display objects above your videos.
One of the limitations of using the HTMLLoader class is the inability to set the opacity of the video. For example you if wanted to fade the video out you would have to capture the current state of the video and replace it with a bitmap image that would then be faded out (download the zip file to see an example of this).
PS: This example is only for AIR and may not work for Flex applications deployed on websites. Please visit 'YouTube in Flex applications' (On The Other Hand) for an example of how to do this in Flex.
This was originally posted on blackcj.com, Chris Black's personal blog. Chris is a Senior Developer at Sierra Bravo.