Question

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.

  • If neither function is called, assume the dialog is showing, and display instructions to the user.
  • If deny is called, explain that webcam access is needed, and show them they can click the camera icon in Chrome's URL bar to change their decision.
  • Of course, if success is called, then the user has accepted, and continue as normal.

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?

Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top