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 »

6 Responses to “OGG in Flash? Yes you can. Now how about WMA?”

  1. Fernando Lopez Jr. Says:
    October 1st, 2009 at 6:55 pm

    any updates on this?

  2. yoav Says:
    November 25th, 2009 at 3:10 pm

    what would be great is encoding and decoding vorbis and flac in actionscript… or at least from actionscript.

  3. Naze kimi Says:
    July 29th, 2010 at 9:50 pm

    Hey, i tried to look into that code but there was nothing on the link. any update on this?

  4. jhim Says:
    August 23rd, 2010 at 12:08 pm

    ffmp3.sourceforge.net/

  5. Regulus Says:
    November 17th, 2010 at 9:50 pm

    The link you posted is dead, here’s the new link mauft.com/2010/11/ogg-vorbis-in-flash/

    The code work quite well btw, though the author did said that it was unstable, check the readme.txt for details

  6. dl Says:
    December 7th, 2010 at 4:30 pm

    When I try to palyback a icecast stream with the alchemy ogg player it is only playing for less than a second ? idea ?

Leave a Reply