The AudioContext was not allowed to start
See original GitHub issueI get a warning on page load even when I haven’t actually called play()
yet. It seems like this is an issue in howler because they call new AudioContext()
immediately.
Is it possible to somehow workaround this in use-sound
?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:7 (2 by maintainers)
Top Results From Across the Web
The AudioContext was not allowed to start - Stack Overflow
I have this Javascript code which I am using to capture audio input from user when they click on a microphone button. This...
Read more >Follow-up: The AudioContext was not allowed to start. #1744
The error The AudioContext was not allowed to start was thrown by Chrome when there is no user interaction. This seems like our...
Read more >Autoplay Policy in Google Chrome (Critical Info for Developers)
Unfortunately, if we check the dev tools in Google Chrome, we see that we're getting a warning The AudioContext was not allowed to...
Read more >The AudioContext was not allowed to start. It ... - Unity Forum
The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on t.
Read more >Why can I see warning messages "The AudioContext was not ...
That is normal behavior and won't affect final users in any way: some browsers won't allow audio to be played by our library...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We ended up rolling our own Howler hooks due to this issue. We came up with an elegant solution: Simply waiting for user interaction as the error states.
First need a hook that tracks first user interaction events according to the specs:
Then we wrapped howler in a simple async dynamic import hook that only loads it after the first user interaction.
All this in only a few Kb of js. Simply use it like this:
(pseudo code)
hello sir, can i see full of your code to play audio?