I am writing unit tests for a library that uses WebRTC.
My test suite requires permissions from Chrome for almost every unit test, which requires me to manually click the 'allow' button for every test.
Is there a flag or setting I can change to always allow media access globally so that my test suite is not prompted for permissions?
I am using the Jasmine test runner in Chrome.
Good question.
EDIT: With Chrome's --use-fake-ui-for-media-stream flag, all gUM calls will be auto-accepted and no UI will ever pop up.
I believe there was some discussion of a browser flag that would mean permission confirmation was never required via the UI, but as far as I'm aware this hasn't been implemented in any browser. (I can imagine potential security problems.)
Couple of suggestions (which probably won't work for you, given that you're writing a library, not an app...)
Could you run the test from a Chrome app? If you use the audioCapture/videoCapture permission, permission is only requested once, on app installation, not for every session.
Use HTTPS for the page that calls getUserMedia(). That means permission is only requested once for that domain, the first time gUM is called.
There is list of policies that Chromium respects Your interest in these two options: VideoCaptureAllowed and VideoCaptureAllowedUrls. Also this option was useful for me DefaultMediaStreamSetting, but it now deprecated (I set it to 1). How to setup - it only depends on your operation system. Look at for Linux, Mac OS X and Windows
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