Skip to content

Instantly share code, notes, and snippets.

@kylemcdonald
Created April 8, 2019 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylemcdonald/908c25d70ef51c7298ab680504219cc8 to your computer and use it in GitHub Desktop.
Save kylemcdonald/908c25d70ef51c7298ab680504219cc8 to your computer and use it in GitHub Desktop.
Check if a browser has video input.
async function checkVideo() {
const devices = await navigator.mediaDevices.enumerateDevices()
const hasVideo = devices.filter(device => device.kind === 'videoinput')
if (hasVideo.length) return true;
else return false;
}
checkVideo().then(e => console.log(e));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment