arwes / arwes

Futuristic Sci-Fi UI Web Framework.

Home Page:https://arwes.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sounds not playing before user interaction (introduced in alpha-19)

florianbepunkt opened this issue · comments

First of all thank you for this package. Beside the obvious awesomeness it is inspiring to see how you manage, organize and structure this project.

Describe the bug

Upgrading from alpha-18 to alpha-19 bleeps are not played on the first screen in chrome. It gives the warning:
The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

After first user interaction sounds are played.

I believe this is newly introduced in alpha 19.

Hello @florianbepunkt !

By default, Chrome and Firefox will block audio playback until the user makes an interaction with the window. Check out Web Audio, Autoplay Policy and Games.

In alpha.19 the bleeps API was changed to only play sounds when the browser AudioContext is unlocked. There were a few issues when internally the sounds were "tried" to be played and the browser audio was locked.

I added more details in Arwes Sound Accessibility.

My recommendation is: if you really need to play sounds from the beginning, you have to add something like a modal with a button to force the user to interact with the site before entering the application and enabling audio playback.

Let me know if you have any question 😉

Makes sense, thank you