<h1><ahref="http://www.schillmania.com/projects/soundmanager2/"title="Play MP3s inline with javascript using SoundManager 2">SoundManager 2</a> / Make MP3 links play in-place</h1>
<h2>Inline MP3 Player Example: Fancy* CSS 3 version</h2>
<pclass="note">*CSS 3 border-radius supported only by Firefox 2.x+, Safari (2.x?) - sadly, not IE 8.</p>
<divid="sm2-container">
<!-- SM2 flash goes here -->
</div>
<ulclass="graphic">
<li><ahref="../_mp3/rain.mp3">Rain</a></li>
<li><ahref="../_mp3/walking.mp3">Walking</a></li>
<!-- files from the web (note that ID3 information will *not* load from remote domains without permission, Flash restriction) -->
<li><ahref="http://www.freshly-ground.com/misc/music/carl-3-barlp.mp3">Barrlping with Carl (featureblend.com)</a></li>
<p>This example uses <ahref="http://www.schillmania.com/projects/soundmanager2/"title="SoundManager 2 Javascript Sound API">SoundManager 2</a> to find links to MP3 files, and makes them playable "in-place" on a page. The script assigns CSS classes to links to indicate their state (playing/paused, etc.)</p>
<p>Links pointing to MP3s are assigned an onclick handler which intercepts the click (preventing the browser from following the link and unloading the page. SM2 will then create sound objects as needed to play the MP3s.</p>
<h3>Static Examples</h3>
<pstyle="margin-top:0px">CSS classes are dynamically applied as follows:</p>
<ulclass="graphic">
<li><ahref="#"class="sm2_link"title="'Click to play' state">Default: class="sm2_link"</a></li>
<li><ahref="#"class="sm2_link sm2_playing"title="'Click to pause' state">Playing: class="sm2_link sm2_playing"</a></li>
<li><ahref="#"class="sm2_link sm2_paused"title="'Click to resume' state">Paused: class="sm2_link sm2_paused"</a></li>
<li><ahref="http://www.freshly-ground.com/data/audio/binaural/Walking past sprinklers, mailbox.mp3">Walking past sprinklers, mailbox</a></li>
<li><ahref="http://www.freshly-ground.com/data/audio/binaural/Cup of Coffee.mp3">Cup of Coffee</a></li>
</ul>
<h3>Static Examples</h3>
<ulclass="flat">
<li><ahref="#"class="sm2_link"title="'Click to play' state">Default: class="sm2_link"</a></li>
<li><ahref="#"class="sm2_link sm2_playing"title="'Click to pause' state">Playing: class="sm2_link sm2_playing"</a></li>
<li><ahref="#"class="sm2_link sm2_paused"title="'Click to resume' state">Paused: class="sm2_link sm2_paused"</a></li>
</ul>
<h3>Forcing play (or exclusion) of links</h3>
<p>If you have a link to a PHP file that serves MP3 files eg. /music.php?fileID=123, it won't be picked up by the script as containing a known, playable .mp3 extension. To tell the script it should be treated as playable, include a <code>type="audio/mpeg"</code> MIME type attribute, or CSS <code>class="inline-playable"</code> in the link. eg:</p>
<p>By default, one sound will be played at a time; you can easily change a "config" object value to turn on playlist-like behaviour (i.e., play the next MP3 when the current one finishes.)</p>