Skip to content

Commit f2e2039

Browse files
committed
Invalidate the texture while we wait for the new one to load (crashes IE11 otherwise)
1 parent ce27da3 commit f2e2039

1 file changed

Lines changed: 5 additions & 40 deletions

File tree

src/gameobjects/Video.js

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,6 @@ Phaser.Video.prototype = {
269269

270270
this.video.setAttribute('autoplay', 'autoplay');
271271

272-
// this.video.controls = false;
273-
// this.video.autoplay = false;
274-
// this.video.canplay = false;
275-
276272
if (width !== null)
277273
{
278274
this.video.width = width;
@@ -320,8 +316,6 @@ Phaser.Video.prototype = {
320316
self.onError.dispatch(self, err);
321317
});
322318

323-
// this.video.addEventListener('loadeddata', function (event) { self.streamLoaded(event); }, false);
324-
325319
this.video.addEventListener('loadeddata', function () {
326320

327321
var retry = 10;
@@ -366,38 +360,6 @@ Phaser.Video.prototype = {
366360

367361
},
368362

369-
/*
370-
streamLoaded: function (event) {
371-
372-
console.log('mozStreamLoaded', arguments);
373-
374-
if (!this.isStreaming)
375-
{
376-
this.video.removeEventListener('canplay', this.mozStreamLoaded, false);
377-
378-
this.texture.valid = true;
379-
380-
if (this.video)
381-
{
382-
console.log('vwh', this.video.videoWidth, this.video.videoHeight);
383-
}
384-
385-
// Firefox currently has a bug where the height can't be read from
386-
// the video, so we will make assumptions if this happens.
387-
388-
if (this.video.videoHeight)
389-
if (isNaN(height)) {
390-
height = width / (4/3);
391-
}
392-
393-
this.isStreaming = true;
394-
}
395-
396-
this.updateTexture();
397-
398-
},
399-
*/
400-
401363
/**
402364
* Creates a new Video element from the given Blob. The Blob must contain the video data in the correct encoded format.
403365
* This method is typically called by the Phaser.Loader and Phaser.Cache for you, but is exposed publicly for convenience.
@@ -440,7 +402,7 @@ if (isNaN(height)) {
440402
this.width = width;
441403
this.height = height;
442404

443-
console.log('updateTexture ---', this.key, change);
405+
console.log('updateTexture ---', this.key, 'change?', change);
444406
console.log(width, height);
445407

446408
this.baseTexture.forceLoaded(width, height);
@@ -803,10 +765,13 @@ if (isNaN(height)) {
803765
*/
804766
changeSource: function (src, autoplay) {
805767

806-
console.log('changeSource', this.key);
768+
console.log('changeSource from', this.key, 'to', src);
807769

808770
if (typeof autoplay === 'undefined') { autoplay = true; }
809771

772+
// Invalidate the texture while we wait for the new one to load (crashes IE11 otherwise)
773+
this.texture.valid = false;
774+
810775
this.video.pause();
811776

812777
this.video.addEventListener('canplaythrough', this.updateTexture.bind(this), true);

0 commit comments

Comments
 (0)