samedi 15 août 2020

Testing audio in browser using Mocha (needs user interaction)

I have some Mocha tests running in the browser and that is all working great so far -- but I'm now trying to expand that to test some WebAudio. Unfortunately, when I run my test I get the following in my console:

The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.

Which is certainly correct behavior from the browser but it keeps my test from continuing.

Is there a way to get around this? I was thinking of putting a button on the page and having the mocha.run(); command behind the click handler.

Is there a more elegant way to do that?

Aucun commentaire:

Enregistrer un commentaire