Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom audio embedder does not load audio from other sites #41

Open
aleksati opened this issue Apr 24, 2023 · 2 comments
Open

Custom audio embedder does not load audio from other sites #41

aleksati opened this issue Apr 24, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@aleksati
Copy link
Contributor

aleksati commented Apr 24, 2023

I think this is not working properly, I think.

The custom audio embedder (https://github.com/MCT-master/mct-master.github.io#embedding-audio) only works for audio stored locally in the repository. Tested it with .wav audio loaded the from UiO blog repository for large files, but it did not fetch properly.

To edit the audio embedded, go to "utils/waveform.js"

@aleksati aleksati added the bug Something isn't working label Apr 24, 2023
@aleksati
Copy link
Contributor Author

Apparently, it's a CORS issue as I get these error messages:

Acess to fetch at 'https://www.uio.no/english/studies/programmes/mct-master/blog/assets/audio/......wav' from origin 'http://127.0.0.1:4000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

@aleksati
Copy link
Contributor Author

Adding a "no-cors" option to the WaveSurfer object fixed the CORS issue:

// utils/waveform.js - line 86
  let waveSurfer = WaveSurfer.create({
     ...,
    xhr: {
      mode: "no-cors",
    },
  });

However, another issue immerged. Now, it's just this:

Error: HTTP error status: 0
at fetch.js:210:19

When trying to load audio from a different server/site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant