Pārlūkot izejas kodu

VideoTexture: Start update when first frame is loaded

Mugen87 7 gadi atpakaļ
vecāks
revīzija
129a32c7b8
1 mainītis faili ar 10 papildinājumiem un 1 dzēšanām
  1. 10 1
      src/textures/VideoTexture.js

+ 10 - 1
src/textures/VideoTexture.js

@@ -9,7 +9,16 @@ function VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, forma
 	Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
 
 	this.generateMipmaps = false;
-	this.needsUpdate = true;
+
+	var scope = this;
+
+	// fires when the first frame of the media has finished loading.
+
+	video.addEventListener( 'loadeddata', function () {
+
+		scope.needsUpdate = true;
+
+	} );
 
 }