ArticleZip > Getusermedia In Chrome 47 Without Using Https

Getusermedia In Chrome 47 Without Using Https

If you're a developer using Chrome 47 and looking to utilize getUserMedia without HTTPS, you're in the right place! Google Chrome has been increasing its security measures, and from Chrome 47 onwards, getUserMedia, which allows access to a user's camera and microphone, requires a secure origin by default. This means that if your site is not served over HTTPS, Chrome won't allow access to the user's camera and microphone for security reasons.

Fret not, as there is a way to bypass this restriction for development and testing purposes. By tweaking some settings in Chrome, you can still use getUserMedia on your local machine without the need for HTTPS. Here's how you can do it:

1. Open Chrome Flags: Type `chrome://flags` in your Chrome browser's address bar and hit Enter. This will take you to the experimental features settings page in Chrome.

2. Search for Insecure Origins: In the search bar on the flags page, look for "Insecure origins treated as secure." This flag allows you to specify origins (http:// or file://) that Chrome will consider as secure for getUserMedia.

3. Enable the Flag: Once you've located the flag, click on the dropdown menu next to it and select the "Enabled" option.

4. Specify your Origin: Under the flag description, you will see an input field where you can specify the origin you want to treat as secure. In this case, you can enter `http://localhost` or any other local development server address you are using.

5. Relaunch Chrome: After you've set the flag and specified the origin, Chrome will prompt you to relaunch the browser to apply the changes. Make sure to save any important work before relaunching.

6. Test getUserMedia: Once Chrome restarts, you can now test getUserMedia on your specified origin without the need for HTTPS. You should be able to access the camera and microphone features even on a non-HTTPS site.

Remember, while this workaround enables you to use getUserMedia in Chrome 47 without HTTPS for local development and testing, it's essential to ensure that your production environment complies with HTTPS best practices to ensure the security and privacy of your users' data.

In conclusion, with the "Insecure origins treated as secure" flag in Chrome, you can continue developing and testing getUserMedia functionality without the constraints of HTTPS during the development phase. Just remember to adhere to security best practices and switch to HTTPS for production-ready applications. Happy coding!

×