WebRTC MediaDevices 枚举

WebRTC MediaDevices 枚举

    <script>
      // 获取可用媒体设备列表
      navigator.mediaDevices.enumerateDevices()
        .then(function(devices) {
          // 遍历设备列表并在页面上显示
          devices.forEach(function(device) {
            var li = document.createElement('li');
            li.appendChild(document.createTextNode(device.label));
            document.getElementById('deviceList').appendChild(li);
          });
        })
        .catch(function(err) {
          console.log(err.name + ': ' + err.message);
        });
    </script>
    
    WebRTC MediaDevices 枚举:获取所有视频设备列表

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

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