I am trying to create a simple rectangle with a .mp4 video as texture. As per three.js documentation(http://threejs.org/docs/#Reference/Textures/Texture) this should be straight forward.
When I am putting link of video, all I am getting is a black colored box with no texture on it. I have tested code by replacing video with a jpg image and it works fine. Can someone please explain me what I am doing wrong.
I have already seen the examples in which video is played by first linking it to a video element and then copy the frames on a canvas. I want to try the direct way as mentioned in the three.js documentation.
Think of video as a sequence of images. So to "play" this video on your 3D object - you'll have to pass every single frame of that sequence to your material and then update that material.
Good place to start is here: https://github.com/mrdoob/three.js/wiki/Updates
Yes I understand and already made the code to work this way. However I wanted to achieve a video texture directly by passing a mp4 file link. Although I am yet to see any example doing this or being able to make it work myself but as per documentation here threejs.org/docs/#Reference/Textures/Texture is should be possible. Might be I am misinterpreting the document and currently only way to do it is by using a video tag and updating texture based on frames.
Their was an error in three.js documentation that made me assume that video can be directly used as texture. Discussed on irc and seems the one you said is the only possible solution currently.
Having in mind KISS rule (Keep It Simple Stupid), every one is trying to keep his code as neat as possible, so if there were more convenient solution to your problem - it would be used in some example already.