No audio when using Base64 as audio path

Hi! For the purpose of my project, I need to build a game without any external files. In order to do so, my textures/sprites and audio files are convert to a base64 data string. It works fine for the textures/sprites but it does not work for the audio.

I tested my audio with the relative string path in my public folder and it works. Is it possible that the audio with base64 is not supported?


Hi @Rangerz132 and welcome to the forum! Let me add @bghgary to see if he has an idea.

@Rangerz132 Can you provide a playground with a repro? Thanks.

Hi @bghgary! Here’s a simple playground : Babylon.js Playground

I’m not quite familiar with the playground environment but I hope that it will give you an idea of the issue. In order to convert my audio into base64, Im using this link : MP3 to Base64 | Audio | Base64 Encode | Base64 Converter | Base64

It looks like the Sound constructor doesn’t support base64 urls, but it does support array buffers, so you can just convert it before passing it in.



Wow! Thanks a lot!

1 Like