P5.js video upload into switch statement

Thanks. It would have been much helpful if you posted the code in the first place :slight_smile: However the code is quite big and has a lot of things that are not relevant to the question. Check out “Is your problem isolated?” in the guideline.

(I know, at this point it’s hard to “isolate” the issue because you already put a lot of effort in the code so taking it apart to figure out the problem sounds like a tedious job. But as you are asking for help, someone has to do that job to solve the issue)

The first thing I noticed is that you commented out the video part. And the source video seems not uploaded on the editor. Did you do it deliberately or did you forget to upload it? Or maybe you couldn’t upload it because of the size limit (file has to be <5MB) ?

If that is not the issue, again, you need to first comment out parts of the code that are irrelevant to the video playback. Or, in this case, I would make a project from scratch and see if I can switch between 2 videos using switch-case statement. For example, this can be a starting point:

https://editor.p5js.org/micuat/sketches/PibMeSsHm

and then you can replace the background with another video to see if you can switch between 2 videos. Note that as I wrote above, video.position(0,0) is not how you want to do it in this case. It will place the video DOM element over the canvas. You need to draw the video using image instead. Also don’t forget to hide the video.