Description
The basic issue is that SoundsJS automatically creates a Media
element on each play()
, but never releases it. On Android these Media
elements take up very limited resources (on the order of 10s). (As the Media.release()
documentation puts it: "This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback.")
The result is that after a certain number of calls to Sound.play()
, the sounds stop playing and the Android log starts showing errors (e.g. AudioFlinger: no more track names available
).
The most obvious fix would be to call release()
in CordovaAudioSoundInstance._handleCleanUp()
. (Indeed, a comment there already considers it.) That eliminates the problem, though of course you would have to add more logic to allow reusing the sound instance.