Skip to content

Instantly share code, notes, and snippets.

@kimberleehowley
Last active August 12, 2020 23:15
Show Gist options
  • Save kimberleehowley/5efc98cf95ce88a3afec0b845fa12663 to your computer and use it in GitHub Desktop.
Save kimberleehowley/5efc98cf95ce88a3afec0b845fa12663 to your computer and use it in GitHub Desktop.
// Save the requirements Object in your console
const requirements = {'video': true, 'audio': true}
// Call navigator.mediaDevices.getUserMedia() passing in that object, and your camera should turn on.
navigator.mediaDevices.getUserMedia(requirements)
.then(stream => {
console.log('Yay, we’re streaming:', stream);
})
.catch(error => {
console.error('Whoops, could not access devices:', error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment