How to fix "An AudioContext was prevented from starting automatically. It must be created or resumed after a user gesture on the page." Error in console #2604
Replies: 1 comment
-
Call |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am currently using Firefox 128.0.3, and I am making a Scratch extension which uses this Web Audio API. It worked around a month ago when I found the code to play audio when clicking a Scratch block, which was: "myFirstBlock ( MY_STRING ) {
function loadSound(url) {
return fetch(url)
.then(response => response.arrayBuffer())
.then(arrayBuffer => audioContext.decodeAudioData(arrayBuffer));
}
}". I haven't updated Firefox any time since then, and I haven't changed the code in any way since last month, when I started testing this script. When I use my extension on Firefox, I receive the error, "An AudioContext was prevented from starting automatically. It must be created or resumed after a user gesture on the page." In my console on Safari, I receive the errors, "[Error] Origin https://bug-free-journey-5jg9rwqppvw3pv5w-8000.app.github.dev is not allowed by Access-Control-Allow-Origin. Status code: 404
[Error] Fetch API cannot load https://github.com/TheNoceboEffect/audiotesting/raw/master/sounds/[object%20Object]undefined; due to access control checks.
[Error] Failed to load resource: Origin https://bug-free-journey-5jg9rwqppvw3pv5w-8000.app.github.dev is not allowed by Access-Control-Allow-Origin. Status code: 404 ([object Object]undefined;, line 0)[Error] Not allowed to load local resource: blob://nullhttps//bug-free-journey-5jg9rwqppvw3pv5w-8000.app.github.dev/4f46f43b64af7fd567fc.worker.js.map
[Error] Not allowed to request resource
[Error] Cannot load blob://nullhttps//bug-free-journey-5jg9rwqppvw3pv5w-8000.app.github.dev/4f46f43b64af7fd567fc.worker.js.map due to access control checks." in my console.
Does anyone have any solutions to these errors I receive when testing my extension on Safari and Firefox?
Beta Was this translation helpful? Give feedback.
All reactions