TypeError: 'getUserMedia' called on an object that does not implement interface MediaDevices

牧云@^-^@ 提交于 2019-11-30 10:19:23

You forgot navigator.mozGetUserMedia for Firefox. IE doesn't have it (though MS Edge does).

Also, remove navigator.mediaDevices.getUserMedia from that list since it works differently.

My advice: Skip the prefix mess and try adapter.js, the official WebRTC polyfill. Then use navigator.mediaDevices.getUserMedia exclusively, as everything else has been deprecated.

Example (use https fiddle in Chrome):

navigator.mediaDevices.getUserMedia({ video: true, audio: true })
  .then(stream => video.srcObject = stream)
  .catch(e => console.log(e.name + ": "+ e.message));
<video id="video" width="160" height="120" autoplay></video><br>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!