user2025698
user2025698

Reputation: 55

How to play multiple audio files sequentially in html 5?

I wanted to autoplay multiple audio files sequentially.

Below code plays all the audios at the same time.

<audio src="26de96c4000ceccafc415c5f191b5836.wav" autoplay ></audio>

<audio src="0001.wav" autoplay ></audio>

Please advice whether it can be played sequentially.

Upvotes: 1

Views: 11377

Answers (1)

Alexander Mei&#223;ner
Alexander Mei&#223;ner

Reputation: 826

Remove the "autoplay" attribute from the "audio" tags and use javascript

The method "ended" is called when one "audio" tag finishes:

<audio ... ended="nextAudioNode.play();">

http://www.w3schools.com/tags/ref_av_dom.asp

Upvotes: 3

Related Questions