Cors issue after uploading to 7 #3291
Replies: 3 comments 2 replies
-
The way v7 works is:
The blob thing is there to avoid downloading the audio twice (for decoding and for playback). In your case, you might want to adjust the Content Security Policy (CSP) of your site to allow blob URLs. If that's not an option, you can switch to a custom media object like this: const audio = new Audio('https://s3-my-bucket...')
const wavesurfer = new WaveSurfer({
container: '#container',
media: audio
}) (No need to call |
Beta Was this translation helpful? Give feedback.
-
I had a similar issue using the
|
Beta Was this translation helpful? Give feedback.
-
In case someone is using |
Beta Was this translation helpful? Give feedback.
-
Bug description
I've just upgrade from 6.6.3 to 7.4.2 and suddenly getting CORS issues. My music is hosted on S3 and CORS are set on S3 to the following:
[
{
"AllowedHeaders": [],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
}
]
My code tries to load the audio like this..
wavesurfer?.load("https://mybucket.s3.eu-west-2.amazonaws.com/de5eb7e6-0e16-4f81-9d92-2e8b9a19d504.mp3", null);
But then see the following in the logs:
Refused to load media from 'blob:https://myhost.co.uk/9054a8bc-fbff-44b5-b7e5-fc5be04f5dd8' because it violates the following Content Security Policy directive: "media-src 'self' ......
I don't understand why it's trying to load a blob:url from my website host instead of the s3 url given. and I don't know where that UUID in that url is even coming from - it's not related to the URL or the data for the track.
Any ideas what could be going on? the only change I made was upgrading wavesurfer.
I have tried adding xhr section with both node: cors and mode: no-cors
xhr: {
cache: "default",
// mode: "cors",
mode: 'no-cors',
method: "GET",
credentials: "include",
headers: [
{ key: "cache-control", value: "no-cache" },
{ key: "pragma", value: "no-cache" }
]
}
Thanks, Tom
Environment
Beta Was this translation helpful? Give feedback.
All reactions