mirror of
https://github.com/photonstorm/phaser
synced 2024-12-23 19:43:28 +00:00
Update video texture after loading
loadURL() or loadMediaStream()
This commit is contained in:
parent
672fe0c97f
commit
ed7c999a0a
1 changed files with 15 additions and 0 deletions
|
@ -293,6 +293,7 @@ var Video = new Class({
|
||||||
*/
|
*/
|
||||||
this._callbacks = {
|
this._callbacks = {
|
||||||
play: this.playHandler.bind(this),
|
play: this.playHandler.bind(this),
|
||||||
|
load: this.loadHandler.bind(this),
|
||||||
error: this.loadErrorHandler.bind(this),
|
error: this.loadErrorHandler.bind(this),
|
||||||
end: this.completeHandler.bind(this),
|
end: this.completeHandler.bind(this),
|
||||||
time: this.timeUpdateHandler.bind(this),
|
time: this.timeUpdateHandler.bind(this),
|
||||||
|
@ -853,6 +854,7 @@ var Video = new Class({
|
||||||
}
|
}
|
||||||
|
|
||||||
video.addEventListener('error', this._callbacks.error, true);
|
video.addEventListener('error', this._callbacks.error, true);
|
||||||
|
video.addEventListener(loadEvent, this._callbacks.load, true);
|
||||||
|
|
||||||
video.src = url;
|
video.src = url;
|
||||||
|
|
||||||
|
@ -910,6 +912,7 @@ var Video = new Class({
|
||||||
video.setAttribute('preload', 'auto');
|
video.setAttribute('preload', 'auto');
|
||||||
|
|
||||||
video.addEventListener('error', this._callbacks.error, true);
|
video.addEventListener('error', this._callbacks.error, true);
|
||||||
|
video.addEventListener(loadEvent, this._callbacks.load, true);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -987,6 +990,18 @@ var Video = new Class({
|
||||||
this.video.removeEventListener('playing', this._callbacks.play, true);
|
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.
|
* This internal method is called automatically if the video fails to load.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue