title: How to use back camera instead of the front camera?
body: <p>I have a QR scanning camera, but when I open my website on a cell phone, the face camera turns on in my website. I want to use the back camera. </p>
  
  <pre><code>function setwebcam()
  {
  
   var constraints = { audio: true, video: true };
  
  
  
  
  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(constraints, success, error);
  else
  if(n.webkitGetUserMedia)
  {
      webkit=true;
      n.webkitGetUserMedia(constraints, success, error);
  }
  else
  if(n.mozGetUserMedia)
  {
      moz=true;
      n.mozGetUserMedia(constraints, success, error);
  }
  </code></pre>