Video On Complete Event

Listen for the 'complete' event on a Video Game Object to trigger actions, such as displaying UI or restarting playback, once a video finishes playing.

Video On Complete Event, running
800 × 600
GitHub
class Example extends Phaser.Scene
{
    constructor ()
    {
        super();
    }

    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
        this.load.video('flight', 'assets/video/endless-flight.mp4', true);
    }

    create ()
    {
        const intro = this.add.video(400, 300, 'flight');

        intro.on('complete', () => {

            let message = this.add.text(400, 30, 'Video Completed - Click to restart', { font: '22px Courier', fill: '#ffffff' }).setOrigin(0.5);

            this.input.once('pointerdown', () => {

                message.destroy();

                intro.play();

            });

        });

        intro.play();
    }
}

const config = {
    scale: { mode: Phaser.Scale.FIT },
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    backgroundColor: '#000000',
    parent: 'game-container',
    scene: Example
};

let game = new Phaser.Game(config);

More in Video17 examples