Reputation: 162
I prepared a JSFiddle which shows the difference:
For the reliable version, it seems to work every time on my Pixel 3 XL's Chrome browser. For the unreliable version, it doesn't work all the time, sometimes I have to wait for over a minute, sometimes I have to keep trying to open the stream, or open the other video streams and then open the rear camera's stream (though this might reduce to the first case of just waiting). There are no error messages thrown.
I think enumerateDevices()
is causing an issue because if I call enumerateDevices()
and then attempt to open the video stream with the facingMode: "environment"
constraint, it doesn't open up consistently. There are no errors thrown in the console. But using the facingMode: "environment"
constraint without calling enumerateDevices()
works consistently.
Is this a bug that I should report somewhere, or am I doing something wrong?
Upvotes: 0
Views: 24