Working With Video
The pipeline for adding a video file to the advanced editor will be described below.
Creating a script
First of all, you need to add a new script.

Next, you need to enter the code editing mode by clicking Edit.

Working with code
First you need to create a new HTML-element video (string 1).
Next, we need to create a texture from the videoElem element, this is done using THREE.VideoTexture (string 2).
Now you need to add a plane to the scene, on which the video will be added (strings 3-6).
In this case, videoPlane is created, with a height of 2 and a width of 1, and the videoTexture, created earlier, is used as the material.
After creating a plane with video texture, you can add it to the scene (string 7).
If this script is linked to the scene, then adding an object to the scene will be recorded not as scene.add(), but as this.add().This is necessary for the correct importing of a scene into a simple editor.
Now we need to configure the added videoPlane.
The first step is to add a source. Best of all, if it is a CDN or a cloud that supports Access-Control-Allow-Origin (string 8).
Next, a very important moment. You need to add the following string videoElem.src = "https://365508.selcdn.ru/examples/small.mp4"; (string 9):
If this is not done, the video will not appear when starting the scene, and the following error will return in the console:

The final steps are to enable/disable video looping and audio presence (strings 10-11).
And, most importantly, you need to start playing the video file (string 12).
This way, any video can be added to the scene.
Last updated