Closed hvitis closed 1 year ago
Ok I got that from here
const [device, setDevice] = useState({})
const [devices, setDevices] = useState([])
const handleDevices = useCallback(
(mediaDevices) => setDevices(mediaDevices.filter(({ kind }) => kind === 'videoinput')),
[setDevices]
)
useEffect(() => {
navigator.mediaDevices.enumerateDevices().then(handleDevices)
}, [handleDevices])
<BarcodeScannerComponent videoConstraints={{ deviceId: device.deviceId }} />
Hey,
I have stumbled on a problem with a Samsung camera that has couple of lenses. The default being taken to the feed by this library is a long-range one. I would like to change the environment camera, not only the front/back facing. Is there a good way to do this? I have seen that deviceId is being used in the code but not sure how universal it is.
Thanks