You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
Hi,
I wish to play another audio on completion of the first one. For this, I have implemented a recursion function as such:
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!
The text was updated successfully, but these errors were encountered: