OGG in Flash? Yes you can. Now how about WMA?

May 13th, 2009

Working with audio can be pretty limiting in the Flash Player. There’s a multitude of audio formats out there, but heretofore the only native support is for MP3 and AAC (the latter arriving only as recently as the beta releases of Flash Player 9, so long as the file has been encoded in the correct fashion.)

This leaves out a number of still-popular formats, particularly OGG, WMA, and Real. WMA is a common format for those who encode audio with Windows Media Player (as well as many streaming online radio stations). While Real is fading from view, OGG continues to grow in popularity, particularly due to the fact that it is open-source and requires no licensing fees to broadcast.

Fortunately we can add another format to the list. Adobe’s labs release of Alchemy allows us to compile C/C++ code, with a bit of tweaking, into a precompiled SWC file that can then be accessed from ActionScript. The sample library includes an OGG codec, which you can use either directly or within a wrapper class recently published by Maurice Zarzycki. This makes playing back OGG files as simple as:


oggDecoder = new OggRadio(yourUrl);
oggDecoder.play();

While playing OGG files does appear to be more CPU intensive than MP3, I’m impressed for its stability; I’ve yet to find an OGG file it couldn’t handle.

This opens the debate as to what other C++ libraries might be of use in SWF or AIR. Along the lines of audio, there is still the WMA format, which though propriety technology of Microsoft, has an open-source codec, libwma, developed by FFmpeg and further reworked into SoundCodecWMA by the Rockbox team. How difficult it would be to translate this into Flash Player functionality using Alchemy to build a SWC?

Any takers?

Posted by bcdef
Filed in Alchemy, Flash
6 Comments »

Flappr Reaches 1.2

February 15th, 2006

Flappr, my pet project to design a more explorative interface for Flickr, has just bumped to its most significant update. Check it out.

A few of the new features:

  • User Profile Panel: Clicking on a buddy icon now opens up the new User Profile section, which gives you quick access to more information on the photographer, their favorites, and now a legitimate and easier-to-use display of their photosets.
  • Quickly view a grid of previous photos: this was a feature/bug that had for a long time been accessible by hovering to the right side of the screen. It’s now properly encapsulated into a button down by the userstrips.
  • Search history: Go back to any search you made, viewing a list of the most recent. It will even remember searches from your previous visits. Try it out by clicking either the down arrow in the thumbnail container or by using the new button nearby the userstrips.
  • Running newest builds of Flashr and Fuse = snappier tweens and faster, cacheable data requests.
  • Adding to favorites now displays confirmation
  • A new spinning square when the photo enlargement is loading in! (ok, so why save the best for last, anyway?)

Bug fixes:

  • FlapprLinks have received a long-overdue renovation
  • Pagination issues are resolved (this was previously a headache for favorites/photosets)
  • Repositioning after a browser resize now more reliable
  • Keyboard shortcuts no longer interfere with comment form
  • Hover boxes no longer appear over photos without titles
  • Text overflows, while not entirely gone, are greatly minimized

Read more about the project here.

Posted by bcdef
Filed in Flash
2 Comments »

FP8 Adoption: Hint of Things To Come

February 1st, 2006

The first numbers have arrived. Flash Player 8 is already on 45% of all Internet-enabled computers in the United States. Even plummer are the numbers for Canada and Europe, close to 55%. While to an outside observer this might not be a resounding victory – it’s still only about half after all – the important axis yet to be mentioned in this survey is that of time: at the point of the survey, FP8 had only been available for 3 months!

In a bit of awe, I dangled these numbers to a friend only to learn that they intentionally had removed Flash from their browser, and to boot were mumbling something about how they never trust numbers. It made me consider – should Flash developers trust the numbers? The cited NPD Online survey, after all, only uses 2,000 people in its survey – all of which are doing so voluntarily in exchange for the chance at a $100 payout. These aren’t Internet neophytes. Hence, these survey users != your users. That said, no matter what margin of error you’re willing to give, I did not expect the newest version of the Flash Player to be adopted so quickly

Why should I be surprised? After all, a rapid adoption of the newest Flash Player is not without precedent; it has repeatedly been the most quickly adopted software in the history of the Internet, due on one part because it is free, and in another because of its ease of upgrade. As the browser race heats up between IE and Firefox over the next year with the release of IE7 and Windows Vista, the rate of adoption will likely boost even higher, when those who download new browsers automatically get the new Flash Player included.

But I’m hoping something beyond FP8 will be included with Vista.

Each Flash Player version comes out with new features, but no matter how significant this is to the new web experience, if the user cannot view this experience or is burdened in the attempt to install the required player in order to view it, we run into the classic debate of web development: how do you value lost customers vs. impressed customers? When a viewer on average spends 0-4 seconds (depending on the study) before hitting their back button, how do you sell a client on a project that employs the newest Flash Player, knowing that a subsection of their potential viewers, no matter how marginal, will quickly flee once they don’t receive the information they expect near instantly (experience be damned)?

This Flash-Player-transition debate is not unfamiliar. But when previous versions of the Flash Player were released the web was a different place. Now, the web is legitimizing itself as a business. Aside from the new graphics libraries in FP8 which open new doors to Flash Math Creativity that I hold great respect for, does publishing for FP8 offer a new opportunity beyond what FP7 offers? From my exchanges, the answer is generally no. A few paying clients accept the potential of reaching a smaller audience in order to have clearer more readable text for everyone, but it is not the popular choice. Sacrificing audience for an otherwise impossible presentation is worth considering, sacrificing audience for aesthetics is often not.

My 2 cents: no matter how significant these adoption rates look for FP8, the results should only remind you of when your team wins their division in spring training. It’s all moot except the portent that we’ll see even higher adoption rates for the next Flash Player (currently available in beta as 8.5 for use with Flex Builder, but will be released as 9.0).

This for several reasons:

  • The upgrading experience will be even easier
  • Net users will be even savvier as a whole, and update more readily
  • If released as projected, it will be the quickest turnaround of a new Flash Player, therefore merging into the adoption rate of those who would otherwise have downloaded FP8
  • Rich applications that bogged down and crashed browsers on slower computers with FP7/FP8, will now be so smooth as to embarrass the pants off of Javascript due to improved speed of computation.

Some might write this opine off as a classic developer vs. designer bias, but I believe that FP8 adoption rates are just a warm up. Soon Flash applications that were impossible or unpopular before will become practical – at which point a client might be willing to sign off on a FP9 project even if adoption rate is less than 25%, primarily because of the lack of alternatives. Because FP8 is not in the same category, even with numbers as high as it has garnered, I expect that the majority of us will have a hard time selling projects that require FP8 – no matter what NPD Online says.

In short – welcome FP8… but here’s to FP9!

Posted by bcdef
Filed in Flash
1 Comment »

Bringing Space Invaders Into the AS3 Century

December 17th, 2005

Many people on the 'net associate Flash with gratuity and obnoxiousness. Given that it's one of the more powerful tools to use for the web experience, this is both understandable and unfortunate. Often its defense comes in the form of practical examples that genuinely improve both the experience and the intuitiveness of a web site, beyond what could be done without. While this is certainly important to the broader acceptance of Flash, what I often feel are the proudest accomplishments of the Flash community are usually those farthest from the commercial sector.

For years, Flash was one of the only moderately intuitive vehicles for creating mathematical / algorithmic art. The rapid spread of the Flash Player inclined creators to work with the young Flash Actionscript format since it was relatively easy to share their creations online. The work of many such math artists was compiled into a cult favorite math art manual, Flash Math Creativity. The publisher, Friend of Ed, has a minisite where you can play with some examples from the book.

One author, Jared Tarbell, whose broader work with Flash and Processing can be found at levitated.net and complexification.net, made an experiment called "Invaders" which populated the screen with a repeating set of pixely symmetrical monsters. You can read more about it's inspiration from Jared's site. There you can also find the .FLA source if you're curious of how he's done it.

Unfortunately, that source is a few years old, in AS1 syntax, and around this time I had decided it was finally time to experiment with Macromedia's Flex Builder 2 Alpha. The reason I hadn't explored Builder earlier was because I really hadn't any purposeful place to start. Enter the Invaders.

Now I should hand out a disclaimer. You could say that the Invaders experiment is an absurd Flash piece to recode into AS3; it runs quite smoothly already, doesn't gain significantly from object-orientation, and certainly doesn't require any of the new libraries. And with that you'd be pretty spot on.

But regardless, I thought it was a reasonably short piece to translate and try my hands at the Flex Builder. So here you have it, running below in variations of AS1, AS2, and AS3 (you'll need the Flash Player 8.5 beta to see the third one). The only item I didn't implement into the AS3 version is the ability to click an invader and spawn smaller ones inside. But otherwise these should run identically (though they naturally may not look identical in the end).

Original SWF from levitated.net:

Updated to AS2:

Updated to AS3 (requres Flash Player 8.5 or higher to view):

You'll notice in the AS3 version that anti-aliasing isn't as smooth as in the previous two. I'm using the drawing API in the AS3 version rather than attaching a movie clip of a black box. The rougher edges may be due to the default quality setting (I'm not sure how to change it yet in the publish options).

Overall, I found the conversion to AS3 to be relatively less tedious than I expected. The debugger could use better integration (half the time my browser couldn't locate it). But overall, it went smoothly. Most of the challenge lay in familiarizing myself with the Builder's publish settings. I have to admit that the most welcome change I have seen in coding for AS3 is the new addChild() and addChildAt() functions, which remove a lot of the troublemaking and variable passing that instance names and depths can add to a project (and certainly did to this one). In the end the code looks a lot cleaner in AS3, and another step more conducive to extending.

I have to wonder, however, at what point I should begin committing myself further to AS3. It's exciting to experiment with a future toolset this early, but since it will require another Flash Player download, we'll have to wait a few months before clients are ready to give the green light for an AS3 project. If the early release of the Builder Alpha leads you to doubt whether learning Flash 8 is worth it's investment, there's a good discsussion brewing over at joshbuhler.com

And, in case anyone's interested in exploring this further, here's the source for all three versions.

Note: I had previously stated that the official launch of Flex Builder would not be for another year. I'd heard this somewhere along the vine, but couldn't retrace my information. And I've since received comment that the official projected release date from Adobe is much more optimistic than this, and that we should see an updated Alpha at the labs page in January. Good news! Maybe I'll fit in some more AS3 time after all...

Posted by bcdef
Filed in Flash
1 Comment »
« Previous Entries