JSFiddle - React, Tailwind, and code Playground
by shapeshifta
JavaScript
navigator.mediaDevices.enumerateDevices()
.then((devices) => {
let thedevice;
for(let device of devices) {
if (device.kind == 'videoinput') {
thedevice = navigator.mediaDevices.getUserMedia({
"video": {
deviceId: {exact : device.deviceId},
width: { max: 640 }
}
});
}
}
return thedevice;
})