Is that possible to pass unlocked audioContext to Babylon?

I have unlocked audioContext with native JS using a tap on a screen and:

const ctx = new AudioContext();
ctx.resume();

So now I should pass this context to BJS. Is this possible pass that context to BJS without using Engine.audioEngine.unlock() as I already have the context unlocked?

I use my unlocked context shared between several games on the website so it’s very unprofessional to make one more unlock screen per each game.
For instance, there are many html5 game publishing websites with audioContext unlocked before the game started so it doesn’t need to make one more click-screen just to start a music at the start of a game.

cc @RaananW

You can create your own audio engine and provide it with an audio context. You will need to disable the auto-audio-engine-creation feature. this playground has an example how to do it, but better would be to pass audioEngine: false to the engine creation options.

Here is the playground:

2 Likes