niftyPlayer

A Scriptable, Lightweight Flash MP3 Player
(NOTE: this program was written around 2003 and, although it still works, it is no longer in active development.)

Demo

This is what niftyPlayer looks like:

...and it is controllable with JavaScript:

play toggle (or play | pause ) stop
load file 1 | load file 2 | load file 2 and play it

register onPlay event (then click the play button to see the result)
get current file state

Upsides

  1. Small (~4kb)
  2. Free, open-source
  3. No Flash knowledge required: file URL is specified in HTML
  4. JavaScript-ready! You may even bypass the Flash interface altogether!
  5. Autostart capability
  6. Draggable/Clickable seek bar
  7. Simple operation with Play/Pause and Stop buttons
  8. Buffering with progress bar
  9. Buffering is stoppable! (through Stop button)
  10. Volume control
  11. Very verbal
  12. Retries upon encountering errors

Downsides

  1. No playlist capability (but can be done in JavaScript!)
  2. No photo-slideshow or video capability
  3. Sound must be MP3 (flash limitation)
  4. I'm sure there's more, but I can't really think of any other. But, hey, did I mention it's open-source? You can always change the code :)

Usage

Copy and paste the code below into your HTML file, then replace all values in red accordingly.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="165" height="38" id="niftyPlayer1" align="">
<param name=movie value="niftyplayer.swf?file=betty.mp3&as=1">
<param name=quality value=high>
<param name=bgcolor value=#FFFFFF>
<embed src="niftyplayer.swf?file=betty.mp3&as=1" quality=high bgcolor=#FFFFFF width="165" height="38" name="niftyPlayer1" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>

If you'd like to use the JS extension, include the code below in your HTML file (it usually goes inside the head section). You may set the height and width of the Flash (in blue, above) to 0 to make it disappear -- or use CSS, alternatively.

<script type="text/javascript" language="javascript" src="niftyplayer.js"></script>

Also, you may want to check out the FlashMP3alizer script too.

Reference

Parameter Explanation
file=betty.mp3 substitute betty.mp3 for the file you want to play
as=1 this specifies whether you want the file to auto-start playing. you may ommit as if you don't want it to auto-start.

Download

Note: Please do not hotlink to NiftyPlayer. I do have to pay for bandwidth, you know? :)

Get the NiftyPlayer here!

(This program is licensed under the MIT License, which, to put it in non-legal terms, allows you to share, use and modify it. Even for commercial purposes. Check out the Wikipedia article on this license for more.)

Acknowldgements

Part of the JavaScript code was pretty much copied from this website http://www.moock.org/webdesign/flash/fscommand/. They offer a great explanation of Flash/Javascript interoperation.

The info they give may be a little outdated by now, though...

News

Version 1.7 is out: Bug-fix release. Introduces the getState() JavaScript function.

Now with "News" section!