To help support this project, please take a moment to look at my official TypeScript courses in
Three.js and TypeScript and
Socket.IO and TypeScript
This html creates a 3d cube in three.js and uses the webcam video as the texture. I only made it work in chrome at the moment, and you need your webcam plugged in so it can connect.
https://sean-bradley.github.io/Webcam-as-Texture-using-Three.js/
https://www.youtube.com/watch?v=SdYf4OvnVxY
Added chroma option from the seriously.js library so chroma keying can also be applied at the webcam capture level.
Settings shown work best for my situation. You will need to adjust for your own environment.
If you got this far, you probably like TypeScript just like I do, I have created two TypeScript courses specializing in the Three.js and Socket.IO libraries that you may find useful.