Help with autoplay after the first audio clip is finished | XM Community
Question

Help with autoplay after the first audio clip is finished


I need help finding a code that allows me to autoplay a second audio clip after the first audio clip is done.


3 replies

Userlevel 7
Badge +22

On 'end' event of the 1st audio clip call a function that plays second audio clip.
OR
You can change the src of audio file on end of the 1st audio, and then start the play function again. Check the below code:
HTML:

I was able to implement the code into the html but I wasn't able to get the results.




This is what it looks before I added anything to it. What would be my best choice to do?

Userlevel 7
Badge +22

If you are using the above html then use below JS:
jQuery(".qmedia:eq(0)").on("ended",function(){
document.getElementsByClassName('qmedia')[2].play()
});

Leave a Reply