瀏覽代碼

One more video (bis)

sebastien 7 年之前
父節點
當前提交
37117c7596

文件差異過大導致無法顯示
+ 7490 - 7491
Playground/babylon.d.txt


文件差異過大導致無法顯示
+ 11614 - 11615
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 2 - 2
dist/preview release/babylon.js


+ 17 - 19
dist/preview release/babylon.max.js

@@ -64734,12 +64734,6 @@ var BABYLON;
             _this._stillImageCaptured = false;
             _this._createInternalTexture = function () {
                 if (_this._texture != null) {
-                    if (!_this._texture.isReady) {
-                        _this._textureReady();
-                    }
-                    else {
-                        _this._updateInternalTexture();
-                    }
                     return;
                 }
                 if (!_this._engine.needPOTTextures ||
@@ -64753,8 +64747,23 @@ var BABYLON;
                     _this._generateMipMaps = false;
                 }
                 _this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this._samplingMode);
-                if (_this.video.readyState >= _this.video.HAVE_FUTURE_DATA) {
-                    _this._textureReady();
+                if (!_this.video.autoplay) {
+                    _this.video.play();
+                    setTimeout(function () {
+                        _this._texture.isReady = true;
+                        _this._updateInternalTexture();
+                        _this.video.pause();
+                        if (_this._onLoadObservable && _this._onLoadObservable.hasObservers()) {
+                            _this.onLoadObservable.notifyObservers(_this);
+                        }
+                    }, 9);
+                }
+                else {
+                    _this._texture.isReady = true;
+                    _this._updateInternalTexture();
+                    if (_this._onLoadObservable && _this._onLoadObservable.hasObservers()) {
+                        _this.onLoadObservable.notifyObservers(_this);
+                    }
                 }
             };
             _this.reset = function () {
@@ -64786,7 +64795,6 @@ var BABYLON;
                 _this.video.loop = settings.loop;
             }
             _this.video.addEventListener("canplay", _this._createInternalTexture);
-            _this.video.addEventListener("canplaythrough", _this._createInternalTexture);
             _this.video.addEventListener("paused", _this._updateInternalTexture);
             _this.video.addEventListener("seeked", _this._updateInternalTexture);
             _this.video.addEventListener("emptied", _this.reset);
@@ -64826,15 +64834,6 @@ var BABYLON;
             return video;
         };
         ;
-        VideoTexture.prototype._textureReady = function () {
-            if (this._texture) {
-                this._texture.isReady = true;
-                this._updateInternalTexture();
-                if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
-                    this.onLoadObservable.notifyObservers(this);
-                }
-            }
-        };
         /**
          * Internal method to initiate `update`.
          */
@@ -64875,7 +64874,6 @@ var BABYLON;
         VideoTexture.prototype.dispose = function () {
             _super.prototype.dispose.call(this);
             this.video.removeEventListener("canplay", this._createInternalTexture);
-            this.video.removeEventListener("canplaythrough", this._createInternalTexture);
             this.video.removeEventListener("paused", this._updateInternalTexture);
             this.video.removeEventListener("seeked", this._updateInternalTexture);
             this.video.removeEventListener("emptied", this.reset);

+ 17 - 19
dist/preview release/babylon.no-module.max.js

@@ -64701,12 +64701,6 @@ var BABYLON;
             _this._stillImageCaptured = false;
             _this._createInternalTexture = function () {
                 if (_this._texture != null) {
-                    if (!_this._texture.isReady) {
-                        _this._textureReady();
-                    }
-                    else {
-                        _this._updateInternalTexture();
-                    }
                     return;
                 }
                 if (!_this._engine.needPOTTextures ||
@@ -64720,8 +64714,23 @@ var BABYLON;
                     _this._generateMipMaps = false;
                 }
                 _this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this._samplingMode);
-                if (_this.video.readyState >= _this.video.HAVE_FUTURE_DATA) {
-                    _this._textureReady();
+                if (!_this.video.autoplay) {
+                    _this.video.play();
+                    setTimeout(function () {
+                        _this._texture.isReady = true;
+                        _this._updateInternalTexture();
+                        _this.video.pause();
+                        if (_this._onLoadObservable && _this._onLoadObservable.hasObservers()) {
+                            _this.onLoadObservable.notifyObservers(_this);
+                        }
+                    }, 9);
+                }
+                else {
+                    _this._texture.isReady = true;
+                    _this._updateInternalTexture();
+                    if (_this._onLoadObservable && _this._onLoadObservable.hasObservers()) {
+                        _this.onLoadObservable.notifyObservers(_this);
+                    }
                 }
             };
             _this.reset = function () {
@@ -64753,7 +64762,6 @@ var BABYLON;
                 _this.video.loop = settings.loop;
             }
             _this.video.addEventListener("canplay", _this._createInternalTexture);
-            _this.video.addEventListener("canplaythrough", _this._createInternalTexture);
             _this.video.addEventListener("paused", _this._updateInternalTexture);
             _this.video.addEventListener("seeked", _this._updateInternalTexture);
             _this.video.addEventListener("emptied", _this.reset);
@@ -64793,15 +64801,6 @@ var BABYLON;
             return video;
         };
         ;
