Open nitesh-nair opened 4 years ago
hi did you find the answer i want to connect IP camera .please let me know if you know how to connect IP camera
From enumerateDevices, you can get the list of available cameras.
And then use contraints option in webcamjs
deviceId: { exact: [the device id you get from enumerateDevices] }
navigator.mediaDevices.enumerateDevices()
.then(function(devices) {
devices.forEach(function(device) {
console.log(device.kind + ": " + device.label +
" id = " + device.deviceId);
});
})
.catch(function(err) {
console.log(err.name + ": " + err.message);
});
// when you get device.deviceId,you can replace xxx in deviceId: {exact: 'xxx' },
Webcam.set({
width: 320,
height: 180,
image_format: 'jpeg',
jpeg_quality: 90,
constraints: {
width: 320, // { exact: 320 },
height: 180, // { exact: 180 },
facingMode: 'user',
deviceId: {exact: 'xxx' },
frameRate: 30
}
});
Webcam.attach( '#my_camera' );
If i have an external camera connected, is there a way to select that from the page rather than going into chrome settings and changing it?