简体   繁体   中英

How do I use the main camera (back Camera) in WebCam.js

I am using webcam.js by https://github.com/jhuckaby/webcamjs and In mobile devices, It's working well the front camera is opening by default. I can't change it to back Camera, I want to change the default to the Main camera.

Is there any way to change to the main camera device?

answer is so simple, just add this setting row to your page,

constraints: { facingMode: 'environment' }

it will be like this:

Webcam.set({
 width: 640,
 height: 480, 
 image_format: 'jpeg',
 jpeg_quality: 800,
 constraints: { facingMode: 'environment' }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM