我正在使用https://simplewebrtc.com/用于webrtc在Firefox中一切正常但是当我在chrome中尝试相同时它在我的代码中不起作用: -
var webrtc = new SimpleWebRTC({
localVideoEl: 'local-videos-container',
remoteVideosEl: 'videos-container',
autoRequestMedia: false,
url: '//192.168.1.51:8001'
});
$(document).on('click', '#share-screen', function () {
webrtc.shareScreen(function (e, d) {
if (e) {
alert(e); // throwing NavigatorUserMediaError
}
});
});
我添加了Chrome扩展程序,这里是扩展代码: -
{
"name": "Screensharing Sample",
"description": "Screensharing utility sample for getscreenmedia",
"version": "0.0.1",
"manifest_version": 2,
"minimum_chrome_version": "34",
"icons": {
},
"permissions": [
"desktopCapture"
],
"background": {
"scripts": ["background.js"]
},
"content_scripts": [ {
"js": [ "content.js" ],
"matches": ["https://192.168.1.51:2013/*"]
}],
"externally_connectable": {
"matches": [
"https://192.168.1.51:2013/*"
]
}
}
我做错了什么。请帮我 感谢
答案 0 :(得分:2)
似乎您没有正确添加匹配域。使用以下代码替换匹配: -
将"matches": ["https://192.168.1.51:2013/*"]
替换为"matches": ["https://192.168.1.51:*/*"]
让我知道这是否有效。