Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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