Chrome – always allow access to webcam and microphone over http (webRTC)

It’s been awhile I was searching for like an issue, so, it’s a great pleasure to be able to share it with you.

I’m working on an html5 project (Chrome only), that uses microphone and webcam with navigator.getUserMedia native html5 function.
The problem is that, Chrome always prompt for webcam and microphone authorization, and my customer needs an automatic granting.
One solution is to allow HTTPS protocol, but on windows server, it’s more complicated to install than linux servers.

For those who need a simple and working solution, the response is in “–use-fake-ui-for-media-stream” Chrome command-line flag.
The best way to use this instruction is in command line.
Open your favorite console and type:

//ON WINDOWS
    #For full screen access
    start chrome --kiosk "http://localhost" --use-fake-ui-for-media-stream

    #For normal access
    start chrome "http://localhost" --use-fake-ui-for-media-stream

//ON GNU-LINUX
    google-chrome "http://localhost" --use-fake-ui-for-media-stream

//ON MACINTOSH
    Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome "http://localhost" --use-fake-ui-for-media-stream

This will work either you use native navigator.getUserMedia function or any webRTC script.

ENJOY 🙂

Advertisements
Chrome – always allow access to webcam and microphone over http (webRTC)