Estoy creando un sitio web que permite reproducir muchos archivos de audio diferentes (mp3) al mismo tiempo. Todos ellos están en bucle y tienen una duración diferente, por lo que siempre sonará un poco diferente. ¡Ese es el objetivo, pero no puedo lograrlo!
Este es el código js que tengo en este momento y aquí puedes encontrar un ejemplo con diferentes llamadas de ranas → http://petitbardo.club/
¡Por favor ayuda! Y muchas gracias :-)
function audioPlayer(){ var currentSong = 0; $("#audioPlayer")[0].src = $("#playlist li a")[0]; $("#audioPlayer")[0].play(); $("#playlist li a").click(function(e){ e.preventDefault(); $("#audioPlayer")[0].src = this; $("#audioPlayer")[0].play(); $("#playlist li").removeClass("current-song"); currentSong = $(this).parent().index(); $(this).parent().addClass("current-song"); }); $("#audioPlayer")[0].addEventListener("ended", function(){ currentSong++; if(currentSong == $("#playlist li a").length) currentSong = 0; $("#playlist li").removeClass("current-song"); $("#playlist li:eq("+currentSong+")").addClass("current-song"); $("#audioPlayer")[0].src = $("#playlist li a")[currentSong].href; $("#audioPlayer")[0].play(); }); }