Jump to content

BUG catching video stop


jaraiza
 Share

Recommended Posts

Hi,

I'm having a problem (it looks like a bug) with phaser.signal detecting when a video has ended when using changeSource function. I'm using phaser 2.4.8 (but it also happened with 2.4.6).

To reproduce the issue, please change both videos and the image button with some media you have. 

Once you run the demo, check your developer console each time button is pressed.

  • The first time the video is stopped, it says "Played 1 times"
  • The second time it says "Played 2 times" AND "Played 3 times"
  • The third time it says "Played 4 times", "Played 5 times" AND "Played 6 times"
  • and so on...

It's like it is reporting when each video has stopped, not just the video that has just been "source changed".

Here's the code:

window.played = 0;
var game = new Phaser.Game(1280, 720, Phaser.AUTO, 'gameCanvas', { preload: preload, create: create});

function preload() {
	game.load.video('Blank', 'vids/blank.mp4');
	game.load.image('btn','gfx/btn_conoce.png');
}

function create() {
	button = game.add.button(100, 400, 'btn', btnClick);
	
	video = game.add.video('Blank');
	video.addToWorld(0, 0, 0, 0, 0, 0);
	
	videoOnStop = new Phaser.Signal();
	video.onComplete = videoOnStop;
	
	game.world.bringToTop(button);
	
	videoOnStop.add(function() {
		played++;
		console.log("Video Stopped: Played " + played + " times");
	});
}

function btnClick() {
	video.changeSource('vids/anothervideo.mp4');
	video.play(false);
}

Greets!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...