我将 easyrtc 与 node.js 一起使用。*****:8080/demos/demo_audio_video_simple.html 在同一网络上正常工作。但是,如果我从 2 个不同的网络尝试它,我只会得到一个黑屏。
经过一番研究,我发现,我需要一个 TURN 服务器,但它不起作用。
// Load required modules
var http = require("http"); // 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"); // EasyRTC external module
// 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 8080
var webServer = http.createServer(httpApp).listen(8080);
// Start Socket.io so it attaches itself to Express server
var socketServer = io.listen(webServer, {"log level":3});
var myIceServers = [
{"url":"stun:anyfirewall.com:3478"},
{
"url":"turn:anyfirewall.com:443",
"username":"flex*****",
"credential":"32M3KsE*****"
},
{
"url":"turn:anyfirewall.com:443[?transport=tcp]",
"username":"flex*****",
"credential":"32M3Ks*****"
}
];
easyrtc.setOption("appIceServers", myIceServers);
easyrtc.on("getIceConfig", function(connectionObj, callback){
callback(null, myIceServers);
})
// Start EasyRTC server
var rtc = easyrtc.listen(httpApp, socketServer);
我做错了什么?