答案 0 :(得分:1)
您需要使用导航器对象获得许可。
navigator.mediaDevices.getUserMedia({ audio: true })
.then(function(stream) {
console.log('You let me use your mic!')
})
.catch(function(err) {
console.log('No mic for you!')
});
另外,您需要在HTTPS和网站上运行它,而不是使用IP地址