|
@@ -69,6 +69,7 @@ export class VideoTexture extends Texture {
|
|
|
private _settings: VideoTextureSettings;
|
|
|
private _createInternalTextureOnEvent: string;
|
|
|
private _frameId = -1;
|
|
|
+ private _currentSrc: Nullable<string | string[] | HTMLVideoElement> = null;
|
|
|
|
|
|
/**
|
|
|
* Creates a video texture.
|
|
@@ -103,6 +104,7 @@ export class VideoTexture extends Texture {
|
|
|
this._initialSamplingMode = samplingMode;
|
|
|
this.autoUpdateTexture = settings.autoUpdateTexture;
|
|
|
|
|
|
+ this._currentSrc = src;
|
|
|
this.name = name || this._getName(src);
|
|
|
this.video = this._getVideo(src);
|
|
|
this._settings = settings;
|
|
@@ -317,6 +319,21 @@ export class VideoTexture extends Texture {
|
|
|
*/
|
|
|
public updateURL(url: string): void {
|
|
|
this.video.src = url;
|
|
|
+ this._currentSrc = url;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Clones the texture.
|
|
|
+ * @returns the cloned texture
|
|
|
+ */
|
|
|
+ public clone(): VideoTexture {
|
|
|
+ return new VideoTexture(this.name,
|
|
|
+ this._currentSrc!,
|
|
|
+ this.getScene(),
|
|
|
+ this._generateMipMaps,
|
|
|
+ this.invertY,
|
|
|
+ this.samplingMode,
|
|
|
+ this._settings);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -325,6 +342,8 @@ export class VideoTexture extends Texture {
|
|
|
public dispose(): void {
|
|
|
super.dispose();
|
|
|
|
|
|
+ this._currentSrc = null;
|
|
|
+
|
|
|
if (this._onUserActionRequestedObservable) {
|
|
|
this._onUserActionRequestedObservable.clear();
|
|
|
this._onUserActionRequestedObservable = null;
|