Chrome 到 Chrome 的视频聊天 (webRTC) 不起作用

Video chat (webRTC) with Chrome to Chrome doesn't work

我尝试在两个同伴之间建立一个简单的视频聊天。这是结构:

我使用 Mozilla“45.0.1”和 Chrome“49.0.2623.112 m”

我将 https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Signaling_and_video_calling 中的代码用于信号服务器和客户端,并进行了一些更改



我使用publicSTUN/TURN服务器:

var STUN = {
    urls: 'stun:stun.l.google.com:19302',
};
var TURN = {
    urls: 'turn:64.233.184.127:19305',
    credential: ***
    username: ***
};

我不认为这是代码(客户端或信号服务器)的问题,因为它适用于 Firefox 到 Firefox 和 "local Chrome" 到 "external" Chrome.

编辑

今天,我使用了从easyRTC找到的代码。

我得到了相同的结果:

我对 https 和端口 (6503) 的服务器做了一些小改动: (注意:我已经创建了一个端口转发 6502->6503)

// Load required modules
var http    = require("https");              // http server core module
var express = require("express");           // web framework external module
var io      = require("socket.io");         // web socket external module
var easyrtc = require("../");           // EasyRTC external module
var fs = require('fs')

// Setup and configure Express http server. Expect a subfolder called "static" to be the web root.
var httpApp = express();
httpApp.use(express.static(__dirname + "/static/"));

// Start Express http server on port 6503
//var webServer = http.createServer(httpApp).listen(6503);

var options = {
    key: fs.readFileSync('key.key'),
    cert: fs.readFileSync('cert.crt')
};

// Our HTTP server does nothing but service WebSocket
// connections, so every request just returns 404. Real Web
// requests are handled by the main server on the box. If you
// want to, you can return real HTML here and serve Web content.
var webServer = http.createServer(options, httpApp).listen(6503);

服务器消息:


调试 - EasyRTC:[easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 房间 [默认] 运行 func 'connectionRoomObj.emitRoomDataDelta' 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 房间 [默认] 运行 func 'connectionRoomObj.generateRoomDataDelta' 调试 - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] 运行 func 'onEmitEasyrtcCmd' with msgType [roomData] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [offer] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [offer] 调试 - EasyRTC:[easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 收到类型为 [easyrtc_streamReceived] 的 EasyRTC 消息 调试 - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] 运行 func 'onEmitEasyrtcMsg' with msgType [easyrtc_streamReceived] 调试 - EasyRTC:[easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC 命令收到 msgType [answer] 调试 - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] 运行 func 'onEmitEasyrtcCmd' with msgType [answer] 调试 - EasyRTC:[easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC 命令收到 msgType [setUserCfg] 调试 - EasyRTC:[easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 收到 WebRTC setUserCfg 命令。此功能尚未完成。 调试 - EasyRTC:[easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [候选] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcCmd' with msgType [candidate] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] 收到类型为 [easyrtc_streamReceived] 的 EasyRTC 消息 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] EasyRTC 命令收到 msgType [setUserCfg] 调试 - EasyRTC:[easyrtc.audioVideoSimple][LHX9gZKB__gYlPeUo_gW] 收到 WebRTC setUserCfg 命令。此功能尚未完成。 调试 - EasyRTC: [easyrtc.audioVideoSimple][9dl9HdL-TPqwCMTeo_gX] 运行 func 'onEmitEasyrtcMsg' with msgType [easyrtc_streamReceived]


所以,我证明不是代码的问题。有人知道吗?

我发现了问题。问题是我使用的 public TURN 服务器每 x 分钟更改一次 username/password。我没有注意到这一点,所以我使用了相同的 username/password。当我更改 username/password 后,Firefox、Chrome、Opera 和它们的组合一切正常。