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

**URL:** <https://discourse.processing.org/t/video-loops-in-p5-web-editor-but-error-not-playing-in-vsc/30028>\
**Category:** Coding Questions\
**Created:** [May 11, 2021, 2:21am UTC](https://discourse.processing.org/t/video-loops-in-p5-web-editor-but-error-not-playing-in-vsc/30028 "2021-05-11T02:21:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![monkey](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@monkey](https://discourse.processing.org/u/monkey)\
**Post date:** [May 11, 2021, 2:21am UTC](https://discourse.processing.org/t/video-loops-in-p5-web-editor-but-error-not-playing-in-vsc/30028/1 "2021-05-11T02:21:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KumuPaul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kumupaul/32/13072_2.png) [@KumuPaul](https://discourse.processing.org/u/KumuPaul)\
**Post date:** [May 11, 2021, 3:13am UTC](https://discourse.processing.org/t/video-loops-in-p5-web-editor-but-error-not-playing-in-vsc/30028/2 "2021-05-11T03:13:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![monkey](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@monkey](https://discourse.processing.org/u/monkey)\
**Post date:** [May 11, 2021, 12:27pm UTC](https://discourse.processing.org/t/video-loops-in-p5-web-editor-but-error-not-playing-in-vsc/30028/3 "2021-05-11T12:27:17Z")

</div>

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:

```let

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:

 ![newTEST](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b87bfd7d87602f756bf9b1173f56cfd298024411.jpeg)

---

<div class="post-metadata">

**Author:** ![KumuPaul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kumupaul/32/13072_2.png) [@KumuPaul](https://discourse.processing.org/u/KumuPaul)\
**Post date:** [May 11, 2021, 6:37pm UTC](https://discourse.processing.org/t/video-loops-in-p5-web-editor-but-error-not-playing-in-vsc/30028/4 "2021-05-11T18:37:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![monkey](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@monkey](https://discourse.processing.org/u/monkey)\
**Post date:** [May 13, 2021, 3:08am UTC](https://discourse.processing.org/t/video-loops-in-p5-web-editor-but-error-not-playing-in-vsc/30028/5 "2021-05-13T03:08:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KumuPaul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kumupaul/32/13072_2.png) [@KumuPaul](https://discourse.processing.org/u/KumuPaul)\
**Post date:** [May 13, 2021, 3:39am UTC](https://discourse.processing.org/t/video-loops-in-p5-web-editor-but-error-not-playing-in-vsc/30028/6 "2021-05-13T03:39:41Z")

</div>

Yup, works ok in Chrome too so long as I navigate to [http://localhost:5500](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).
