Skip to content

Instantly share code, notes, and snippets.

@perry14
Created February 2, 2019 01:07
Show Gist options
  • Select an option

  • Save perry14/2ba681778d53056b26bd1e2c815ff427 to your computer and use it in GitHub Desktop.

Select an option

Save perry14/2ba681778d53056b26bd1e2c815ff427 to your computer and use it in GitHub Desktop.
Check if the user has a carema and a microphone.
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Check if the user has a carema and a microphone.</title>
<script>
window.onload = function () {
navigator.getMedia = ( navigator.getUserMedia || // use the proper vendor prefix
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
navigator.getMedia({audio: true, video: true}, function() {
// webcam is available
alert("webcam and microphone are available");
}, function() {
// webcam is not available
alert("webcam and microphone are not available");
});
}
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment