I\'m attempting to play around with navigator.getUserMedia in Chrome; however, it is not requesting permission when served locally (file:///whatever/index.html), but does on
It's a little non-trivial how to do the command line arg in OS X. It will usually look like this
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --allow-file-access-from-files
If you are a freak like me, and put your apps in ~/Applications
, then it will be
"/Users/yougohere/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --allow-file-access-from-files
If neither of those are working, then type chrome://version
in your Chrome address bar, and it will tell you what "command line" invocation you should be using. Just add --allow-file-access-from-files
to that.
I encountered similar problem, but related to microphone access. Chrome blocks device access if you serve your file via file://(note that on Microsoft Edge and Firefox it worked via file:://).
One solution i've found for Chrome:
For starting Chrome always like that, right click on Chrome icon, and then click on properties. In the Shortcut tab append to the Target value all the command line parameters from 2.
Chrome blocks a lot of stuff on file:///
URIs without reporting a security error (eg. Geolocation). Your best option is to run from a local webserver, if you have Python installed try SimpleHTTPServer.
You can use the --allow-file-access-from-files
flag from the command line when opening chrome to be able to use getUserMedia
from a local file system.
Try Installing Simple Server ( light weight ) , one click install , can be downloaded here
Once it is installed , refer the app to the page you want to run.