hullunist
hullunist

Reputation: 1277

How to distinguish mobile fisheye/wide-lens cameras from the normal camera?

Context

Throughout the javascript web application the camera of a mobile device needs to be accessed. Since the target audience are mostly non tech-savvy users the requirement is in place that the "normal" (meaning the camera you would access with your native camera app) environment facing camera should automatically be selected (via constraints for getUserMedia). In this reddit post someone did extensive testing to provide the anecdotal evidence that on most devices the "normal" environment facing camera is the last element of the array returned by enumerateDevices. That solution worked pretty well (given the fact that it is hacky AF) as a workaround in combination with applied constraints.

Problem Description

Recently through testing we found out that the new Apple iPhone 15 also grants access to several other back cameras by returning them as accessible devices. For a German iPhone 15 following array elements are returned by enumerateDevices:

There is a total of seven cameras, of which six are back cameras. Also important to notice is that the last element is "Rückseitige Telefotokamera", while the second last element is the desired "Rückkamera". Given this data the "workaround" mentioned in the context section is not working anymore. This leads to the behavior "Rückseitige Telefotokamera" is automatically selected. Since this camera has no auto-focus and is using a different "perspective" (please excuse my lack of proper terminology) the users are not able to properly perform their wanted actions.

Forcing non tech-savvy users to manually select out of six back cameras does not seem like a good idea from an UI/UX perspective.

Question

Is there any way to distinguish cameras with a special effect like fish-eye, telephoto etc. from "normal" cameras, which would allow us to identify and filter them out?

Prior Research

I did quite a bit of research and it seems like many other people also encounter this problem. There is a also a github request to extend the Media Captures and Stream Spec with a decent amount of upvotes. There have been other hacky workarounds that use certain language-specific keywords to filter out such cameras but since device labels do not follow any specification that might also break at any point.

Upvotes: 2

Views: 44

Answers (0)

Related Questions