Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completeCallback not getting called in "play" function #162

Open
khushbu-mulani opened this issue Mar 23, 2020 · 1 comment
Open

completeCallback not getting called in "play" function #162

khushbu-mulani opened this issue Mar 23, 2020 · 1 comment

Comments

@khushbu-mulani
Copy link

khushbu-mulani commented Mar 23, 2020

Hi,

I wish to play another audio on completion of the first one. For this, I have implemented a recursion function as such:

PlayAllList(i, length, audioArray) {
    var self = this;
    this.nativeAudio.preloadComplex('audio' + i, audioArray[i], 1, 1, 0).then(() => {
      console.log("Load success for audio", i)
      this.nativeAudio.play('audio' + i, () => {
        //COMPLETECALLBACK
        console.log('audio' + i + ' is done playing')
        self.nativeAudio.unload('audio' + i)
        if ((i + 1) == length) {
          console.log("done saying all the audios!! Hurray!!")
        } else {
          console.log("=====Calling the next audio=====")
          self.PlayAllList(i + 1, length, audioArray)
        }
      }).then(() => {
        //SUCCESSCALLBACK
        console.log("Success callback for play ", i)
      }, (err) => {
        //ERRORCALLBACK
        console.log("Error callback for play: ", err)
      })
    }, (loadError) => {
      console.log("========================loadError=========================== ", loadError)
    });
  }

But I cannot get "COMPLETECALLBACK" block running anytime even if the first audio is played successfully. Other blocks i.e. "SUCCESSCALLBACK" and "ERRORCALLBACK" seem to work perfectly fine.

Here my audioArray is an array of base64 strings like ["data:audio/mpeg;base64,UklGRmh6AgBXQVZFZm10IBAAAAABAAEAIlY......", "data:audio/mpeg;base64,UklGRmh6AAAAAABAAEAIlYAAESsAAACABAAZGF0YeSFAQAAAAAAAAAAAAAAAAA......"].

Any help would be very much appreciated.
Thanks!

@arturomf
Copy link

Same error for me. Any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants