Create video element in the three.js/editor

I’m trying to add a video element to three.js / editor, but I can’t do it. Is it possible to add a video texture without getting involved in adding new elements to HTML? For example, using a link?

let video, videoTexture, movieScreen;

video = 'URL TO VIDEO';

videoTexture = new THREE.VideoTexture(video);
videoTexture.needsUpdate = true;

const videoMaterial = new THREE.MeshBasicMaterial({ map: videoTexture, side: THREE.DoubleSide });

const planeGeometry = new THREE.PlaneGeometry( video.videoWidth, video.videoHeight,	4,	4 );
videoElem = new THREE.Mesh(planeGeometry, videoMaterial);


I don’t think it’s going to work that way. But I don’t understand how to make this code work. Thank you all for your help!

This code does indeed not work since the constructor of VideoTexture requires a video element as an argument. A simple URL is not sufficient.

I’ve never tried it but maybe it works if you create the video element inline via Document.createElement()?