瀏覽代碼

Add load observable on video texture

Sebastien Vandenberghe 7 年之前
父節點
當前提交
225beebc32
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 1 1
      src/Materials/Textures/babylon.texture.ts
  2. 4 0
      src/Materials/Textures/babylon.videoTexture.ts

+ 1 - 1
src/Materials/Textures/babylon.texture.ts

@@ -93,7 +93,7 @@
         protected _format: Nullable<number>;
         private _delayedOnLoad: Nullable<() => void>;
         private _delayedOnError: Nullable<() => void>;
-        private _onLoadObservable: Nullable<Observable<Texture>>;
+        protected _onLoadObservable: Nullable<Observable<Texture>>;
 
         protected _isBlocking: boolean = true;
         public set isBlocking(value: boolean) {

+ 4 - 0
src/Materials/Textures/babylon.videoTexture.ts

@@ -142,6 +142,10 @@
 
             this._texture.isReady = true;
             this._updateInternalTexture();
+
+            if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
+                this.onLoadObservable.notifyObservers(this);
+            }
         };
 
         private reset = (): void => {