Activating rear Android camera

Activating rear Android camera

Hi I use the code below to activate the camera and scan qr codes!

  1. n.webkitGetUserMedia({video: true, audio: false}, success, error);
But when I try to force using the rear camera, it fails (it doesn't activate the camera at all):

  1. n.webkitGetUserMedia({video: {
  2.     mandatory: {
  3.       facingMode: "environment"
  4.     }
  5.   },
  6.   audio: false}, success, error);

How can I force using the rear camera?

Thanks