I have the following code for playing an audio file from an array
function playSound() {
if(index>=25){
index = 0;
}
document.getElementById("sound").innerHTML=
"<embed src=\""+audio[index]+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />";
index++;
}
The audio plays fine on my laptop but won't play on the iOS device. The code is triggered from the following HTML
<button id="newWordBtn" class="play" onclick="playSound(); $('#result').empty(); $('#yourTurn').val(''); myFunction();" data-icon="refresh" tabindex="3">New Word</button>
Any ideas on how I can get this working? I know that iOS doesn't allow autoplay but this sound is triggered by a button.