Hi everyone!
I’m working on a larger sketch that needs to be able to play videos and control them with p5.touchgui elements. As you’ll see when you open my sketch, the video will only sometimes play, and a lot of the time throw the following error:
WARN: Element play method raised an error asynchronously
Error {stack: "[43]</_main.default.MediaElement.prototype.play@https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js:69814:24
draw@about:srcdoc:75:15
[39]</_main.default.prototype.redraw@https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js:65953:19
p5/this._draw@https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js:58869:25
"} stack: "[43]</_main.default.MediaElement.prototype.play@https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js:69814:24
draw@about:srcdoc:75:15
[39]</_main.default.prototype.redraw@https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js:65953:19
p5/this._draw@https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js:58869:25
"
I have no idea what is really causing this, or what I can do to fix it. The error message honestly doesn’t make any sense to me. This is my first time working with video in p5, so I apologize for my newness here… What I’m trying to do is have the toggle trigger a sequence that displays the video, plays it, and when the video gets to the end, have it pause and hold the image on screen until the toggle is turned off. When it is turned off, I want the video to go back to the beginning so that it can play again from the beginning next time the toggle turns on, essentially resetting itself. What is weird to me is that sometimes this works, and sometimes it doesn’t. I just mash the toggle on and off and it inconsistently works, so I really don’t know what is causing that inconsistency. Any help would be greatly appreciated.
Thanks!
if the hyperlink didn’t work, again, my sketch is at p5.js Web Editor if you’d like to take a look at the code