javascript - multiple waves in wavesurfer with for loop -


i trying generate multiple wavesurfer audio waves using loop, code:

        $.ajax({         url: "./php/getmusic.php",         datatype: "json",         async: false,         success: function(data){             var wavesurfer = []             var array = data;             console.log(array)             var = 0;             while( < array.length){                 document.addeventlistener('domcontentloaded', function () {                      document.getelementbyid("trackholder").innerhtml += '<div id="wave'+i+'" class="waveform"><div class="tracklogo">sample logo</div><div class="title"><p><font color="lightblue" size="5em">sample artist -<font size="4em">sample title</p></div></font></font></div></div>'                      wavesurfer[i] = object.create(wavesurfer);                      wavesurfer[i].init({                         container: document.getelementbyid("wave"+i),                         wavecolor: 'purple',                         progresscolor: 'blue'                     });                      wavesurfer[i].load("./music/"+array[i]);                      console.log(i+" loading")                   })             i++         }     } }) 

the problem domcontentloaded event listener, none of waves load , without on load.

note: array called 'array' contains 2 elements: demo1.mp3 , demo2.mp3


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -