Is there any way to detect whether the user has a front, rear, or both cameras in their device? For example, on a laptop, we normally have just one user camera, and it doesn’t have a rear camera. On a device, it may have both cameras, and I want a way to detect the user camera type
Question posted in Javascript
A very good W3school tutorial can be found here.
A very good W3school tutorial can be found here.
2
Answers
You can detect whether a user’s device has a front, rear, or both types of cameras using the MediaDevices API.
Example from mdn:
navigator.mediaDevices.enumerateDevices()