Basically, you have 2 ways to customize your player: adding a <param> tag with custom values or using Javascript events or functions.
The first way is far more accessible for non-experts users, but the customisations
will had "definitive" effects on the loaded player, whereas Javascript could
be use several times (=several customisations) on one player instance.
Sound too complicated ? Imagine you have 2 sounds on a webpage and you want
to add a loop ability on one file, but you want to prevent any loop on the
other. In this case, you better use javascript, because you want a
reversible modification on your player.
Now imagine that you want to change the background color of the player, I suppose
you don't want a different background color per sound ? In this case, you better
use a custom <param> tag, because you want to apply this modication for every
sounds on your webpage.
Just look at the examples below, you'll surely find that using <param> tag is easier.
Parameters list
See all parameters using SDV() function in options list
Using <param> tag
You just need to add to the player code a line with a parameter and your wanted value :
<param name="FlashVars" value="parameter=value" />
Example 1. You want to play sounds encoded at 128KB/s, your player code will look like:
<object id="mp3player" type="application/x-shockwave-flash" data="player.swf" width="220" height="30" style="vertical-align:
bottom;">
<!-- MP3 Flash player. Credits, license, contact & examples: http://pyg.keonox.com/flashmp3player/
-->
<param name="type" value="application/x-shockwave-flash" />
<param name="codebase" value="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" />
<param name="movie" value="player.swf" />
<param name="FlashVars" value="my_bitrate=128" />
</object>
Result :
Example 2. You want to change background color:
<object id="mp3player" type="application/x-shockwave-flash" data="player.swf" width="220" height="30" style="vertical-align:
bottom;">
<!-- MP3 Flash player. Credits, license, contact & examples: http://pyg.keonox.com/flashmp3player/
-->
<param name="type" value="application/x-shockwave-flash" />
<param name="codebase" value="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" />
<param name="movie" value="player.swf" />
<param name="FlashVars" value="my_BackgroundColor=0xffffff" />
</object>
Result:
Example 3. You want to launch a sound immediatly after the player is loaded:
<object id="mp3player" type="application/x-shockwave-flash" data="player.swf" width="220" height="30" style="vertical-align:
bottom;">
<!-- MP3 Flash player. Credits, license, contact & examples: http://pyg.keonox.com/flashmp3player/
-->
<param name="type" value="application/x-shockwave-flash" />
<param name="codebase" value="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" />
<param name="movie" value="player.swf" />
<param name="FlashVars" value="file=mysound.mp3" />
</object>
Example 4. You want to load a default sound and launch it only when user press "play" button:
<object id="mp3player" type="application/x-shockwave-flash" data="player.swf" width="220" height="30" style="vertical-align: bottom;">
<!-- MP3 Flash player. Credits, license, contact & examples: http://pyg.keonox.com/flashmp3player/ -->
<param name="type" value="application/x-shockwave-flash" />
<param name="codebase" value="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" />
<param name="movie" value="player.swf" />
<param name="FlashVars" value="file=mysound.mp3&autolaunch=false" />
</object>
NB: use "&" as a separator between multiple options (carriage return between options is optional and may be used to ease code reading).
Result:
Example 5. You want to change background color and permit loop:
<object id="mp3player" type="application/x-shockwave-flash" data="player.swf" width="220" height="30" style="vertical-align:
bottom;">
<!-- MP3 Flash player. Credits, license, contact & examples: http://pyg.keonox.com/flashmp3player/
-->
<param name="type" value="application/x-shockwave-flash" />
<param name="codebase" value="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" />
<param name="movie" value="player.swf" />
<param name="FlashVars" value="my_BackgroundColor=0xdddddd&my_loop=true&file=sounds/033_052_01_bruit.mp3&autolaunch=false" />
</object>
Result:
Using Javascript
Look at the HTML source of the following examples (once the page is open: right click => "Show source")
Standard and simple example: Pass sounds using a javascript function
Set a default file (to be played once the player is loaded)
Experts users
Experts users could use fscommand with Javascript and VBScript function to detect if sound is started or completed. This permit to build playlist or specific actions around sound playing.
[Todo : make an example of mp3 playlist loaded by javascript array]