Video loops in p5 web editor but error/not playing in VSC

My p5 sketches made in web editor work perfectly.

I now attempted to move them to VSC but there are issues with the video playback (either it remains frozen, or doest play back at all.) The error that I get is:

Uncaught (in promise) TypeError: f.default._friendlyAutoplayError is not a function
at p5.min.js:3

The weird thing is that when I comment out the line:
vid.hide(); I am able to see the video (sometimes playing and other times frozen).

Any advice would be greatly appreciated.

Can you share your code? It’s pretty hard to debug this otherwise. A basic sample with createVideo in VSCode with the p5.vscode extension works fine for me.

Thank you. I even removed all the animation and still getting this error:

Uncaught (in promise) TypeError: f.default._friendlyAutoplayError is not a function
at p5.min.js:3

My sketch.js code is:


function preload() {
  vid =createVideo('beetleSM.mov');
  //console.log(vid);
}

function setup() {
  createCanvas(400, 400);
  vid.loop();
  vid.hide();
}

function draw() {
  image(vid, 0, 70, 400, 250); 
}

This is my folder contents:

How are you running/viewing your sketch from VSCode? When I right click index.html and “Open With Live Server” your example runs fine.

Thank you for trying. Is it working in Chrome? (I have the Go Live extension to run live server.) I wonder if it is the loop function that Chrome may be blocking? Tried vid.play() and same problems.

Yup, works ok in Chrome too so long as I navigate to http://localhost:5500 which is where my live server is running. Obviously it does not work if you try to go to the file:// url for the html file (i get a totally different error in that case but just wanted to make sure that was clear).