I currently have an html audio element in my html document and my code looks like this
audio.currentTime = times[i].first;
playPromise = audio.play();
if (playPromise != undefined) {
playPromise.then( () => {
timer = setTimeout( () => {
audio.pause();
}, (times[i].last-times[i].first)*1000);
})
.catch( e => console.log(e));
}
and this works fine on android devices/chrome, but when I play it on an iOS emulator, the first time the audio gets played it gets cut off early since the currentTime isn’t getting set to what it’s supposed to begin at, but all the other ones work. I tried adding
audio.oncanplaythrough = () => {
audio.currentTime = audio[i].start;
}
and audio works correctly on iOS but then it completely doesn’t play on android.