• Content Count

  • Joined

  • Last visited

  1. Hey Guys, I am trying to print the Camera Input to a Canvas Element in HTML5. On the desktop it works fine, but building it for Android devices with cordova, I cannot access the camera and I really don't know what I do wrong. I also tried it with Crosswalk, there I get no error, but the Camera isn't shown either. Here is my Code: navigator.getUserMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia); navigator.getUserMedia(options, onSuccess, onFail);var options = { audio: false, video: { mandatory: { maxWidth: window.innerWidth, maxHeight: window.innerHeight }, optional: [{ facingMode: "user" }] }}var onFail = function(e) { alert('Failed to get camera');};var onSuccess = function(stream) { var video = document.getElementById('my-webcam'); if(navigator.mozGetUserMedia) { video.mozSrcObject = stream; console.log("videoWidth" + video.width); } else { var url = window.URL || window.webkitURL; video.src = url.createObjectURL(stream); } // Wait 1000 ms before starting the loop otherwise the videosize aren´t set, so the Canvas can´t get values from the video setTimeout(function(){ setInterval(updateCanvas,30); //manipulating the canvas here // Make sure the canvas is the same size as the video var video = document.getElementById('my-webcam'); //invisible var canvas = document.getElementById('my-canvas'); //where the camera input should be shown canvas.width = video.videoWidth; canvas.height = video.videoHeight; //- $('#mainPage_ButtonPhoto').height(); },1000);}; But if I build this, I always get the onfail alert "Failed to get camera". I figured out it is a "errorPermissionDeniedError". I build it with xdk. But with this android.json, or app manifest for building android it is still not working. { "prepare_queue": { "installed": [], "uninstalled": [] }, "config_munge": { "files": {} }, "installed_plugins": {}, "dependent_plugins": {}, "permissions": { "audio-capture": { "description": "Required to capture audio using getUserMedia()", access: "readwrite" }, "video-capture": { "description": "Required to capture video using getUserMedia()", access: "readwrite" } }}Kind regards, SirSandmann
  2. SirSandmann

    Function Call TypeError with

    The Solution of the Problem is: socket = io.connect('localhost:3010');socket.on('startGame', function () {console.log('ShouldStartGame');this.createActualGame();}.bind(this));Topic can be closed!
  3. SirSandmann

    Function Call TypeError with

    I forgot to delete it. I edited the code. But the problem is still there.
  4. SirSandmann

    Function Call TypeError with

    Hey Guys, I have a problem with a function call with Phaser. I am a Javascript Noob and don´t know what I do wrong. Here is the critical Part of my Code, the whole Code is in one Scene. BasicGame.Multiplayer.prototype = {create: function(){ this.socket = io.connect('localhost:3010'); this.socket.on('startGame', function () { console.log('ShouldStartGame'); this.createActualGame(); });...},createActualGame: function(){// Define constants...}}My problem is that the function this.createActualGame is not called with the error: "TypeError: this.createActualGame is not a function". But the console log works fine. Thanks for your help! With kind regards, SirSandmann
  5. SirSandmann

    State start doesn´t work

    Can be closed, my mistake, sorry
  6. SirSandmann

    State start doesn´t work

    Hey Guys I used the Mobile Full Screen Template for my project. Every State works fine except the change back from the Game back to the MainMenu. this.state.start('MainMenu');The state was added in the index.html and is actually executed but nothing happens and I get no error. Has anyone Experience with that issue or could help me? Thanks, SirSandmann
  7. SirSandmann

    Phaser App with Phonegap

    Hey guys, I am currently developing my first PhaserApp. I tried with Phonegap to make it useable for different Platforms. I used the Full Screen Mobile Project template from the Phaser git. I tried to translate it with Phonegap, but the Framesizes aren´t working at all. With the iOS emulator the Framesize suddenly changes to 4096 and nothing of the game is visible, exepct the background defined in css. Here my code for this problem: //in boot.jsinit: function () { this.input.maxPointers = 1; this.stage.disableVisibilityChange = true; if ( { this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; //this.scale.setMinMax(480, 260, 1024, 768); /* this.scale.minWidth = 260; this.scale.minHeight = 480; this.scale.maxWidth = 768; this.scale.maxHeight = 1024; */ this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; this.scale.setScreenSize(true); this.scale.refresh(); } else { this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; //this.scale.setMinMax(480, 260, 1024, 768); this.scale.minWidth = 260; this.scale.minHeight = 480; this.scale.maxWidth = 768; this.scale.maxHeight = 1024; this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; this.scale.forceOrientation(true, false); this.scale.setResizeCallback(this.gameResized, this); this.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this); this.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this); this.scale.setScreenSize(true); this.scale.refresh(); } },// in the main.js//global variableswindow.onload = function () { var game = new Phaser.Game(1024, 768, Phaser.AUTO, 'mobilescreentest');//HTML<meta name="viewport" content="initial-scale=1 maximum-scale=1 user-scalable=0 minimal-ui" />//CSSbody { margin: 0px 0px 1px 0px; /* the extra 1px allows the iOS inner/outer check to work */ background: #fff;}#orientation { margin: 0 auto; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-image: url(../assets/orientation.jpg); background-repeat: no-repeat; background-position: center; background-color: rgb(0, 0, 0); z-index: 999; display: none;}Maybe someone know how to fix this. In the Android emulator nothing shows up at all. My general thought was, is it even senseful (better performance) if i try to do apps for different platform, does it make more sense to do webviews for eveything, or should i stay with phonegap? Thank you for your answers, with kind regards, SirSandmann