如何解决WebRTC视频可与其他托管网站一起使用,但不适用于Heroku
美好的一天!
我有一个带有Socket.io的WebRTC应用程序用于发信号。我有一个通过测试https://test.webrtc.org/
的STUN / TURN配置到目前为止,我的应用程序的WebRTC部分已在以下位置进行了多次测试:
- 本地主机,同一台计算机,多个标签页:一切正常,视频和音频
- 局域网:一切正常,视频和音频
- Firebase,不同的公共IP地址:一切正常,视频和音频
- Heroku,不同的公共IP地址: ICE失败,或TURN错误
确切的错误消息是:
“ ICE失败,您的TURN服务器似乎已损坏”
在其他平台上,它可以工作,不需要TURN服务器,但是在完全失败的Heroku上就不能使用。
这是为什么? Heroku是否在做一些干扰WebRTC连接初始化的事情? Socket.io正常运行,并且服务器上没有错误,因此问题最有可能是建立对等连接。
更新:
这是来自WebRTC连接失败的日志。如您所见,它提供了一个报价,一个答案以及候选对象,但我不知道为什么仍然存在“ ICE连接失败”错误
"2020-10-07T10:15:52.024Z create":"([{"iceServers":[{"urls":"stun:stun.l.google.com:19302"},{"urls":"stun:global.stun.twilio.com:3478"},{"urls":"stun:stun1.l.google.com:19302"}],"sdpSemantics":"unified-plan"}])"
"2020-10-07T10:15:52.025Z - get _peerConnectionId":"{}"
"2020-10-07T10:15:52.029Z onnegotiationneeded":"({})"
"2020-10-07T10:15:52.066Z onsignalingstatechange":"("have-local-offer")"
"2020-10-07T10:15:52.067Z - get signalingState":""have-local-offer""
"2020-10-07T10:15:52.068Z - get signalingState":""have-local-offer""
"2020-10-07T10:15:52.068Z - get signalingState (1)":""have-local-offer""
"2020-10-07T10:15:52.083Z onicegatheringstatechange":"("gathering")"
"2020-10-07T10:15:52.083Z - get iceConnectionState":""new""
"2020-10-07T10:15:52.083Z - get iceGatheringState":""gathering""
"2020-10-07T10:15:52.083Z onicecandidate":"({"candidate":"candidate:0 1 UDP 2122187007 192.168.254.103 48433 typ host","sdpMid":"0","sdpMLineIndex":0,"usernameFragment":"b5a93693"})"
"2020-10-07T10:15:52.084Z onicecandidate":"({"candidate":"candidate:4 1 UDP 2122252543 2001:fd8:3292:7e8a:372b:ff13:dcc:d459 52481 typ host","usernameFragment":"b5a93693"})"
"2020-10-07T10:15:52.084Z onicecandidate (1)":"({"candidate":"candidate:8 1 TCP 2105458943 192.168.254.103 9 typ host tcptype active","usernameFragment":"b5a93693"})"
"2020-10-07T10:15:52.084Z onicecandidate (2)":"({"candidate":"candidate:9 1 TCP 2105524479 2001:fd8:3292:7e8a:372b:ff13:dcc:d459 9 typ host tcptype active","usernameFragment":"b5a93693"})"
"2020-10-07T10:15:52.125Z onicecandidate":"({"candidate":"candidate:1 1 UDP 1685987327 180.190.42.104 58922 typ srflx raddr 192.168.254.103 rport 48433","usernameFragment":"b5a93693"})"
"2020-10-07T10:15:52.157Z onicecandidate":"({"candidate":"candidate:2 1 UDP 1685987071 180.190.42.104 58923 typ srflx raddr 192.168.254.103 rport 48433","usernameFragment":"b5a93693"})"
"2020-10-07T10:15:52.270Z onicecandidate":"({"candidate":"candidate:3 1 UDP 1685986815 180.190.42.104 58924 typ srflx raddr 192.168.254.103 rport 48433","usernameFragment":"b5a93693"})"
"2020-10-07T10:15:52.405Z onicecandidate":"({"candidate":"","usernameFragment":"b5a93693"})"
"2020-10-07T10:15:52.406Z onicegatheringstatechange":"("complete")"
"2020-10-07T10:15:52.406Z - get iceConnectionState":""new""
"2020-10-07T10:15:52.407Z - get iceGatheringState":""complete""
"2020-10-07T10:15:52.407Z onicecandidate":"({})"
"2020-10-07T10:15:52.410Z - get localDescription":"{"type":"offer","sdp":"v=0\r\no=mozilla...THIS_IS_SDPARTA-81.0.1 6937478949161186100 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=sendrecv\r\na=fingerprint:sha-256 10:C8:69:1A:90:BA:59:81:85:97:53:D1:DD:9C:3A:85:E5:EC:F5:99:05:C7:39:B4:5F:1F:0C:FD:BD:A3:5C:F2\r\na=group:BUNDLE 0\r\na=msid-semantic:WMS *\r\nm=application 58922 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 180.190.42.104\r\na=candidate:0 1 UDP 2122187007 192.168.254.103 48433 typ host\r\na=candidate:4 1 UDP 2122252543 2001:fd8:3292:7e8a:372b:ff13:dcc:d459 52481 typ host\r\na=candidate:8 1 TCP 2105458943 192.168.254.103 9 typ host tcptype active\r\na=candidate:9 1 TCP 2105524479 2001:fd8:3292:7e8a:372b:ff13:dcc:d459 9 typ host tcptype active\r\na=candidate:1 1 UDP 1685987327 180.190.42.104 58922 typ srflx raddr 192.168.254.103 rport 48433\r\na=candidate:2 1 UDP 1685987071 180.190.42.104 58923 typ srflx raddr 192.168.254.103 rport 48433\r\na=candidate:3 1 UDP 1685986815 180.190.42.104 58924 typ srflx raddr 192.168.254.103 rport 48433\r\na=sendrecv\r\na=end-of-candidates\r\na=ice-pwd:421e15dcbf777c9168d76225d6b88a25\r\na=ice-ufrag:b5a93693\r\na=mid:0\r\na=setup:actpass\r\na=sctp-port:5000\r\na=max-message-size:1073741823\r\n"}"
"2020-10-07T10:15:59.806Z onsignalingstatechange":"("stable")"
"2020-10-07T10:15:59.807Z - get signalingState":""stable""
"2020-10-07T10:15:59.807Z - get signalingState (1)":""stable""
"2020-10-07T10:15:59.808Z - get signalingState":""stable""
"2020-10-07T10:15:59.809Z - get remoteDescription":"{"type":"answer","sdp":"v=0\r\no=- 808825067375462440 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=sendrecv\r\na=group:BUNDLE 0\r\na=msid-semantic:WMS\r\nm=application 60687 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 130.105.206.24\r\nb=AS:30\r\na=candidate:1434301788 1 udp 2122260223 192.168.0.10 60687 typ host generation 0 network-id 1 network-cost 10\r\na=candidate:2741881992 1 udp 1686052607 130.105.206.24 60687 typ srflx raddr 192.168.0.10 rport 60687 generation 0 network-id 1 network-cost 10\r\na=candidate:469649836 1 tcp 1518280447 192.168.0.10 9 typ host tcptype active generation 0 network-id 1 network-cost 10\r\na=sendrecv\r\na=fingerprint:sha-256 9D:92:A5:1E:AA:7B:B2:4C:E0:5E:05:1B:18:E4:07:49:24:99:DE:8A:68:B1:F9:D3:99:81:53:AB:E3:C4:D5:18\r\na=ice-pwd:gLoMECMjqHsVB5mjiA75kWBq\r\na=ice-ufrag:6Doj\r\na=mid:0\r\na=setup:active\r\na=sctp-port:5000\r\na=max-message-size:262144\r\n"}"
"2020-10-07T10:15:59.811Z oniceconnectionstatechange":"("checking")"
"2020-10-07T10:15:59.811Z - get iceConnectionState":""checking""
"2020-10-07T10:15:59.811Z - get iceGatheringState":""complete""
"2020-10-07T10:16:10.928Z oniceconnectionstatechange":"("failed")"
"2020-10-07T10:16:10.928Z - get iceConnectionState":""failed""
"2020-10-07T10:16:10.929Z - get iceGatheringState":""complete""
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。