I never working with this language, am only help a friend. I am trying play sound of a word. But are executing very quickly.
audio.vue
methods: {
.then(setTimeout(() => {
const arr = 'test'
Array.prototype.forEach.call(arr, char => {
audio.playChar(char) //Passing each char separately, wait 1 second before execure next iterator
})
},
...
}
}
audio.js
playTest (char) {
return new Promise((resolve, reject) => {
const audio = new Audio()
audio.src = `.../alert/pt/${char}.mp3` //playing separately but very quickly
audio.onended = resolve
audio.onerror = reject
audio.play()
})
},