Web RTC 屏幕共享在 Chrome 中不起作用
Web RTC screen share not working in Chrome
我将 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/*"
]
}
}
我做错了什么。请帮我
谢谢
您似乎没有添加匹配域 correctly.try 来用以下代码替换匹配:-
将"matches": ["https://192.168.1.51:2013/*"]
替换为"matches": ["https://192.168.1.51:*/*"]
让我知道这是否有效。
我将 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/*"
]
}
}
我做错了什么。请帮我 谢谢
您似乎没有添加匹配域 correctly.try 来用以下代码替换匹配:-
将"matches": ["https://192.168.1.51:2013/*"]
替换为"matches": ["https://192.168.1.51:*/*"]
让我知道这是否有效。