Device camera is not working on mobile phones

I want to try developing a web application that uses the device’s camera myself, but I’ve encountered a problem: when viewing the official example with an iPhone (https://playground.babylonjs.com/#SRZRWV#3), it works normally, such as the camera moving as I turn my phone. However, when I download the example to run it locally via a web server and then access the local page on my phone, the camera does not move when I turn my phone. What could be the reason for this?

I think it requires a secure context, so you have to serve the page over https

1 Like

Just before I asked the question, I also tried deploying it on a server using the HTTPS protocol, but it still did not work at all.

It’s not necessarily secure context, if the page loads other assets over http.

Try connecting your phone to a Mac and use the Web Inspector

Thanks for the advice you gave me, but I don’t have a MAC, is it ok to use a PC ?

No, but you may be able to use something like iOS Testing at Scale on a Real Device Cloud | BrowserStack

1 Like

I tried to set up a button to do a retract to get permission by clicking on it and that solved the problem, still thanks for your help!

2 Likes