jaraiza

BUG catching video stop

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!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.