Bug "DefoldSoundDevice is not defined" on HTML5


There is an error in the console of an HTML5 build when sound system is disabled by using the manifestation tool and setting the appmanifest file.

Uncaught ReferenceError: DefoldSoundDevice is not defined
    at onMouseButtonUp (SoundNullCrash_wasm.js:1)
onMouseButtonUp @ SoundNullCrash_wasm.js:1

Emerges when user clicks the game area.

I suspect there was a quick fix in the engine to bypass browser requirement to only play sound on user request, but it looks like someone forgot to check if the sound device is actually used by Defold. Which is not in case of disabling the sound system.

Working on my OpenAL extension, I am getting the sound on Chrome, but it doesn’t work in Safari. I suspect this error may somehow be related. We’ll see once it’s fixed.

1 Like


This sound bug I think also relates to @britzl Blip extension not working either. I’ve been trying to get that and OpenAL to work and working with @sergey.lerg on the HTML5 builds and we’ve gotten it closer but not close enough. Hopefully a Defold update can solve the problem now that we’ve narrowed it down a bit.

1 Like


I’ve added it for investigation in 1.2.166



I’ve added a fix for this. It will be available in the 1.2.166 release.



So I tested 1.2.166 and HTML5 sound in the OpenAL extension works better I think. Chrome starts sounds when you click into the app. Safari doesn’t. Yet Safari isn’t throwing the same errors we were seeing in the console. Some further investigation lead me here : https://www.igorkromin.net/index.php/2019/09/09/bypassing-safaris-stop-media-with-sound-feature-for-html5-canvas-webassembly/ and I did visit preferences and did the change to “Allow All Auto Play” and refreshed the HTML5 build and viola! Sound! Still need to try and get this to work without forcing users to go to their preferences so it may require some sort of button, adjustment to code using OpenAL extension. Need to experiment with that. But it seems like we might be close to no sound issues with Safari / HTML5 now which is great.

@britzl I want to try and get Blip working now.

UPDATE: Blip works as is with HTML5 build on Safari BUT only if I make the Website preferences change as I did with OpenAL. It seems like we need to figure out in code or the extensions how to initialize the sound in HTML5 such that Safari doesn’t block it AND you don’t need users changing Web site preferences. I’m not 100% sure how to do that, or if it can be done without modifications to the underlying Blip or OpenAL code. Chrome works right away though.

So overall things seem specific to Safari and it’s internal efforts to block unwanted autoplay of sounds.


1 Like