-        VideoTexture.prototype._textureReady = function () {
-            if (this._texture) {
-                this._texture.isReady = true;
-                this._updateInternalTexture();
-                if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
-                    this.onLoadObservable.notifyObservers(this);
-                }
-            }
-        };
         /**
          * Internal method to initiate `update`.
          */
@@ -64842,7 +64841,6 @@ var BABYLON;
         VideoTexture.prototype.dispose = function () {
             _super.prototype.dispose.call(this);
             this.video.removeEventListener("canplay", this._createInternalTexture);
-            this.video.removeEventListener("canplaythrough", this._createInternalTexture);
             this.video.removeEventListener("paused", this._updateInternalTexture);
             this.video.removeEventListener("seeked", this._updateInternalTexture);
             this.video.removeEventListener("emptied", this.reset);

文件差異過大導致無法顯示
+ 2 - 2
dist/preview release/babylon.worker.js


+ 17 - 19
dist/preview release/es6.js

@@ -64701,12 +64701,6 @@ var BABYLON;
             _this._stillImageCaptured = false;
             _this._createInternalTexture = function () {
                 if (_this._texture != null) {
-                    if (!_this._texture.isReady) {
-                        _this._textureReady();
-                    }
-                    else {
-                        _this._updateInternalTexture();
-                    }
                     return;
                 }
                 if (!_this._engine.needPOTTextures ||
@@ -64720,8 +64714,23 @@ var BABYLON;
                     _this._generateMipMaps = false;
                 }
                 _this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this._samplingMode);
-                if (_this.video.readyState >= _this.video.HAVE_FUTURE_DATA) {
-                    _this._textureReady();
+                if (!_this.video.autoplay) {
+                    _this.video.play();
+                    setTimeout(function () {
+                        _this._texture.isReady = true;
+                        _this._updateInternalTexture();
+                        _this.video.pause();
+                        if (_this._onLoadObservable && _this._onLoadObservable.hasObservers()) {
+                            _this.onLoadObservable.notifyObservers(_this);
+                        }
+                    }, 9);
+                }
+                else {
+                    _this._texture.isReady = true;
+                    _this._updateInternalTexture();
+                    if (_this._onLoadObservable && _this._onLoadObservable.hasObservers()) {
+                        _this.onLoadObservable.notifyObservers(_this);
+                    }
                 }
             };
             _this.reset = function () {
@@ -64753,7 +64762,6 @@ var BABYLON;
                 _this.video.loop = settings.loop;
             }
             _this.video.addEventListener("canplay", _this._createInternalTexture);
-            _this.video.addEventListener("canplaythrough", _this._createInternalTexture);
             _this.video.addEventListener("paused", _this._updateInternalTexture);
             _this.video.addEventListener("seeked", _this._updateInternalTexture);
             _this.video.addEventListener("emptied", _this.reset);
@@ -64793,15 +64801,6 @@ var BABYLON;
             return video;
         };
         ;
-        VideoTexture.prototype._textureReady = function () {
-            if (this._texture) {
-                this._texture.isReady = true;
-                this._updateInternalTexture();
-                if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
-                    this.onLoadObservable.notifyObservers(this);
-                }
-            }
-        };
         /**
          * Internal method to initiate `update`.
          */
