Created
April 8, 2019 20:25
-
-
Save kylemcdonald/908c25d70ef51c7298ab680504219cc8 to your computer and use it in GitHub Desktop.
Check if a browser has video input.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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