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

**URL:** <https://forum.babylonjs.com/t/audio-engine-cannot-read-properties-of-undefined-reading-unlocked/49758>\
**Category:** Questions\
**Created:** [April 17, 2024, 9:32am UTC](https://forum.babylonjs.com/t/audio-engine-cannot-read-properties-of-undefined-reading-unlocked/49758 "2024-04-17T09:32:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neeraj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/neeraj/32/29497_2.png) [@Neeraj](https://forum.babylonjs.com/u/Neeraj)\
**Post date:** [April 17, 2024, 9:32am UTC](https://forum.babylonjs.com/t/audio-engine-cannot-read-properties-of-undefined-reading-unlocked/49758/1 "2024-04-17T09:32:03Z")

</div>

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

```js
babylonjs-animation.js:4 Uncaught TypeError: Cannot read properties of undefined (reading 'unlocked')
    at window.addEventListener.once (babylonjs-animation.js:4:37)

```

```js
window.addEventListener(
  "click",
  () => {
    if (!BABYLON.Engine.audioEngine.unlocked) {
      BABYLON.Engine.audioEngine.unlock();
    }
  },
  { once: true }
);

```

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 17, 2024, 10:41am UTC](https://forum.babylonjs.com/t/audio-engine-cannot-read-properties-of-undefined-reading-unlocked/49758/2 "2024-04-17T10:41:02Z")

</div>

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](https://forum.babylonjs.com/t/babylon-engine-audioengine-is-undefined/13097) 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…

```javascript
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 😁

++  
Tricotou

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [April 17, 2024, 3:51pm UTC](https://forum.babylonjs.com/t/audio-engine-cannot-read-properties-of-undefined-reading-unlocked/49758/3 "2024-04-17T15:51:35Z")

</div>

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