Return to Snippet

Revision: 18536
at October 1, 2009 16:49 by chrisdpratt


Updated Code
<!--# Add to <head> #-->

<script type="text/javascript" src="/path/to/soundmanager2-nodebug-jsmin.js"></script>
<script type="text/javascript">
//<![CDATA[

$(document).ready(function () {
  soundManager.url = '/path/to/sm2-flash-movies/'; // directory where SM2 .SWFs live
  soundManager.onload = function() {
    // SM2 is ready to go!
    var mySound = soundManager.createSound({
      id: 'aSound',
      url: '/path/to/an.mp3',
      autoLoad: true,
      autoPlay: false
    });

    // Play/Pause Toggle Button
    $('#toggleBtn').click(function () {
      soundManager.togglePause('aSound');
    });
  }
});

//]]>
</script>

Revision: 18535
at October 1, 2009 16:44 by chrisdpratt


Initial Code
<!--# Add to <head> #-->

<script type="text/javascript" src="/path/to/soundmanager2-nodebug-jsmin.js"></script>
<script type="text/javascript">
//<![CDATA[

$(document).ready(function () {
  soundManager.onload = function() {
    // SM2 is ready to go!
    var mySound = soundManager.createSound({
      id: 'aSound',
      url: '/path/to/an.mp3',
      autoLoad: true,
      autoPlay: false
    });

    // Play/Pause Toggle Button
    $('#toggleBtn').click(function () {
      soundManager.togglePause('aSound');
    });
  }
});

//]]>
</script>

Initial URL

                                

Initial Description
Simple [SoundManager2](http://www.schillmania.com/projects/soundmanager2/doc/download/#latest "Download SoundManager2") example (uses jQuery)

Initial Title
Simple JavaScript Audio Player with SoundManager2

Initial Tags
javascript

Initial Language
JavaScript