Hello, I have a problem with video texture in my project. I am using Nuxt.js as a framework .
I have a problem with playing video in videotexture. I am using planegeometry and videotexture.
This is my GitHub repository.
I will be very thankful if you can look at three.js part of my code and help me with my task.
//SET PLANEGEOMETRY
const video = document.getElementById(“video”);
video.play()
const texture = new THREE.VideoTexture(video);
texture.minFilter = THREE.LinearFilter;
texture.magFilter = THREE.LinearFilter;
texture.format = THREE.RGBFormat;
const geometry = new THREE.PlaneGeometry(5, 2);
const material = new THREE.MeshBasicMaterial({ map: texture });
const plane = new THREE.Mesh(geometry, material);
plane.material.side = THREE.DoubleSide;
plane.position.y = 1;
this.scene.add(plane);
In this part of my code where I add a VIDEOTEXTURE is not working properly Can you please say which part of code I fail. I am new in three.js thnak you
and the video is not showing on PlaneGeometry this is what I get I want to play video after three.js starts
and I get this error Uncaught (in promise) DOMException and I could not find any article that helps me to avoid this error in three.js
yes they do work fine. I used this article for my project. http://stemkoski.github.io/Three.js/Video.html
the only thing I think is that all projects have a play button which gives time to load video I used
video.onloadeddata = function() { // the function will trigger after data loads
video.play()
};
but it did not work
Just playback the video will cause a security error since a user interaction is required when starting the video and if it is not muted. Besides, notice that ogg files are not supported in Safari (that’s why I asked for your browser).