0
down vote
favorite
I need to play a list of audio files one after another in Ionic 3
and i’m using ionic native audio plugin
playAll() {
for (let i = 1; i <= 77; i++) {
this.playAvecIonNative(i)
}
}
async playAvecIonNative(i) {
// this.currentBeyit = this.cpt;
this.idAudio = 'w' + i;
this.nativeAudio.preloadComplex(this.idAudio, 'assets/audio/' + i + '.ogg', 1, 1, 0)
.then(await this.onSuccessPreloading, this.onErrorPreload);
}
onSuccessPreloading = (data) => {
this.scrollTo(i - 1);
this.nativeAudio.play(this.idAudio).then(await this.onSuccessPlaying, this.onErrorPlay);
}
onSuccessPlaying = (a) => {
this.nativeAudio.unload(this.idAudio);
}
onErrorPreload() {
alert('ERREUR PRELOAD')
}
onErrorPlay() {
alert('ERREUR PLAY')
}
When i test with one audio file with the playAvecIonNative() it works great but for multiple file it doesn’t work as expected
Could you help me to achieve that ! Please !