I'm trying to load some audio files into a squarespace page that will be run through Web Audio API and I get the following error:
"MediaElementAudioSource outputs zeroes due to CORS access restrictions for..."
I inspected the response header from the Squarespace site it does not have the Access-Control-Allow-Origin header. From what I understand, Web Audio API requires the header or else it outputs zeros. Is there a way to get Squarespace to add the header in the response or am going to be forced to find a different solution? I need to process the audio with the API so I can't use HTML's <audio>
elements which would work.
Asked
Active
Viewed 1,496 times
0

Mr Lister
- 45,515
- 15
- 108
- 150

ryanroberts
- 21
- 7
-
One possible alternative to consider is what’s described in the *How to use a CORS proxy to get around “No Access-Control-Allow-Origin header” problems* section of the answer at https://stackoverflow.com/a/43881141/441757 – sideshowbarker May 30 '20 at 23:35
-
Thanks for the suggestion. I'm going to try it and see how it works. – ryanroberts May 31 '20 at 15:47
1 Answers
0
Unfortunately, you won't be able to allow cross-origin requests to assets stored on a Squarespace site. The assets are served from Squarespace's global CDN (unspecific to your website) and, correspondingly, they don't provide access to change such restrictions.

Brandon
- 3,572
- 2
- 12
- 27
-
Thank you for your answer. So I guess I will try to use an external CORS proxy to add the header to the requests. – ryanroberts May 31 '20 at 15:46