Skip to content
Advertisement

HTML userMedia facingMode: “environment”doesn’t work on android phone

It keeps using the front facing camera instead of the back camera This is my code: I added the facingMode: {exact:”environment”}, but it doesn’t work

JavaScript

Advertisement

Answer

Your constraints are not set correctly.

facingMode is a member of the video constraint, so it should be

JavaScript

Live Fiddle to be ran from a device with a back camera.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement