mirror of
https://github.com/Pathduck/pathduck.github.io.git
synced 2026-09-10 02:55:18 -04:00
28 lines
757 B
HTML
Executable File
28 lines
757 B
HTML
Executable File
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Enumerate Devices</title>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<style>body {color: white; background: darkslategray;} a {color: deepskyblue;}</style>
|
|
</head>
|
|
<body>
|
|
<h2>Enumerate Devices</h2>
|
|
<div id="div"></div>
|
|
<script>
|
|
var stream;
|
|
navigator.mediaDevices.getUserMedia({ video:true })
|
|
.then(s => (stream = s), e => console.log(e.message))
|
|
.then(() => navigator.mediaDevices.enumerateDevices())
|
|
.then(devices => {
|
|
devices.forEach(device => {
|
|
console.log(JSON.stringify({...device, capabilities: device.getCapabilities?.()}));
|
|
})
|
|
})
|
|
.catch(e => console.log(e));
|
|
|
|
var console = { log: msg => div.innerHTML += msg + "<br>" };
|
|
</script>
|
|
</body>
|
|
</html>
|