@@ -64842,7 +64841,6 @@ var BABYLON;
         VideoTexture.prototype.dispose = function () {
             _super.prototype.dispose.call(this);
             this.video.removeEventListener("canplay", this._createInternalTexture);
-            this.video.removeEventListener("canplaythrough", this._createInternalTexture);
             this.video.removeEventListener("paused", this._updateInternalTexture);
             this.video.removeEventListener("seeked", this._updateInternalTexture);
             this.video.removeEventListener("emptied", this.reset);

文件差異過大導致無法顯示
+ 2 - 2
dist/preview release/viewer/babylon.viewer.js


+ 17 - 19
dist/preview release/viewer/babylon.viewer.max.js

@@ -64822,12 +64822,6 @@ var BABYLON;
             _this._stillImageCaptured = false;
             _this._createInternalTexture = function () {
                 if (_this._texture != null) {
-                    if (!_this._texture.isReady) {
-                        _this._textureReady();
-                    }
-                    else {
-                        _this._updateInternalTexture();
-                    }
                     return;
                 }
                 if (!_this._engine.needPOTTextures ||
@@ -64841,8 +64835,23 @@ var BABYLON;
                     _this._generateMipMaps = false;
                 }
                 _this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this._samplingMode);
-                if (_this.video.readyState >= _this.video.HAVE_FUTURE_DATA) {
-                    _this._textureReady();
+                if (!_this.video.autoplay) {
+                    _this.video.play();
+                    setTimeout(function () {
+                        _this._texture.isReady = true;
+                        _this._updateInternalTexture();
+                        _this.video.pause();
+                        if (_this._onLoadObservable && _this._onLoadObservable.hasObservers()) {
+                            _this.onLoadObservable.notifyObservers(_this);
+                        }
+                    }, 9);
+                }
+                else {
+                    _this._texture.isReady = true;
+                    _this._updateInternalTexture();
+                    if (_this._onLoadObservable && _this._onLoadObservable.hasObservers()) {
+                        _this.onLoadObservable.notifyObservers(_this);
+                    }
                 }
             };
             _this.reset = function () {
@@ -64874,7 +64883,6 @@ var BABYLON;
                 _this.video.loop = settings.loop;
             }
             _this.video.addEventListener("canplay", _this._createInternalTexture);
-            _this.video.addEventListener("canplaythrough", _this._createInternalTexture);
             _this.video.addEventListener("paused", _this._updateInternalTexture);
             _this.video.addEventListener("seeked", _this._updateInternalTexture);
             _this.video.addEventListener("emptied", _this.reset);
@@ -64914,15 +64922,6 @@ var BABYLON;
             return video;
         };
         ;
-        VideoTexture.prototype._textureReady = function () {
-            if (this._texture) {
-                this._texture.isReady = true;
-                this._updateInternalTexture();
-                if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
-                    this.onLoadObservable.notifyObservers(this);
-                }
-            }
-        };
         /**
          * Internal method to initiate `update`.
          */
@@ -64963,7 +64962,6 @@ var BABYLON;
         VideoTexture.prototype.dispose = function () {
             _super.prototype.dispose.call(this);
             this.video.removeEventListener("canplay", this._createInternalTexture);
-            this.video.removeEventListener("canplaythrough", this._createInternalTexture);
             this.video.removeEventListener("paused", this._updateInternalTexture);
             this.video.removeEventListener("seeked", this._updateInternalTexture);
             this.video.removeEventListener("emptied", this.reset);

+ 14 - 15
src/Materials/Textures/babylon.videoTexture.ts

@@ -76,7 +76,6 @@
             }
 
             this.video.addEventListener("canplay", this._createInternalTexture);
-            this.video.addEventListener("canplaythrough", this._createInternalTexture);
             this.video.addEventListener("paused", this._updateInternalTexture);
             this.video.addEventListener("seeked", this._updateInternalTexture);
             this.video.addEventListener("emptied", this.reset);
@@ -120,12 +119,6 @@
 
         private _createInternalTexture = (): void => {
             if (this._texture != null) {
-                if (!this._texture.isReady) {
-                    this._textureReady();
-                }
-                else {
-                    this._updateInternalTexture();
-                }
                 return;
             }
 
@@ -148,20 +141,27 @@
                 this._samplingMode
             );
 
-            if (this.video.readyState >= this.video.HAVE_FUTURE_DATA) {
-                this._textureReady();
+            if (!this.video.autoplay) {
+                this.video.play();
+                setTimeout(() => {
+                    if (this._texture) {
+                        this._texture.isReady = true;
+                        this._updateInternalTexture();
+                        this.video.pause();
+                        if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
+                            this.onLoadObservable.notifyObservers(this);
+                        }
+                    }
+                }, 9);
             }
-        };
-
-        private _textureReady(): void {
-            if (this._texture) {
+            else {
                 this._texture.isReady = true;
                 this._updateInternalTexture();
                 if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
                     this.onLoadObservable.notifyObservers(this);
                 }
             }
-        }
+        };
 
         private reset = (): void => {
             if (this._texture == null) {
@@ -227,7 +227,6 @@
         public dispose(): void {
             super.dispose();
             this.video.removeEventListener("canplay", this._createInternalTexture);
-            this.video.removeEventListener("canplaythrough", this._createInternalTexture);
             this.video.removeEventListener("paused", this._updateInternalTexture);
             this.video.removeEventListener("seeked", this._updateInternalTexture);
             this.video.removeEventListener("emptied", this.reset);