Javascript loop through array of audio files, playing one after another -
i have array of audio urls want loop through , play 1 after other, little bit of space in-between. i'm using angular2 , typescript. currently happening plays first track, switches , plays second track, not switch next track continues play second one. never stops playing second track , play each once , stop. my array of audio urls stored in this.listenservice.messagesrcs so ["http://localhost:8000/5827a34e88554c09a7c0d182", "http://localhost:8000/5827a35088554c09a7c0d183", "http://localhost:8000/5827a35288554c09a7c0d184"] and here attempt @ looping through them loopmessages() { if (this.listenservice.card && this.listenservice.messagesrcs) { console.log(this.listenservice.messagesrcs); let message = new audio(); message.setattribute('src', this.listenservice.messagesrcs[0]); message.load(); settimeout(function() { message.play(); }, 5000); if (this.listenservice.messagesrc...