How to switch Back camera from Font camera?

Hi, I am trying to develop a QR login system and i found a script https://github.com/moemoe89/simple-login-qrcode-webcam-php here and the problem is when i run this script from my mobile the font camera is turn on but i want to turn on the back camera.

I think the function is in main.js file. Will you please help me to how to turn on the Back camera ?

function setwebcam()
{
	document.getElementById("result").innerHTML="- scanning -";
    if(stype==1)
    {
        setTimeout(captureToCanvas, 500);    
        return;
    }
    var n=navigator;
    document.getElementById("outdiv").innerHTML = vidhtml;
    v=document.getElementById("v");

    if(n.getUserMedia)
        n.getUserMedia({video: true, audio: false}, success, error);
    else
    if(n.webkitGetUserMedia)
    {
        webkit=true;
        n.webkitGetUserMedia({video: true, audio: false}, success, error);
    }
    else
    if(n.mozGetUserMedia)
    {
        moz=true;
        n.mozGetUserMedia({video: true, audio: false}, success, error);
    }

    //document.getElementById("qrimg").src="qrimg2.png";
    //document.getElementById("webcamimg").src="webcam.png";
    document.getElementById("qrimg").style.opacity=0.2;
    document.getElementById("webcamimg").style.opacity=1.0;

    stype=1;
    setTimeout(captureToCanvas, 500);
}

I really need it. If you know any QR login script well then also let me know.
Thanks in advance friend.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.