Simple Flex Music Player

It’s been a while since my first post. I parted with Pathfinder Dev a few weeks ago, switched this blog to self-hosting, and currently looking for new opportunities.

While I am looking for a new gig, I’ll try to revive this blog by remixing and publishing some old toys I’ve prototyped to get my Flex chops together.

Here is the one that did not make the cut for that internal AIR Flair presentation. I had to play that jungle Bamboo Banga beat in WMP11.

(Click on the image to play and download sample code)

That’s my take on simple mp3 player in Flex. Click on that visualization to see some bars jump.

Most of the heavy lifting is done by the components from the flex community listed below.

Under the hood:

Obsidian Flex UI skin from scalenine.com gallery to give this player some polished look and feel.

nl.fxc.controls.MP3Player.as class from labs.flexcoders.nl for the audio playback control with minor changes to expose some properties and events to the main view controls. Why reinvent the wheel :)

Music Visualization is provided by the excellent Audio Visualization component by Ben Stucki.

I created the main mxml view, layout and custom icons. All in all about two pages of code and a couple of days to prototype it and publish.

Now, this music player is intentionally very basic and only plays one sample.mp3 track from the /assets/music folder.

If you are looking for a more versatile Flex music player that’s scriptable and supports playlists, I’d suggest you grab the latest Flex xml mp3 player which is an excellent port of the well known XSPF Web Music Player to Flex.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • blogmarks
  • NewsVine
  • Reddit
  • Sphinn
  • SphereIt
  • TwitThis
  • Furl
  • Spurl
  • Ma.gnolia
  • Slashdot
  • StumbleUpon
  • email
  • Print

Related Posts

4 Responses to “Simple Flex Music Player”

  1. Taras

    If you are still looking for one, see the new Flex Music Player example at: http://www.tarasnovak.com/lab/FlexMusicPlayer/FlexMusicPlayer.html

    I added support for multiple tracks with the Prev./Next track buttons, enabled track scrubbing, replaced the playback component with the Playr, and added the music Visualizr from Ronny Welter

    A more extensive example with a playlist, cleaned-up source code, and a sample of pulling music from last.fm will be posted soon.

  2. David Repas

    Awesome music player.

    I did notice one issue (if you want to call it that). If you begin to play before the song is completely downloaded, the player resets (stops playing) when the trackslider is complete. In other words, if I begin to play immediately on load, the player stops at about 10-20 seconds into the song – I can the hit play again to continue.

    Any advice on how to stop this from happening?

    Thanks much.

  3. Taras

    David,

    Without looking into the old and outdated source code, my guess is that it’s related to improper handling of the sound complete event that is dispatched when sound data is loaded.

    I’ve replaced the playback component with the Playr API that is more feature rich and complete.

    See if you can use the latest version: Flex MusicPlayer v.2 with MusicVisualizer

  4. MemoMusic « LogField

    [...] 1. Simple Flex Music Player  [...]

Leave a Reply