Question

i'm trying to write a script to detect when the user allow/deny the use of a microphone, using the getUserMedia API.

EDIT: I've made a fiddle to show you the issue: http://jsfiddle.net/4rgRY/

navigator.getUserMedia  = navigator.getUserMedia ||
                      navigator.webkitGetUserMedia ||
                      navigator.mozGetUserMedia ||
                      navigator.msGetUserMedia;

if (navigator.getUserMedia) {
  navigator.getUserMedia({audio: true, video: false}, function(stream) {
    console.log('Yayy!');
  }, function(err){
    console.log("There was an error->: ",err);
  });
} else {
  console.log('getUserMedia not supported');
}

It works fine at Chrome but when i tried in Firefox (27 and Firefox Nightly 30a1), and you choose 'Not now', it doesn't trigger any callback, either the success or the error callbacks. So my app thinks that is allowed but doesn't work properly.

If you choose any other option in Firefox, like Always Share, Never Share or Don't Share, works fine, is just with the 'Not now' option.

Could be a Firefox bug? Or is something wrong with my code?

Was it helpful?

Solution 2

"Not now" means exactly what it says: The user hasn't made a decision about whether to allow or deny yet. After the user selects it, they can reopen the popup that asked for the permission (by clicking on the little video icon, which sticks around if that option is chosen) and choose whether to grant it or not.

Basically, clicking "Not now" is exactly the same as the following user actions:

  1. In Firefox, just clicking outside the popup that comes up on your fiddle. That dismisses the popup, without selecting any of the options.
  2. In Chrome, simply ignoring the infobar that's requesting the permission and not clicking anything at all in it.

and your code should handle it just like it handles those user actions.

OTHER TIPS

I guess an answer was not really given. How does my app detect the fact that the user decided to not make a choice? Not making a choice means that my app will not have access to camera and mic, therefore it should trigger the error callback in getUserMedia IMO.

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