/ Published in: JavaScript
Simple [SoundManager2](http://www.schillmania.com/projects/soundmanager2/doc/download/#latest "Download SoundManager2") example (uses jQuery)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!--# 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>