iceConnectionState 已断开连接 - VP9 编码为空 - PeerServer
iceConnectionState is disconnected - VP9 Coded is null - PeerServer
我有一个应用程序在 Ubuntu 服务器实例上使用 PeerJS for video streaming, and I'm using a node based Peer Server 运行,通过 HTTPS(安装在服务器上的 SSL 证书)。
这就是我实例化 PeerServer 的方式:
var server = PeerServer({
port:55127,
path:'/',
debug:true,
ssl:{
key: fs.readFileSync('/etc/apache2/ssl/mykey.key'),
cert: fs.readFileSync('/etc/apache2/ssl/mycert.crt')
}
});
这就是我创建对等连接的方式:
var peer = new Peer('peerHost',{host: 'myhost.com', port: 55127, path: '/'})
关于端口,我在 UFW 和路由器中都允许使用 55127。
出于某种奇怪的原因,我的对等连接和视频流在 LAN 中运行良好,但在 Internet 上却失败了 - 尽管有时它们可以运行,例如在 3G 移动网络上。
在调试 Peer 连接时,我偶然发现了这些 "errors":
PeerJS: VP9 Codec: null
PeerJS: iceConnectionState is disconnected, closing connections to (...)
服务器端没有错误,所有这些要么在主机上,要么在客户端上。
这个问题类似于 this, this and this。
有没有人知道可能出了什么问题以及如何解决?
提前致谢。
好吧,我似乎遇到了 this 问题,其中一个非常常见的 NAT/Firewall 场景,在任何家用路由器中都会阻止我的 PeerJS 服务器需要访问的端口,因此禁止代理连接,并且不允许流式传输视频。
解决方案是使用中间 TURN 服务器来覆盖 NAT 设置。
var peer = new Peer({host: 'host.com', port: 55127, path: '/', debug:true, config: {'iceServers': [{ url: 'stun:stun.l.google.com:19302' },{ url: 'turn:numb.viagenie.ca', username: 'username@gmail.com', credential: 'password' }]}});
我有一个应用程序在 Ubuntu 服务器实例上使用 PeerJS for video streaming, and I'm using a node based Peer Server 运行,通过 HTTPS(安装在服务器上的 SSL 证书)。
这就是我实例化 PeerServer 的方式:
var server = PeerServer({
port:55127,
path:'/',
debug:true,
ssl:{
key: fs.readFileSync('/etc/apache2/ssl/mykey.key'),
cert: fs.readFileSync('/etc/apache2/ssl/mycert.crt')
}
});
这就是我创建对等连接的方式:
var peer = new Peer('peerHost',{host: 'myhost.com', port: 55127, path: '/'})
关于端口,我在 UFW 和路由器中都允许使用 55127。
出于某种奇怪的原因,我的对等连接和视频流在 LAN 中运行良好,但在 Internet 上却失败了 - 尽管有时它们可以运行,例如在 3G 移动网络上。
在调试 Peer 连接时,我偶然发现了这些 "errors":
PeerJS: VP9 Codec: null
PeerJS: iceConnectionState is disconnected, closing connections to (...)
服务器端没有错误,所有这些要么在主机上,要么在客户端上。
这个问题类似于 this, this and this。
有没有人知道可能出了什么问题以及如何解决?
提前致谢。
好吧,我似乎遇到了 this 问题,其中一个非常常见的 NAT/Firewall 场景,在任何家用路由器中都会阻止我的 PeerJS 服务器需要访问的端口,因此禁止代理连接,并且不允许流式传输视频。
解决方案是使用中间 TURN 服务器来覆盖 NAT 设置。
var peer = new Peer({host: 'host.com', port: 55127, path: '/', debug:true, config: {'iceServers': [{ url: 'stun:stun.l.google.com:19302' },{ url: 'turn:numb.viagenie.ca', username: 'username@gmail.com', credential: 'password' }]}});