http协议的网站打开摄像头的方法

公司网站要加入访客与客服视频聊天功能,但公司网站不支持也暂不打算升级到https,那么访客打开摄像头时浏览器显然会提示获取不到权限。
求高手支招如何让浏览器跳过对网站协议类型的检测(要求访客无需设置)。

以下几种方式暂不考虑!

  1. Secure the server with a publicly-trusted certificate. If the server is reachable from the Internet, several public CAs offer free, automatically-renewed server certificates.

  2. http://localhost is treated as a secure origin, so if you’re able to run your server from localhost, you should be able to test the feature on that server.

  3. You can run chrome with the --unsafely-treat-insecure-origin-as-secure=“http://example.com” flag (replacing “example.com” with the origin you actually want to test), which will treat that origin as secure for this session. Note that on Android and ChromeOS this requires having a device with root access/dev mode. (This flag is broken in Chrome 63 but fixed in Chrome 64 and later. Prior to Chrome 62, you must also include the --user-data-dir=/test/only/profile/dir to create a fresh testing profile for the flag to work.)

  4. Create a self-signed certificate for temporary testing. Direct use of such a certificate requires clicking through an invalid certificate interstitial, which is otherwise not recommended. Note that because of this interstitial click-through (which also prevents HTTPS-response caching), we recommend options (1) and (2) instead, but they are difficult to do on mobile. See this post on setting up a self-signed certificate for a server for more information on how to do this.

An alternative approach is to generate a self-signed root certificate which you place into the trust store of the developer PC/devices, and then issue one or more certificates for the test servers. Trusting the root certificate means that Chrome will treat the site as secure and load it without interstitials or impacting caching. One easy way of setting up and using a custom root certificate is to use the open source mkcert tool.

  1. On a local network, you can test on your Android device using port forwarding to access a remote host as localhost.

你用的什么浏览器,火狐、搜狗、QQ、Edge都试过了吗?
chrome 47版本后要求ssl、localhost或者url带file、chrome扩展的前缀。
这种前提下实现你近乎苛刻的要求有点难,建议如下方式:
1.透过chrome扩展的方式绕过限制;
2.加一层nginx反向代理(把https请求转化为http请求);

不过https还是大势所趋,即便有方法绕过也不保证浏览器更新以后还能行得通。

暂时只考虑chrome、safari,这两款浏览器都要求https,看来只能升级https了。