Skip to content

Commit 214e8ab

Browse files
committed
Added play and stop methods and related signals.
1 parent 30450cb commit 214e8ab

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/pixi/textures/VideoTexture.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,30 @@ PIXI.VideoTexture = function(source, scaleMode)
4646
source.addEventListener('pause', this.onPlayStop.bind(this));
4747
}
4848

49+
this.onPlay = new Phaser.Signal();
50+
this.onComplete = new Phaser.Signal();
51+
4952
};
5053

5154
PIXI.VideoTexture.prototype = Object.create(PIXI.BaseTexture.prototype);
5255
PIXI.VideoTexture.constructor = PIXI.VideoTexture;
5356

57+
PIXI.VideoTexture.prototype.play = function()
58+
{
59+
this.source.play();
60+
this.onPlay.dispatch();
61+
};
62+
63+
PIXI.VideoTexture.prototype.stop = function()
64+
{
65+
this.source.stop();
66+
this.onComplete.dispatch();
67+
};
68+
5469
PIXI.VideoTexture.prototype._onEnded = function()
5570
{
5671
this.ended = true;
72+
this.onComplete.dispatch();
5773
};
5874

5975
PIXI.VideoTexture.prototype._onUpdate = function()
@@ -184,6 +200,10 @@ PIXI.VideoTexture.fromUrl = function(videoSrc, scaleMode, autoPlay)
184200
video.autoPlay = true;
185201
video.play();
186202
}
203+
else
204+
{
205+
video.autoPlay = false;
206+
}
187207

188208
return PIXI.VideoTexture.textureFromVideo(video, scaleMode);
189209
};

0 commit comments

Comments
 (0)