📌  相关文章
📜  javascript 选择音频设备 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:25.949000             🧑  作者: Mango

代码示例1
navigator.mediaDevices.getUserMedia(constraints)  .then(function(stream) {    var videoTracks = stream.getVideoTracks();    console.log('Got stream with constraints:', constraints);    console.log('Using video device: ' + videoTracks[0].label);    stream.onended = function() {      console.log('Stream ended');    };    window.stream = stream; // make variable available to console    video.srcObject = stream;  })  .catch(function(error) {    // ...  }