Make babylon access back camera

please check this https://www.babylonjs-playground.com/#X4FPH2#3 It is accessing front camera by default in mobile phones, I want to access rear camera, If anyone could help me tweak it, It will be helpful of you

Hi rudr,

I think what you’re looking for is the facingMode option, which can be set to either "user" or "environment". Does this do what you’re looking for?

https://www.babylonjs-playground.com/#X4FPH2#5

(Discussed near the end of Step 3 of this tutorial, in case you want to read further. Best of luck!)

1 Like

Hi Syntheticmagus
Thanks for the help it worked as per my requirement, But I am getting a new error
https://www.babylonjs-playground.com/#X4FPH2#6
The camera feed never shows properly in iOS and in Android too the camera stream output is delayed.
Another error is it is not accessing gyroscope in iOS as I have used deviceorientationcamera

Hi rudr,

Glad I was able to help at least a little bit! Unfortunately I’m not a very good resource for iOS/Safari problems as I don’t have an iPhone, and I don’t repro the delay you mentioned on Android. (The camera comes up immediately after I grant permission on my Moto G7, though Android devices can vary a lot in performance and behavior. What device are you using?) I can recommend you double-check your permissions in case the browser has decided to restrict sensor APIs for one reason or another, but beyond that my experience with iOS/Safari is very limited. I do know that iOS and Android both have tethered-device debugging experiences which will allow you to take a close at the performance yourself. However, if you really need somebody who can repro the issues to look at this with you, I’d recommend creating a new forum question specifically calling out iOS and DeviceOrientationCamera in the title; that’s probably the fastest way to find someone on here with the Apple devices necessary to follow along. Best of luck!

Thanks for the update, Surely I will create a new topic in forum to get my problem solved