Game sounds are good on android and desktop browser, but not for iOS devices.
Its have a delay around 500-1000 each sound play, irregular.
What i do is preload all sound on preloader this.load.audio(key, urls);
, then play it by call this.sound.play(key);
on game scene.
How to fix this?
Tested on iPhone 11, mp3 files, 128kbps (all).
I have some ideas, but not sure which is suited for your case.
- If you use Cordova, play the audio with Cordova plugin like Media.
- If you play the game on Safari:
- Try to set phaser config: audio: {disableWebAudio: true}
- Try to use Audio Sprite in Phaser 3
- Try howlerjs
Thanks for your reply.
I just do another method to fix this issue.
I use m4a audio format instead of mp3, and make all audio bitrate same.
If i put audio: {disableWebAudio: true}, sometimes audio keep delaying, but when remove it (default), game audio just working fine.
Hey, are you using capacitor/cordova for this, or just normal web app?
I got same issue while using capacitorjs to wrap phaser game into android/iOS hybrid app, solved using howlerjs. Thank you @NickChowHK for suggesting this library.
I am working on the Cordova App with Media Plugin, which don’t require to preload the audio file before usage and able to play the sound instantly
I’m using capacitorjs.
Already tried media plugin too, still lagging.
Also already tried native audio plugin, as i can remember, it didn’t work.
The best option for me is using howler.js