Skip to content

Instantly share code, notes, and snippets.

@dkgrieshammer
Created June 25, 2020 07:11
Show Gist options
  • Save dkgrieshammer/b10c588cc7e671a1c7b95ee41f57d02b to your computer and use it in GitHub Desktop.
Save dkgrieshammer/b10c588cc7e671a1c7b95ee41f57d02b to your computer and use it in GitHub Desktop.
Lists available inputs like Webcams and Audio Inputs in JS - using it in P5.js to select different cameras for capture
// logs all Devices to console; if served via HTTPS or permission for Media is granted, devices will have clear names
// otherwise the list will only show cryptic IDs
navigator.mediaDevices.enumerateDevices().then(function (devices) {
devices.forEach(function(device) {
console.log(device)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment