When accessing the camera using HTML5 getUserMedia APIs, you can either:
- Request an unspecified "user" facing camera
- Request an unspecified "environment" facing camera (optionally left or right)
- Request a list of cameras available
Originally we used the "facing" constraint to choose the camera. If the camera faces the "user" we show it mirror image as is the convention.
We run into problems, however, when a user does not have exactly 1 user-facing and 1 environment-facing camera. They might be missing one of these, or have multiple. This can result in the wrong camera being used, or the camera not being mirrored appropriately.
So we are looking at enumerating the devices. However, I have not found a way to determine whether a video device is "user facing" and should be mirrored.
Is there any API available to determine whether a video input is "user" facing the in these APIs?
question from:
https://stackoverflow.com/questions/65931096/how-to-determine-which-cameras-are-front-and-back-facing-when-using-html5-getuse 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…