Hello I have a series of audio clips.
<div class="audio-wrapper">
<audio controls>
<source src="aduio1.mp3" type="audio/mpeg">
</audio>
</div>
<div class="audio-wrapper">
<audio controls>
<source src="aduio2.mp3" type="audio/mpeg">
</audio>
</div>
<div class="audio-wrapper">
<audio controls>
<source src="aduio3.mp3" type="audio/mpeg">
</audio>
</div>
<div class="audio-wrapper">
<audio controls>
<source src="aduio4.mp3" type="audio/mpeg">
</audio>
</div>
In my actual code the audio is spread out through a large wordpress page.
I was wondering if it was possible to play the next one after one above it finishes? For example if one near the top of html is played then it will find the next down and play that, and so one.
For example if someone pressed play on the first one and it finished till the end. The one below it would start playing, and so on.
Another example if someone hit play on the 3rd one and that one finished, Then the 4th one would start playing.
Thanks for any help!
(think podcast site)
You can attach
ended
event to".audio-wrapper audio"
selector, check if$(this).parent(".audio-wrapper").next(".audio-wrapper")
exists using.is()
, if true, call.play()