From ed7c999a0a6b35724d6797ddbfae99a82979c9fa Mon Sep 17 00:00:00 2001 From: samme Date: Sat, 10 Sep 2022 08:42:53 -0700 Subject: [PATCH] Update video texture after loading loadURL() or loadMediaStream() --- src/gameobjects/video/Video.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gameobjects/video/Video.js b/src/gameobjects/video/Video.js index 7fd6123d3..3eaf528bd 100644 --- a/src/gameobjects/video/Video.js +++ b/src/gameobjects/video/Video.js @@ -293,6 +293,7 @@ var Video = new Class({ */ this._callbacks = { play: this.playHandler.bind(this), + load: this.loadHandler.bind(this), error: this.loadErrorHandler.bind(this), end: this.completeHandler.bind(this), time: this.timeUpdateHandler.bind(this), @@ -853,6 +854,7 @@ var Video = new Class({ } video.addEventListener('error', this._callbacks.error, true); + video.addEventListener(loadEvent, this._callbacks.load, true); video.src = url; @@ -910,6 +912,7 @@ var Video = new Class({ video.setAttribute('preload', 'auto'); video.addEventListener('error', this._callbacks.error, true); + video.addEventListener(loadEvent, this._callbacks.load, true); try { @@ -987,6 +990,18 @@ var Video = new Class({ this.video.removeEventListener('playing', this._callbacks.play, true); }, + /** + * This internal method is called automatically when the video loads. + * + * @method Phaser.GameObjects.Video#loadHandler + * @private + * @since 3.60.0 + */ + loadHandler: function () + { + this.updateTexture(); + }, + /** * This internal method is called automatically if the video fails to load. *