Переглянути джерело

VideoTexture: Fixed update check.

Mr.doob 7 роки тому
батько
коміт
5e04f7639a
1 змінених файлів з 3 додано та 3 видалено
  1. 3 3
      src/textures/VideoTexture.js

+ 3 - 3
src/textures/VideoTexture.js

@@ -21,7 +21,7 @@ VideoTexture.prototype = Object.assign( Object.create( Texture.prototype ), {
 
 	update: ( function () {
 
-		var prevTime = 0;
+		var prevTime = Date.now();
 
 		return function () {
 
@@ -29,9 +29,9 @@ VideoTexture.prototype = Object.assign( Object.create( Texture.prototype ), {
 
 			if ( video.readyState >= video.HAVE_CURRENT_DATA ) {
 
-				var time = performance.now();
+				var time = Date.now();
 
-				if ( prevTime + ( 1 / this.frameRate ) < time ) {
+				if ( time - prevTime >= ( 1000 / this.frameRate ) ) {
 
 					this.needsUpdate = true;
 					prevTime = time;