navigator.mediaDevices
如果是undefined,则不能使用getUserMedia()
三个解决方法:
-
网页使用https访问
-
使用 localhost或127.0.0.1 进行访问
-
修改浏览器安全配置
1)浏览器地址栏输入:chrome://flags/ #unsafely-treat-insecure-origin-as-secure
2)修改 Insecure origins treated as secure 项
改成Enabled
在输入框输入你的域名
3)点击Relaunch,点击Relaunch,点击Relaunch,重要的事情说三遍 !!!