[Error] TypeError: null is not an object (evaluating 'this._audioContext.resume')

Babylon: 6.7.0

Mobile Safari 14.0.3, 14.0.0, 14.0.1, 14.4.0, 14.3.0
Desktop Safari 14.0.3
Mobile Chrome 86.0.4240

I set BABYLON.Engine.audioEngine.useCustomUnlockedButton = true;

The line in the source code: https://github.com/BabylonJS/Babylon.js/blob/8a42ad80d4419c668120f5eedac9be6a2b8f5a3a/packages/dev/core/src/Audio/audioEngine.ts#L162

TypeError: null is not an object (evaluating ‘this._audioContext.resume’)

at ? js/babylon-6_7_0.js

Seems like this._audioContext is undefined…

it seems like, in this case, the audio context was not initialized correctly. can you reproduce that on the playground?

1 Like

I can’t reproduce because I don’t have safari 14. But I have 100+ real players who caught this error.

There is a limitation on some versions of browsers: AudioContext: AudioContext() constructor - Web APIs | MDN

(And its correlate with browsers’ versions in my report)

Extra safety added here Add extra safety on audio by sebavan · Pull Request #14180 · BabylonJS/Babylon.js · GitHub

1 Like