Quantum-Game / quantum-game-2

LEGACY open-source version of Quantum Game 2 (Sept 2019 - Oct 2020)
https://quantumgame.io
MIT License
65 stars 16 forks source link

Tone.js: "AudioContext was not allowed to start" warning #237

Closed stared closed 3 years ago

stared commented 4 years ago

When opening the main page, there is a warning (or actually: MANY warnings).

Screenshot 2020-10-03 at 11 17 16

AFAIR Tone.js can be initialized only after user input.

Frizi commented 3 years ago

The "audio not starting" part of the issue can be fixed, but the warning will still be there. It will always appear at least a few times, as this is simply what chrome does on audio context creation. Tone creates it immediately on import and deferring the import isn't worth it. Also the only way to check if the browser requires the event is to create the context and see if it's already running. So the warning is inevitable.