can't enumerate devices, method not supported
Having similar issue. To go into more detail, I am attempting to use the listVideoInputDevices method on a laptop with a webcam. The example on the website seems to work, but after fiddling around and trying to glean some info from that source code and the readme, I'm still having problems. Any ideas/need more information from my end?
Thanks!
For hosting under IPv4 you need SSL, also you need to provide more info or this issue will be closed. Thanks.
@ismailjamil22 Hello, I ran into the same problem and I think what's causing the problem is this code if (!this.canEnumerateDevices) throw new Error("Can't enumerate devices, method not supported.");
The following code is navigator.mediaDevices.enumerateDevices() which retrieves the list of available devices. In this case, navigator.mediaDevices might be undefined. According to this, it is undefined because the document isn't loaded securely.
So, there's a chance that the url you are using is not https. I am developing using localhost url and it is not complaining.
Exactly @lucassusanto , the browser requests SSL for accessing the WebRTL features (which include device's media devices). But there's an exception for localhost, so developers can develop easily w/o having to issue a certificate for development environments. If you do try to serve your application under IPv4 (IP server), you gonna need SSL even if it's hosted on your local machine.
I realize this issue is closed, but the ReadMe should state that the the browser requests SSL even for the concompassing page, but allows for exceptions on localhost.
Frankly, in some cases the script would run (up to identifying devices), but not 'activate' a device and thus camera would not be accessible (or ask browser for access). Maybe there was some wonky cache. Still...
A bit of a gotcha.
Yeah, it would be nice of ours to document that. Even if it is not specific to our library, many users doesn't know about that.
Most helpful comment
@ismailjamil22 Hello, I ran into the same problem and I think what's causing the problem is this code
if (!this.canEnumerateDevices) throw new Error("Can't enumerate devices, method not supported.");The following code is
navigator.mediaDevices.enumerateDevices()which retrieves the list of available devices. In this case,navigator.mediaDevicesmight beundefined. According to this, it isundefinedbecause the document isn't loaded securely.So, there's a chance that the url you are using is not https. I am developing using
localhosturl and it is not complaining.