niftyPlayer 1.7

  1. The player

  2. And JavaScriptable!!

    This is not required, but nice to have:

    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
  3. 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
  4. 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 :)
  5. 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.

  6. 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.
  7. Download

    zip file
  8. License

    This script 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.

  9. 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.

  10. News

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

    Now with "News" section!