html 结构
1 | <div class="container"> |
js 代码
1 | var vendors = ['Webkit', 'Moz', 'O']; |
完整demo
我使用此功能的时候是实验性的功能,当时chrome提示过这个功能可能会在未来变更。现在果真不能随意使用了,chrome做了安全限制,只允许在https协议下才能使用此功能(getUserMedia)。出现如下警告。
getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.