Custom sounds on iPad not working - Fixed

Game development with Board Game Arena Studio
Post Reply
User avatar
crableybradtree
Posts: 13
Joined: 29 December 2023, 02:05

Custom sounds on iPad not working - Fixed

Post by crableybradtree »

I am having trouble getting custom sounds I added to my game (Livingstone, alpha) to play on iPad / iOS. I can hear them on Windows or Android. I hear other game custom sounds on my iPad (e.g. Parks, alpha), so I am guessing I am missing something in my implementation.

I am seeing a DOMException NotSupportedError where I think the custom sound is being played. I am guessing maybe playSound() isn't choosing the MP3 file to play and is instead trying to play the OGG file, which doesn't work on iPad?

Any tips or hints folks might have (e.g. you don't use BGA playSound() and rolled your own audio playback instead?) would be much appreciated.

***************************
Example code:

TPL file:
<audio id="audiosrc_livingstone_hammeronrock" src="{GAMETHEMEURL}img/livinstone_hammeronrock.mp3" preload="none" autobuffer></audio>
<audio id="audiosrc_o_livingstone_hammeronrock" src="{GAMETHEMEURL}img/livingstone_hammeronrock.ogg" preload="none" autobuffer></audio>

JS file:
playSound('livingstone_hammeronrock');
***************************

Game: Livingstone (Alpha)
iPad with iOS: 17.7.2
Google Chrome: 120.0.6099.119
User avatar
crableybradtree
Posts: 13
Joined: 29 December 2023, 02:05

Re: Custom sounds on iPad not working - Fixed

Post by crableybradtree »

Well, I am not the brightest bulb in the box.

It turns out I had a misspelling of the audio src filenames in my TPL file, but ONLY for the mp3 versions. Because of that, the OGGs would play correctly and since that appears to be the preference on many devices, that's why sound worked in Windows, Android, etc.; but not on iPad where OGG is not supported.
Post Reply

Return to “Developers”