kybarg / react-qr-scanner

React component for reading QR codes using PC web camera or mobile phone camera.
MIT License
126 stars 40 forks source link

fix: Use filtered VideoDevicesArray to access the only available VideoDevice #23

Closed fjogeleit closed 4 years ago

fjogeleit commented 4 years ago

If only one video device is available it uses the first item of the device array. If this is not the video device you get an Constraint Error for the given deviceId.

This fix returns the first entry of the already filtered and checked video device array to ensure that the only available video deviceId is used.