p5.js-sound
p5.js-sound copied to clipboard
LoadSound CORS
Nature of issue?
- [ ] Found a bug
- [ ] Existing feature enhancement
- [√] New feature request
Most appropriate sub-area of p5.js?
- [ ] Color
- [ ] Core/Environment/Rendering
- [ ] Data
- [ ] Events
- [ ] Image
- [ ] IO
- [ ] Math
- [ ] Typography
- [ ] Utilities
- [ ] WebGL
- [ ] Other (specify if possible)
Which platform were you using when you encountered this?
- [ ] Mobile/Tablet (touch devices)
- [ ] Desktop/Laptop
- [ ] Others (specify if possible)
Details about the bug:
- p5.js version:
- Web browser and version:
- Operating System:
- Steps to reproduce this:
Feature enhancement details:
New feature details:
When I using loadSound from p5.sound, I met CORS error. I was wondering if p5.js can support loading music from online url.
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.
@limzykenneth is this issue open? i would to work on this issue. Can you please guide me a bit?
@adrijshikhar Sorry I'm not familiar enough with p5.Sound to be working on it so I can't really answer your fully. This is a rather old issue and the first thing you can do is to try and replicate it to see if it is indeed a bug or not.
Still a revelant issue. I can confirm
@swirly Can you post a minimal example showing the issue?
Just use openprocessing for testing https://www.openprocessing.org/sketch/995201 If you replace native html5 audio calls by p5sound, you will have CORS error on loadsound
The audio source at the link you provided does not have CORS enable which means that the source website is not allowing the file to be used on other websites. The server will need to provide the relevant CORS headers for loadSound to work and I imagine not all sound site would be willing to enable that header (it will enable any other site to host their content as if it is their own).
That's it, exactly. The problem is that if you use html5 native audio through javascript, it works. So loadsound explicitly need CORS while html5/vanillaJS can get without it.
Not really thrilling for a higher level API that should simplify developpers life.