Tom*_*omJ 18 html5 google-chrome
我正试图在Chrome中使用navigator.getUserMedia; 但是,它在本地提供时不会请求权限(file:///whatever/index.html),但在JSFiddle(http://jsfiddle.net/EBsvq/)和其他网站上提供权限.
有谁知道这个的原因?我需要以某种方式重置我的权限吗?
这是我在本地使用的:
<html>
<head></head>
<body>
<button id="btn">Start</button>
<script type="text/javascript">
/*! jQuery v1.8.3 jquery.com | jquery.org/license */
//JQuery goes here
</script>
<script type="text/javascript">
navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.getUserMedia;
$(function(){
$('#btn').click(function(){
navigator.getUserMedia({audio: true},
function(){
alert('success');
},
function (err) {
alert('fail: ' + JSON.stringify(err));
}); }); });
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
rob*_*rtc 19
Chrome会阻止file:///URI 上的大量内容,而不会报告安全性错误(例如地理定位).您最好的选择是从本地Web服务器运行,如果您安装了Python,请尝试使用SimpleHTTPServer.
| 归档时间: |
|
| 查看次数: |
14488 次 |
| 最近记录: |