question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CORS Audio Loading

See original GitHub issue

Struggling to get past the following error when loading audio files from s3:

MediaElementAudioSource outputs zeroes due to CORS access restrictions for <some s3 url>

The waveform loads properly but you can’t playback the audio.

I’m using the xhr option, but it’s unclear what to pass in as the authorization token. I tried using the S3 access key id, I also tried generating this credential string: s3 credential string to no avail.

Here is my CORS policy:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration>
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedOrigin>http://*</AllowedOrigin>
    <AllowedOrigin>https://*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

I’ve looked at similar issues but they weren’t helpful. Any idea what I’m doing wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
sundayzcommented, Jul 21, 2020

I had this problem too, try the solution in #2014

you can create your own Audio object and set crossOrigin = ‘anonymous’ which seems to let chrome and firefox load cross origin audio.

0reactions
aburaicommented, Apr 24, 2020

@entonbiba we have no problems, but @alittlebitweird

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML5 Audio, Web Audio API, CORS and Firefox
The same-origin policy says that scripts run on some origin cannot read resources from another origin. (An origin is a domain, plus a...
Read more >
CORS issue from audio file in same directory? - SitePoint
Eventually (working towards this), I intend to use Spring/Thymeleaf and Web Audio API to directly load PCM into an AudioBuffer, and play sounds ......
Read more >
The Embed Audio element - HTML - MDN Web Docs - Mozilla
The HTML element is used to embed sound content in documents. ... attribute indicates whether to use CORS to fetch the related audio...
Read more >
HTML Audio/Video DOM Reference - W3Schools
load (), Re-loads the audio/video element. play(), Starts playing the audio/video ... crossOrigin, Sets or returns the CORS settings of the audio/video.
Read more >
Label Studio Documentation — Troubleshoot Label Studio
Image/audio/resource loading error while labeling. The most common mistake while resource loading is CORS (Cross-Origin Resource Sharing) problem or Cross ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found