Hello, I am relatively new to p5 and am running into a problem I would really love help with.
I am in the beginning stages of an interactive art piece.
When I download my sketch from the web editor and try and open it, I am stuck on a loading screen 4ever! I have preloaded my files and am opening my index.html from inside my downloaded folder so all the assets should be available.
here is my sketch which works fine in the editor.
don’t quite understand what’s going on , but i got this to work by downloading web server for chrome extension and openning the site there. it also worked when i uploaded to my webserver, but wouldn’t work locally
This has to do with how loadImage and loadSound are implemented. The functions use something called Fetch API and have that configured in such a way that downloading of files isn’t allowed locally. Believe it or not, it’s related to security.
There’s not much you can do about it really (except patching p5.js). Running a web server (locally or elsewhere) as you did is the way to go.
If you’re interested in the technical details, read up on CORS and Fetch API.