Posted By

chrisdpratt on 10/01/09


Tagged

javascript audio player soundmanager2 sm2


Versions (?)

Simple JavaScript Audio Player with SoundManager2


 / Published in: JavaScript
 

Simple SoundManager2 example (uses jQuery)

  1. <!--# Add to <head> #-->
  2.  
  3. <script type="text/javascript" src="/path/to/soundmanager2-nodebug-jsmin.js"></script>
  4. <script type="text/javascript">
  5. //<![CDATA[
  6.  
  7. $(document).ready(function () {
  8. soundManager.url = '/path/to/sm2-flash-movies/'; // directory where SM2 .SWFs live
  9. soundManager.onload = function() {
  10. // SM2 is ready to go!
  11. var mySound = soundManager.createSound({
  12. id: 'aSound',
  13. url: '/path/to/an.mp3',
  14. autoLoad: true,
  15. autoPlay: false
  16. });
  17.  
  18. // Play/Pause Toggle Button
  19. $('#toggleBtn').click(function () {
  20. soundManager.togglePause('aSound');
  21. });
  22. }
  23. });
  24.  
  25. //]]>
  26. </script>

Report this snippet  

You need to login to post a comment.