Advertisement
Guest User

Untitled

a guest
Apr 25th, 2014
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. for(var i = 0; i < errors; i++){
  2. PlaySound3();
  3. }
  4.  
  5. function PlaySound3() {
  6. var audioElement = document.getElementById('beep');
  7. audioElement.setAttribute("preload", "auto");
  8. audioElement.autobuffer = true;
  9. audioElement.load();
  10. audioElement.play();
  11. };
  12.  
  13. <audio id="beep">
  14. <source src="assets/sound/beep.wav" type="audio/wav" />
  15. </audio>
  16.  
  17. <audio id="beep" loop>
  18. <source src="assets/sound/beep.wav" type="audio/wav" />
  19. </audio>
  20.  
  21. <audio id="beep">
  22. <source src="assets/sound/beep.wav" type="audio/wav" />
  23. </audio>
  24.  
  25. var count = 1
  26. document.getElementById('beep').addEventListener('ended', function(){
  27. this.currentTime = 0;
  28. if(count <= 3){
  29. this.play();
  30. }
  31. count++;
  32. }, false);
  33.  
  34. function PlaySound3() {
  35. var audioElement = document.getElementById('beep');
  36. audioElement.setAttribute("preload", "auto");
  37. audioElement.autobuffer = true;
  38. audioElement.load();
  39. audioElement.play();
  40. while( !audioElement.ended )
  41. ;
  42. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement