Jump to content

Blank webcam


SamPotasz
 Share

Recommended Posts

Hi y'all,

I'm having trouble getting the Webcam plugin running in my game for some reason. Seems like it should be simple enough judging by the example: https://phaser.io/examples/v2/misc/webcam

When I start the plugin from inside my Game state, the plugin starts, my browser asks for permission to access the camera, and then I get a completely blank screen - no output from the camera. Or the output is printing somewhere that's not being added to the game.

Here's my code: 

BasicGame.Game = function(game) {};

BasicGame.Game.prototype = {

    preload: function() {
        this.game.load.script('webcam', '/src/utils/Webcam.js');
    },

    create: function() {
        var webcam = this.game.plugins.add(Phaser.Plugin.Webcam);
        console.log(this.game.plugins.plugins);
        var bmd = this.game.make.bitmapData(600, 450);
        var sprite = bmd.addToWorld();
        webcam.start(600, 450, bmd.context);
    },

    update: function() {

    },
};

The plugin is definitely added and then started so I really don't know what the issue is! Any help is appreciated :-)

Thanks,
Sam

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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