Audio Engine Cannot read properties of undefined (reading 'unlocked')

In previous version it was working properly now this is giving an error.
currently I’m using the cdn.

babylonjs-animation.js:4 Uncaught TypeError: Cannot read properties of undefined (reading 'unlocked')
    at window.addEventListener.once (babylonjs-animation.js:4:37)
window.addEventListener(
  "click",
  () => {
    if (!BABYLON.Engine.audioEngine.unlocked) {
      BABYLON.Engine.audioEngine.unlock();
    }
  },
  { once: true }
);

To me it appears that the issue is not related to unlocked, but to the fact that your BABYLON.Engine.audioEngine itself is undefined

Maybe this topic might help ?

I’ve never used directly the BABYLON.Engine.audioEngine to be honest, and I don’t know if it’s supposed to be created by default…

if(!BABYLON.Engine.audioEngine){
    BABYLON.Engine.audioEngine = BABYLON.Engine.AudioEngineFactory();
}

This works, but maybe it’s not meant to be created manually, I don’t know :grin:

++
Tricotou

1 Like

Yes, this is the issue. It will be fixed soon (PR already submitted)

2 Likes