Open facetime88 opened 7 years ago
i'm using the code. you can use this
var videoSource = "";
navigator.mediaDevices.enumerateDevices().then(function (devices) {
for(var i = 0; i < devices.length; i ++){
var device = devices[i];
console.log("devices[i]",devices[i]);
//Microsoft LifeCam Studio (045e:0772)
//Logitech HD Pro Webcam C920 (046d:082d)
if (device.kind === 'videoinput' && device.label === camera) {
videoSource = device.deviceId;
}
};
}).then(function(){
var constraints = {
video: {deviceId: videoSource ? {exact: videoSource} : undefined},
};
navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
try {
element.src = window.URL.createObjectURL(stream);
}catch (err) {
element.src = stream;
}
video.onloadedmetadata = function(e) {
video.play();
};
})
.catch(function(err) {
console.log(err.name + ": " + err.message);
});
});
Hi,
I have 2 webcam camera. How do I set camera which I'd like to use for tracking? Thank you.