Skip to content

Instantly share code, notes, and snippets.

@katapad
Created April 7, 2017 06:00
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 katapad/36080c64b5577472d9231f40bc0b9a10 to your computer and use it in GitHub Desktop.
Save katapad/36080c64b5577472d9231f40bc0b9a10 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/zozeda
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="output"></div>
<script id="jsbin-javascript">
"use strict";
navigator.mediaDevices.enumerateDevices().then(function (cams) {
var labels = [];
cams.forEach(function (cam) {
if (cam.kind == 'videoinput') {
labels.push("<li>" + cam.label + "</li>");
}
});
document.getElementById("output").innerHTML = "<ul>" + labels.join("") + "</ul>";
});
</script>
<script id="jsbin-source-javascript" type="text/javascript">navigator.mediaDevices.enumerateDevices().then((cams)=>{
var labels = [];
cams.forEach((cam)=> {
if (cam.kind == 'videoinput') {
labels.push("<li>" + cam.label + "</li>");
}
});
document.getElementById("output").innerHTML = "<ul>" + labels.join("") + "</ul>"
});</script></body>
</html>
"use strict";
navigator.mediaDevices.enumerateDevices().then(function (cams) {
var labels = [];
cams.forEach(function (cam) {
if (cam.kind == 'videoinput') {
labels.push("<li>" + cam.label + "</li>");
}
});
document.getElementById("output").innerHTML = "<ul>" + labels.join("") + "</ul>";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment