I am trying to connect a usb webcam to my chrome browser.I Am able to connect the device on chrome and able to get the name and configurations as well ,but how to get the images from the web cam
I am using below code to access the usb device ,but how to proceed further ? .Any link or suggestions are welcome. Thanks
button.addEventListener('click', async () => {
navigator.usb.requestDevice({ filters: [{ vendorId: 6403}] })
.then(device => {
console.log(device);
const constraints = {
video: true,
};
device.getUserMedia(constraints) // this is not working it works only for webcams
.then((stream) => {
player.srcObject = stream;
})
.catch(error => { console.log(error); });
})
});
I figured out by isochronousTransferIn(), we can stream video and audio ,but still it doesn't work
button.addEventListener('click', async () => {
navigator.usb.requestDevice({ filters: [{ vendorId: 6403 }] })
.then(selectedDevice => {
device = selectedDevice;
return device.open(); // Begin a session.
})
.then(() => device.isochronousTransferIn(1, 64)) // Select configuration #1 for the device.
.then((result) => console.log(result)) // Select configuration #1 for the device.
.catch(error => { console.log(error); });
});