Skip to content

Commit a24a227

Browse files
committed
Enabled Stream stopping.
1 parent 37304c7 commit a24a227

1 file changed

Lines changed: 32 additions & 12 deletions

File tree

src/gameobjects/Video.js

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,14 @@ Phaser.Video.prototype = {
306306
if (typeof width === 'undefined' || width === null) { width = this.video.videoWidth; change = true }
307307
if (typeof height === 'undefined' || height === null) { height = this.video.videoHeight; }
308308

309-
if (change)
310-
{
311-
console.log('updateTexture resizing to webcam', width, height);
312-
}
313-
else
314-
{
315-
console.log('updateTexture resizing to fixed dimensions', width, height);
316-
}
309+
// if (change)
310+
// {
311+
// console.log('updateTexture resizing to webcam', width, height);
312+
// }
313+
// else
314+
// {
315+
// console.log('updateTexture resizing to fixed dimensions', width, height);
316+
// }
317317

318318
this.width = width;
319319
this.height = height;
@@ -425,15 +425,35 @@ Phaser.Video.prototype = {
425425
this.game.onPause.remove(this.setPause, this);
426426
this.game.onResume.remove(this.setResume, this);
427427

428-
this.video.removeEventListener('ended', this.complete.bind(this));
428+
// Stream or file?
429429

430-
if (this.touchLocked)
430+
if (this.videoStream)
431431
{
432-
this._pending = false;
432+
if (this.video.mozSrcObject)
433+
{
434+
this.video.mozSrcObject.stop();
435+
this.video.src = null;
436+
}
437+
else
438+
{
439+
this.video.src = "";
440+
this.videoStream.stop();
441+
}
442+
443+
this.videoStream = null;
433444
}
434445
else
435446
{
436-
this.video.pause();
447+
this.video.removeEventListener('ended', this.complete.bind(this));
448+
449+
if (this.touchLocked)
450+
{
451+
this._pending = false;
452+
}
453+
else
454+
{
455+
this.video.pause();
456+
}
437457
}
438458

439459
return this;

0 commit comments

Comments
 (0)