So I’m running into an issue on Android where I preload complex 15+ audio files on a page and have tap to play events tied to different files. The first 14 play fine, regardless of which files are played, and each can be played multiple times with no issues.
When the 15th is tapped and any after that it doesn’t play any audio until you go back and then reload the page.
I did some research and I believe that this is related to limits on how many audio files that Android devices can have loaded simultaneously (my files are ~1 second and only a few KB, so it’s not a space issue but limitation on number of files).
Is there an easy way that I can have a tap() even linked to a play command for native-audio (i.e.:(tap)=“playt20a1()”) and have the playt20a1 typescript load, play, and then unload these small audio files?
I tried
playt20a1() {
this.nativeAudio.preloadComplex('t20a1', 'assets/aud/t20a1.mp3', 1, 1, 0);
this.nativeAudio.play('t20a1');
this.nativeAudio.unload('t20a1');
}
This causes issues because the unload command occurs right after the play, I would love it if I could unload it after the audio file finishes or after a 3-5 second delay to ensure it plays completely. The documentation doesn’t really detail timeout functions so I was wondering if there was another way around this issue.
Thanks,
Evan