Question

I'm writing a web app that uses getUserMedia to access the user's webcam and let him take snapshots.

This degrades gracefully to let them upload files manually which in this use case is more annoying, but at least they can use the app with other browsers.

What I'm doing is:

  • If the browser does not support getUserMedia, I show a sign saying "hey, go get a better browser"
  • If it does, I show "click Allow", call getUserMedia
  • If getUserMedia calls the "failure" callback, I show something to the effect of "oops, that didn't work. Did you click Allow?"

Now, Firefox does support getUserMedia, but you need to manually turn on a magic flag in "about:config". If the flag is off, however (which is the default), the getUserMedia exists, so it looks like the browser does support it, but calling it doesn't do anything (not even calling my failure function)

Which is kind of the worst of all possibilities, since I can't tell the user anything interesting really.

Is there any good way to handle this cleanly? Anything that'll let me know that Firefox doesn't support the camera if the flag is off, basically, without me adding an "if Firefox, assume it's not supported, until one of us one day realizes the flag is now on by default".

Was it helpful?

Solution

I filed https://bugzilla.mozilla.org/show_bug.cgi?id=828839 on this.

I'm not sure what advice to give you in the meantime, short of not doing UA sniffing. Just check for an unprefixed getUserMedia (which had better work in any UA it exists in) and don't check for the prefixed-because-it's-really-experimental mozGetUserMedia.

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