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

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.