OkayID Web Camera
Last updated
Last updated
To use the front camera, always set the facingmode in constraint to “user” and set it to “environment” when rear camera is in need.
But this is not the case when using certain Android phone with multiple rear camera like Huawei which split their camera into normal len and telephoto len when using rear camera.
Detect the environment of the internet browser (Google chrome/Firefox) and phone's operating system
Loop through all the videoinput (camera) device id of the phone and get the last device id, which normally indicate the normal len in Android phone.
Set the device id into constraint and get the permission from user to use the camera in browser.
Once the permission is granted, camera will be launched.