Forum Discussion
Dan-Lidholm
2 years agoCommunity Member
Using Java Script and multiple audio files playing simultaneously, wrong audio file unmuted when reloading page
Hi,
I made a drag & drop production about reverberation where 4 almost identical audio files are playing at the same time. They are synchronized and loops, they never stops except when the paus bu...
Jürgen_Schoene_
2 years agoCommunity Member
the order of the audios in the dom tree is not fixed
it can be different at every start
test with firefox, first start
second start
=> different order
so your methode to find the correct audio cannot work
idea: identify the filenames of the audio
var filename1 = audioElement1.src.split("/").slice(-1)
var filename2 = audioElement2.src.split("/").slice(-1)
var filename3 = audioElement3.src.split("/").slice(-1)
var filename4 = audioElement4.src.split("/").slice(-1)
so you can use the filenames to find the correct audio
Dan-Lidholm
2 years agoCommunity Member
Hi Jürgen, thank you for your answer. That made it clear. However, I didn't know that it could be change after it was published.
Great suggestion to use the file name. Could not get ID to work but hopefully your suggestion will do the trick.
I'll be back.