Video as gl texture setup?

Trying to get a video as a gl texture:
https://codepen.io/jedierikb/pen/MdvqGp

Any suggestions what steps I missed to get the video to appear as a texture?
Much appreciated, thanks!

Got it -
https://codepen.io/jedierikb/pen/dEVKWL?editors=0010

2 Likes

Thank you for sharing your solution!

B/c CodePen uses the “https://” scheme, any loadings have to use it as well in order to avert CORS access exceptions:

Change:
‘http://CommonDataStorage.GoogleApis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4’

To:
‘https://CommonDataStorage.GoogleApis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4’

Also, you can delete the 2nd sk.texture(sk.vid); statement.

1 Like

A note on documentation -

says
Loading images for texturing inside the preload() method is generally a best practice, but it is especially helpful when working with video since video files are generally larger than static images and can take therefore extra time to load.

But, as my first attempt demonstrates, I was not able to use preload. Is the documentation out of date or is there a different way to use preload for video effectively in this situation? Thanks!