列出所有视频设备

视频设备:

    <script>
      navigator.mediaDevices.enumerateDevices()
        .then(function(devices) {
          var videoDevices = devices.filter(function(device) {
            return device.kind === 'videoinput';
          });
    
          var videoList = document.getElementById('video-devices');
          videoDevices.forEach(function(device) {
            var li = document.createElement('li');
            li.appendChild(document.createTextNode(device.label));
            videoList.appendChild(li);
          });
        })
        .catch(function(err) {
          console.log(err.name + ': ' + err.message);
        });
    </script>
    
    如何使用 WebRTC 的 MediaDevices.enumerateDevices() 列出所有视频设备

    原文地址: https://www.cveoy.top/t/topic/lfnG 著作权归作者所有。请勿转载和采集!

    免费AI点我,无需注册和登录