Playing Sequentially audio files (Ionic 3 Native Audio)


#1

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 !


#2

It’s a bug with the plugin

The problem is on the callback wich execute at the same time when playing audio file.


Callback when file is done playing not working!
#3

Did this get fixed? Did you get it to work/report it?