Apollo Music Player


If you haven’t checked out Adobe Apollo on Adobe Labs yet, what are you waiting for? Apollo is a platform-independent runtime system. Apollo applications can mix Flash, HTML, and PDF content all in one application.

If you download the Apollo alpha trial you’ll find some great examples. I decided to try my own hand at an Apollo application and created a music player. There is a music application on the Apollo Showcase site, but there’s nothing like writing your app to get a feel for how things work.

You can rip your CDs into a special directory ({documents}/My Music) and the music player will display them in a Tree control. Select an album from the control and the track listing will be displayed in the main window. You can play, pause, and skip to any point in a song. You’ll also be treated to a visualization by Ben Stucki


13 Apr 2007. These downloads are the same as the ones in the Apollo Music Player Redux article.

Download Music Player Installer AIR file (you will need to install the Apollo Runtime System first). The uploaded file has an extension of .air but the browser may try to download this file as a .zip. Right click this link and pick Save As and give the file a .air extension. Or download an save the file with a .air extension. This way you can double-click it and the Apollo Runtime will install the application properly.

Download Music Player Source (a zip file with a Flex 2.0.1 Project). The source does not include the visualization component; please download that from Adobe Exchange or remove it from the application.

Music Directory

The music directory ({documents}/My Music, where {documents} is your local documents directory; on Windows that would be My Documents) should be structued like this:

My Music/
        artist/                (eg, Jason Mraz)
             album/          (eg,     Waiting for my Rocket to Come)
                 track         (eg,            You and I Both.mp3)

This is the typical structure created by Windows Media Player when it rips a CD to disk.

Things to Note

I built and tested this application in Flex Builder. Apollo applications are created in a familiar environment with tools you already know.

Existing Flash and Flex content integrate easily. I pulled the visualization component from the Adobe Exchange and used it right away. Any Flex components you have already created can be used as-is.

The Shuffle and Repeat buttons use small Flash 8 SWFs when toggled on. The Repeat button, for example, shows a spinning arrow.

To do

There are still a few things to do:

  • Allow the music directory to be anywhere. Right now I coded it for My Documents/My Music.
  • Display album art in the tree control. Most of the time one or more image files are deposited with the album contents so it could be displayed in the tree.
  • Since HTML content can be easily displayed in an Apollo application, an "Album Details" button could display information about the artist or even display the artist’s web site within the Apollo windows.

10 Responses to Apollo Music Player

  1. Russ says:

    When I run the music player on a Mac, I get this error

    Error: Error #2038: File I/O Error.
    at flash.filesystem::File/listDirectory()
    at com.adobe.musicplayer::MusicLibrary/::buildArtistList()
    at com.adobe.musicplayer::MusicLibrary$iinit()
    at MusicPlayer/::initApp()
    at MusicPlayer/___ApolloApplication1_creationComplete()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.core::UIComponent/set initialized()
    at mx.managers::LayoutManager/::doPhasedInstantiation()
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/::callLaterDispatcher2()
    at mx.core::UIComponent/::callLaterDispatcher()

    I haven’t tried it on my PC.

  2. Dreamer says:

    I read your blog everyday, but this is the first time I can leave a comment, so exiting! ^-^ Thank you for your word.

  3. Ofir says:

    hi Peter,
    i just tried this but i get an error when trying to select a track:

    Error: Error #2038: File I/O Error.
    at flash.filesystem::File/listDirectory()
    at com.adobe.musicplayer::SongList/createList()
    at MusicPlayer/::showTracks()
    at MusicPlayer/__artistList_itemClick()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()[C:\Documents and Settings\acrorel\Local Settings\Temp\aslibc-26332\EventDispatcher.as:184]
    at mx.core::UIComponent/dispatchEvent()
    at mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::mouseClickHandler()
    at mx.controls::Tree/mx.controls:Tree::mouseClickHandler()

  4. Peter Ent says:

    Hmm. I did not try this on a Mac. Did you run the AIR file or rebuild from the source? I also am not sure where the My Documents/My Music equivalent is on the Mac. I guess I should add the option to locate the music directory.

  5. Ishu says:

    I am getting the same error on building the sample hello world application in apollo documentation. Some one help!!!!!!!!!!!!!

  6. Peter Ent says:

    The very best thing you can do is post your question on the Apollo forum – for the Hello sample, NOT for my code.

    Perhaps we need to change documentation or may be we left something out, I don’t know. But we need to hear from you so we can make the product better.


  7. Jake says:

    The reason you are getting the File I/O Error is because you do not have your directory structure set up properly. You need to create the My Music directory in your Documents directory and then add some music to it. After the application starts up for the first time, you can then change the music directory to point wherever you want.

    Oh, and the equivalent directory on a mac is in
    /Users/{username}/Documents/My Music
    Peter: Thanks for the tip, Jake.

  8. November says:

    i like your player it rocks

  9. Really rocket player, I like it!

  10. Ivan says:

    I like this player.