So the standard way that navigator.webkitGetUserMedia is used is like such:
function success() {
console.log('User accepted');
}
function deny() {
console.log('User rejected');
}
navigator.webkitGetUserMedia({video: true, audio: true}, success, deny);
The site I'm developing absolutely needs the use of the user's webcam and microphone (actually, using Flash, but that seems to go through this API now), so I'm trying to do everything to ensure the user always knows what they need to click for the site to work.
Here's the kicker; and you could follow along by pasting the above Javascript into any site you like (in Chrome). If the user navigates to a new webpage, or refreshes the current page without either accepting, denying, or dismissing the dropdown, they will not see a permissions dialog again for the current domain for the browser session.
Calling navigator.webkitGetUserMedia(...)
again will not show a permissions dialog, nor will the camera icon even appear in the URL bar. The console doesn't even log "User rejected". What's more, for many users this dropdown is very easy to accidentally ignore. The only fix available is to close the browser entirely and re-open it (or, to manually navigate through complicated settings menus that we DON'T want to force our users into).
Can I confirm with anyone here whether this is 'somehow' intended, or if there's something I'm missing?
Chrome BrowserIn a new tab, type in "chrome://settings/content". This will take you to the Site settings. Scroll down to the Permissions section and click either Camera or Microphone. Set to "Ask before accessing (recommended)".
The deprecated Navigator. getUserMedia() method prompts the user for permission to use up to one video input device (such as a camera or shared screen) and up to one audio input device (such as a microphone) as the source for a MediaStream .
getUserMedia({ video: true }, () => { console. log('has webcam') }, () => { console. log('no webcam') }); to call it with { video: true } and callbacks that's run if a webcam is present and if the webcam isn't present respectively.
Enable Camera and Microphone on my Mac (for Chrome) Print First, click the apple icon on top left corner > Select System Preferences... from the menu. Then click Security & Privacy. Click Privacy tab. Click Camera in the lefthand column, then tick the box next to Google Chrome.
It seems that this is a known bug.
Issue 252904: Infobar popup on mic/cam permission results in unexpected permission state; causes unrecoverable lack of permission on reload
There are currently two patches in the comment thread on that bug, so at least you know they are working to fix the issue. Unfortunately there don't appear to be any real workarounds for the bug in the mean time.
One thing worth mentioning: if you close the tab and then reopen the url, that does seem to force the permission dialog to show again. I know that's not a real solution, but at least it's better than closing the whole browser (which I think is what you've been doing up to now).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With