以三个JS纹理实现视频,我遇到了这样的问题:我的视频有时加载时没有错误,而其他时候却出现Uncaught (in promise) DOMException
并且没有视频加载。
我认为问题是我需要等待视频加载后才能将其设置为素材:
var video = document.createElement( 'video' );
video.src = './src/images/sintel.ogv';
video.load(); // must call after setting/changing source
video.preload = 'auto';
video.autoload = true;
video.play();
var texture = new THREE.VideoTexture( video );
texture.minFilter = THREE.LinearFilter;
texture.magFilter = THREE.LinearFilter;
texture.format = THREE.RGBFormat;
// var runnerTexture = new THREE.ImageUtils.loadTexture( 'images/run.png' );
// annie = new TextureAnimator( runnerTexture, 10, 1, 10, 75 ); // texture, #horiz, #vert, #total, duration.
var runnerMaterial = new THREE.MeshBasicMaterial( { map: texture, side:THREE.DoubleSide } );
我不知道该怎么办。尝试将预加载添加到视频中,但无效。