Browse Source

Add load observable on video texture

Sebastien Vandenberghe 7 years ago
parent
commit
225beebc32

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

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

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

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