I made it with Phaser 3, on mobile it can crash the browser after playing many songs, I don’t know why… I clean the cache etc, any idea is good to take !
What do you mean you clean the caches? How do you do that?
Do you properly dispose any instances of media player related objects like media streams, media stream tracks, media player, audio nodes etc. in case you use them?
let mp3Load = homeScene.load.audio("drums_mp3", 'drums.mp3');
For each track (voice, guitar etc, each time the same key name - I supposed it replace the old one- )
And then when you load a new song, I “clear the cache” like this :
homeScene.load.reset();
//TAB_INSTR is an array containing the sound objects
TAB_INSTR.forEach((item, index) => {
item.destroy();
item = null;
});
homeScene.cache.audio.entries.each(function (snd) {
snd = null;
}, homeScene);
homeScene.cache.audio.entries.clear();
Getting into what does these Phaser functions do under the hood can give you ideas about what you should do about resource usage economy. Maybe you need to use another function, tweak some or implement a little custom functionality. Again I would suggest you look more for Web Audio and gotchas to use it efficiently.