Advertisement
EduardET

error

Nov 20th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2.     soundManager.useFlashBlock = true; // optional - if used, required flashblock.css
  3.         soundManager.url = 'https://hiroboga.com/wp-content/plugins/compact-wp-audio-player/swf/soundmanager2.swf';
  4.         function play_mp3(flg, ids, mp3url, volume, loops)
  5.         {
  6.             //Check the file URL parameter value
  7.             var pieces = mp3url.split("|");
  8.             if (pieces.length > 1) {//We have got an .ogg file too
  9.                 mp3file = pieces[0];
  10.                 oggfile = pieces[1];
  11.                 //set the file URL to be an array with the mp3 and ogg file
  12.                 mp3url = new Array(mp3file, oggfile);
  13.             }
  14.  
  15.             soundManager.createSound({
  16.                 id: 'btnplay_' + ids,
  17.                 volume: volume,
  18.                 url: mp3url
  19.             });
  20.  
  21.             if (flg == 'play') {
  22.                     soundManager.play('btnplay_' + ids, {
  23.                     onfinish: function() {
  24.                         if (loops == 'true') {
  25.                             loopSound('btnplay_' + ids);
  26.                         }
  27.                         else {
  28.                             document.getElementById('btnplay_' + ids).style.display = 'inline';
  29.                             document.getElementById('btnstop_' + ids).style.display = 'none';
  30.                         }
  31.                     }
  32.                 });
  33.             }
  34.             else if (flg == 'stop') {
  35.     //soundManager.stop('btnplay_'+ids);
  36.                 soundManager.pause('btnplay_' + ids);
  37.             }
  38.         }
  39.         function show_hide(flag, ids)
  40.         {
  41.             if (flag == 'play') {
  42.                 document.getElementById('btnplay_' + ids).style.display = 'none';
  43.                 document.getElementById('btnstop_' + ids).style.display = 'inline';
  44.             }
  45.             else if (flag == 'stop') {
  46.                 document.getElementById('btnplay_' + ids).style.display = 'inline';
  47.                 document.getElementById('btnstop_' + ids).style.display = 'none';
  48.             }
  49.         }
  50.         function loopSound(soundID)
  51.         {
  52.             window.setTimeout(function() {
  53.                 soundManager.play(soundID, {onfinish: function() {
  54.                         loopSound(soundID);
  55.                     }});
  56.             }, 1);
  57.         }
  58.         function stop_all_tracks()
  59.         {
  60.             soundManager.stopAll();
  61.             var inputs = document.getElementsByTagName("input");
  62.             for (var i = 0; i < inputs.length; i++) {
  63.                 if (inputs[i].id.indexOf("btnplay_") == 0) {
  64.                     inputs[i].style.display = 'inline';//Toggle the play button
  65.                 }
  66.                 if (inputs[i].id.indexOf("btnstop_") == 0) {
  67.                     inputs[i].style.display = 'none';//Hide the stop button
  68.                 }
  69.             }
  70.         }
  71. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement