Javascript navigator.mediaDevices.getUserMedia在桌面和Android上运行良好,但在IOS mobile上出现错误
我想用javascript捕获音频和视频。下面的代码在桌面和android上运行良好。但它在IOS手机上抛出了错误。这是getUserMedia API的兼容性问题吗?任何其他类似的替代方案也会有所帮助Javascript navigator.mediaDevices.getUserMedia在桌面和Android上运行良好,但在IOS mobile上出现错误,javascript,multimedia,Javascript,Multimedia,我想用javascript捕获音频和视频。下面的代码在桌面和android上运行良好。但它在IOS手机上抛出了错误。这是getUserMedia API的兼容性问题吗?任何其他类似的替代方案也会有所帮助 video=document.getElementById('vid'); video.style.width=document.width+'px'; video.style.height=document.height+'px'; video.setAttribute('autoplay'
video=document.getElementById('vid');
video.style.width=document.width+'px';
video.style.height=document.height+'px';
video.setAttribute('autoplay','';
video.setAttribute('静音','');
video.setAttribute('playsinline','';
变量约束={
音频:错,
视频:{
facingMode:'用户'
}
}
console.log(“之前退出”)
navigator.mediaDevices.getUserMedia(约束)。然后(函数成功(流){
console.log(“hbvjdhb”)
video.srcObject=流;
});