Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using external webcam #65

Open
sugeknowles opened this issue Oct 2, 2019 · 1 comment
Open

Using external webcam #65

sugeknowles opened this issue Oct 2, 2019 · 1 comment

Comments

@sugeknowles
Copy link

How do I create a CameraStream object for an external webcam connected to my system? The computer has a front and rear facing camera, but I need to use a specialized camera that shows up as another webcam on the computer. I am not sure how to create the constraints to use this camera.

@martinRenou
Copy link
Collaborator

Here are some documentations for the deviceId in the constraints: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Parameters

You can use this method to list all your devices: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices

Just execute:

if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
  console.log("enumerateDevices() not supported.");
  return;
}

// List cameras and microphones.

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);
});

in the Chrome/Firefox dev tools console, and you should see your deviceId hopefully.

I'm not sure we can provide a Python API for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants