简体   繁体   English

Three.js:视频纹理NeedsUpdate停止渲染

[英]Three.js: video Texture NeedsUpdate stop rendering

I try to put a video as a texture on a mesh, for that, I tested 2 differents example: 我尝试将视频作为纹理放在网格上,为此,我测试了2种不同的示例:

http://jeromeetienne.github.io/threex.videotexture/examples/videotexture.html http://jeromeetienne.github.io/threex.videotexture/examples/videotexture.html

and

http://stemkoski.github.io/Three.js/Video.html http://stemkoski.github.io/Three.js/Video.html

Both works as expected on the web but it doesn't show anything if I download them from github in local. 两者都可以在网络上按预期工作,但是如果我从本地的github下载它们,它们什么也不会显示。

If I put 如果我放

videoTexture.needsUpdate = false;

then floor and screen are displayed. 然后显示楼层和屏幕。 The video is working correctly as I can heard the sound behind but no images are displayed. 视频可以正常播放,因为我可以听到背后的声音,但没有图像显示。

Any idea how to resolve this problem ? 任何想法如何解决这个问题?

(I have tested with both firefox and chromium). (我已经使用Firefox和Chrome进行了测试)。

Edit: in the console of firefox, I have this 编辑:在Firefox的控制台中,我有这个

SecurityError: The operation is insecure. Three.js:25696:0
Error: WebGL: The canvas used as source for texImage2D here is tainted (write-only). It is forbidden to load a WebGL texture from a tainted canvas. A Canvas becomes tainted for example when a cross-domain image is drawn on it. See https://developer.mozilla.org/en/WebGL/Cross-Domain_Textures

The problem was completly different than what I thought. 这个问题与我所想的完全不同。

As I was running the file from a local folder and not from the local server, I had the Same-Origin Policy Problem. 当我从本地文件夹而不是本地服务器运行文件时,出现了“ 同源策略问题”。

As explain in this answer : https://stackoverflow.com/a/24042463/1224782 如此答案中的解释: https : //stackoverflow.com/a/24042463/1224782

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM