Why is getUserMedia throwing a [object NavigatorUserMediaError] when I click “Allow” in Chrome?

前端 未结 4 1802
时光取名叫无心
时光取名叫无心 2021-01-11 21:06

Recently, I started getting errors when trying to access the client\'s mic through my website. When Chrome asks whether to allow the site to access the user\'s microphone, <

相关标签:
4条回答
  • 2021-01-11 21:46

    NavigatorUserMediaError {code: 1, PERMISSION_DENIED: 1}

    This means your browser settings are not allowing you to access the camera. Go into your browser settings -> under website settings you'll find a list of webpages that you have blocked from accessing your device.

    0 讨论(0)
  • 2021-01-11 21:55

    ** One Browser at a Time **

    I've encountered this situation when I am testing with multiple browsers open. It would appear that only one browser can access the media at a time.

    ie When I've got my page open in Chrome, and the video/audio is working, then Firefox won't work, and when I've got it working in Firefox, then Chrome doesn't work.

    0 讨论(0)
  • 2021-01-11 22:07

    This can happen in two situations and I've experienced both in Ubuntu 12.04:

    • You have clicked Deny once and then the browser saves that setting, always returning error when asked for media access in that page. (This does not seem to be your case as you get the question from browser, but you just have to go to the address bar, click in the camera icon and change the option to ask again).

    • Your browser is not having access to the media devices and as in any computer without cameras nor microphones, even if you press Allow, you will get an error event as it cannot give you any streams. Try to check the browser settings to see if you can choose the selected camera. I've experienced this and the list was empty. To solve this I had to reboot the machine and Chrome started showing the list of devices again.

    0 讨论(0)
  • 2021-01-11 22:10

    getUserMedia only works on https; no exception for localhost (i.e http://localhost). Safari also does not ever seem to allow getUserMedia from within an iFrame. I always get a “Trying to call getUserMedia from a document with a different security origin than its top-level frame” error. This makes using sites like codepen and jsfiddle impossible.

    More detials https://webrtchacks.com/safari-webrtc/

    0 讨论(0)
提交回复
热议问题