0

As the example, I try to set up the AR scene in three.js.

I use "jsartoolkit" to do that.

WebAR

I load a JSON model into the AR scene, and it does work.

Now I wonder how could I do to change the camera?

When I open the AR webpage, it always turn on the front device camera of my mobile phone.

I want to use the back device camera to show my WebAR scene.

How should I do?

Kevin Hsiao
  • 2,281
  • 2
  • 10
  • 18

1 Answers1

1

Using cameraParam as a property name in your call to getUserMediaThreeScene may be incorrect.

Change:

cameraParam: 'Data/camera_para-iPhone 5 rear 640x480 1.0m.dat'

To:

video: { facingMode: { exact: "environment" }}

Reference: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia

James Dunn
  • 456
  • 4
  • 9
  • Hi James, thank you for your reply. I try to modify the code, but it does not work....... – Kevin Hsiao Sep 20 '16 at 16:10
  • Check to see if this works in your browser: navigator.mediaDevices.enumerateDevices() .then(function(devices) { devices.forEach(function(device) { if (device.kind==="videoinput") console.log(device.kind + ": " + device.label + " id = " + device.deviceId); }); }) .catch(function(err) { console.log(err.name + ": " + error.message); }); – James Dunn Sep 20 '16 at 23:02
  • Thank you James. Actually I am a javascript beginner, so I do not knew where should I add those codes..... Could you should more detail and simple example? – Kevin Hsiao Sep 21 '16 at 04:46
  • Perhaps investigate: [enable rear camera](http://stackoverflow.com/questions/18625007/enable-rear-camera-with-html5) – James Dunn Sep 21 '16 at 07:13
  • Thank you so much! James! I think the simple example is what I need. I will try it~! – Kevin Hsiao Sep 22 '16 at 16:38
  • @kevin-hsiao any word on this? – James Dunn Jul 19 '17 at 19:44