Closed Tahakun closed 3 years ago
Hello, for anyone with the same issue, it turned out it was due to NAT, I fixed it with a TURN server.
@Tahakun can you share a snipper of how you use the Peer() constructor with custom iceservers, also what turn server did you use? I am having the same issue
@diivi here's my PeerJs constructor
const myPeer = new Peer(userId, {
debug: 3,
config: { 'iceServers': [
{
url: 'turn:194.60.83.23:3478',
credential: 'credentials',
username: 'username'
}
]
}}
as for a turn server I used this: https://www.npmjs.com/package/node-turn
hope it helps.
Thanks @Tahakun, also how did you host the server you made with node-turn, and does it still work?
I bought a VPS and the rest is on node-turn documentation
When I try peerjs over the internet it does not work, it receives the call/stream but nothing is showing on the video, I'm using PeerJs default server, I have a server that uses socket.io to notify the client if some joined the room so he can call the new user, I use localtunnel to try to use it over the internet Again, everything is working fine when the 2 devices are on the same network. Does anyone have any idea why it doens't work over the internet ?
here's the peerjs console debug information
peerjs.min.js:48 PeerJS: Server message received: {type: 'OFFER', src: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', dst: 'ebf18e95-1d6a-4830-be62-1717af848291', payload: {…}} peerjs.min.js:48 PeerJS: add connection media:mc_ra4ai51w4ns to peerId:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Creating RTCPeerConnection. peerjs.min.js:48 PeerJS: Listening for ICE candidates. peerjs.min.js:48 PeerJS: Listening for data channel peerjs.min.js:48 PeerJS: Listening for remote stream peerjs.min.js:48 PeerJS: Setting remote description RTCSessionDescription {type: 'offer', sdp: 'v=0\r\no=thisisadapterortc 6103405812130498 0 IN IP4…B83\r\na=ssrc:1001 cname:5ykk3x00vt\r\na=rtcp-rsize\r\n'} room.js:58 call l {_events: n, _eventsCount: 0, peer: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', provider: i, options: {…}, …} peerjs.min.js:48 PeerJS: Server message received: {type: 'OFFER', src: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', dst: 'ebf18e95-1d6a-4830-be62-1717af848291', payload: {…}} peerjs.min.js:48 PeerJS: add connection media:mc_0us70ttb05o7 to peerId:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Creating RTCPeerConnection. peerjs.min.js:48 PeerJS: Listening for ICE candidates. peerjs.min.js:48 PeerJS: Listening for data channel peerjs.min.js:48 PeerJS: Listening for remote stream peerjs.min.js:48 PeerJS: Setting remote description RTCSessionDescription {type: 'offer', sdp: 'v=0\r\no=thisisadapterortc 5573415834953519 0 IN IP4…B83\r\na=ssrc:1001 cname:5ykk3x00vt\r\na=rtcp-rsize\r\n'} room.js:58 call l {_events: n, _eventsCount: 0, peer: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', provider: i, options: {…}, …} peerjs.min.js:48 PeerJS: Received remote stream peerjs.min.js:48 PeerJS: add stream 5B5ACC49-3E2D-4FC1-BBC6-86DDE2C67AB2 to media connection mc_ra4ai51w4ns peerjs.min.js:48 PeerJS: Receiving stream MediaStream {id: '5B5ACC49-3E2D-4FC1-BBC6-86DDE2C67AB2', active: true, onaddtrack: null, onremovetrack: null, onactive: null, …} room.js:62 stream MediaStream {id: '5B5ACC49-3E2D-4FC1-BBC6-86DDE2C67AB2', active: true, onaddtrack: null, onremovetrack: null, onactive: null, …} peerjs.min.js:48 PeerJS: Set remoteDescription:OFFER for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Received remote stream peerjs.min.js:48 PeerJS: add stream 5B5ACC49-3E2D-4FC1-BBC6-86DDE2C67AB2 to media connection mc_0us70ttb05o7 peerjs.min.js:48 PeerJS: Receiving stream MediaStream {id: '5B5ACC49-3E2D-4FC1-BBC6-86DDE2C67AB2', active: true, onaddtrack: null, onremovetrack: null, onactive: null, …} room.js:62 stream MediaStream {id: '5B5ACC49-3E2D-4FC1-BBC6-86DDE2C67AB2', active: true, onaddtrack: null, onremovetrack: null, onactive: null, …} peerjs.min.js:48 PeerJS: Set remoteDescription:OFFER for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Created answer. peerjs.min.js:48 PeerJS: Created answer. peerjs.min.js:48 PeerJS: Set localDescription: RTCSessionDescription {type: 'answer', sdp: 'v=0\r\no=- 7432144669891040991 2 IN IP4 127.0.0.1\r\ns…118 CN/16000\r\na=rtpmap:101 telephone-event/8000\r\n'} for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Set localDescription: RTCSessionDescription {type: 'answer', sdp: 'v=0\r\no=- 1709281171953890555 2 IN IP4 127.0.0.1\r\ns…118 CN/16000\r\na=rtpmap:101 telephone-event/8000\r\n'} for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:1775372849 1 udp 2122260223 192.168.1.13…eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '1775372849', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:1775372849 1 udp 2122260223 192.168.1.13…eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '1775372849', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:659683009 1 tcp 1518280447 192.168.1.137…eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '659683009', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:659683009 1 tcp 1518280447 192.168.1.137…eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '659683009', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.29.48 …eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.29.48 …eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.87.100…eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.87.100…eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.29.48 …eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.87.100…eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.29.48 …eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.87.100…eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.29.48 …eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.87.100…eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.29.48 …eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.87.100…eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:453802058 1 udp 41885951 158.69.221.198 …eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '453802058', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.29.48 …eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.87.100…eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:453802058 1 udp 41885951 158.69.221.198 …eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '453802058', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.87.100…eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.29.48 …eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.29.48 …eration 0 ufrag JAqB network-id 1 network-cost 10', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Received ICE candidates for c6a4371e-bc68-47fb-89fd-11380dd6c704: RTCIceCandidate {candidate: 'candidate:3902409861 1 udp 1686052607 41.92.87.100…eration 0 ufrag 0s7c network-id 1 network-cost 10', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, foundation: '3902409861', component: 'rtp', …} peerjs.min.js:48 PeerJS: Server message received: {type: 'CANDIDATE', src: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', dst: 'ebf18e95-1d6a-4830-be62-1717af848291', payload: {…}} peerjs.min.js:48 PeerJS: handleCandidate: {candidate: 'candidate:1 1 UDP 2130706431 192.168.1.38 53550 typ host ufrag 8R0p', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, usernameFragment: '8R0p'} peerjs.min.js:48 PeerJS: Added ICE candidate for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Server message received: {type: 'CANDIDATE', src: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', dst: 'ebf18e95-1d6a-4830-be62-1717af848291', payload: {…}} peerjs.min.js:48 PeerJS: handleCandidate: {candidate: 'candidate:2 1 UDP 2130705919 192.168.102.153 60892 typ host ufrag 8R0p', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, usernameFragment: '8R0p'} peerjs.min.js:48 PeerJS: Server message received: {type: 'CANDIDATE', src: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', dst: 'ebf18e95-1d6a-4830-be62-1717af848291', payload: {…}} peerjs.min.js:48 PeerJS: handleCandidate: {candidate: 'candidate:3 1 UDP 2130705407 fd00:add5:74c2:c300:9cbc:9290:136e:498c 53414 typ host ufrag 8R0p', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, usernameFragment: '8R0p'} peerjs.min.js:48 PeerJS: Server message received: {type: 'CANDIDATE', src: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', dst: 'ebf18e95-1d6a-4830-be62-1717af848291', payload: {…}} peerjs.min.js:48 PeerJS: handleCandidate: {candidate: 'candidate:4 1 TCP 1684797951 192.168.1.38 53550 ty…92.168.1.38 rport 53550 tcptype active ufrag 8R0p', sdpMid: 'iinp2cfwsl', sdpMLineIndex: 0, usernameFragment: '8R0p'} peerjs.min.js:48 PeerJS: Added ICE candidate for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Added ICE candidate for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Added ICE candidate for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Server message received: {type: 'CANDIDATE', src: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', dst: 'ebf18e95-1d6a-4830-be62-1717af848291', payload: {…}} peerjs.min.js:48 PeerJS: handleCandidate: {candidate: 'candidate:1 1 UDP 2130706431 192.168.1.38 57496 typ host ufrag SzS+', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, usernameFragment: 'SzS+'} peerjs.min.js:48 PeerJS: Added ICE candidate for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Server message received: {type: 'CANDIDATE', src: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', dst: 'ebf18e95-1d6a-4830-be62-1717af848291', payload: {…}} peerjs.min.js:48 PeerJS: handleCandidate: {candidate: 'candidate:2 1 UDP 2130705919 192.168.102.153 57030 typ host ufrag SzS+', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, usernameFragment: 'SzS+'} peerjs.min.js:48 PeerJS: Server message received: {type: 'CANDIDATE', src: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', dst: 'ebf18e95-1d6a-4830-be62-1717af848291', payload: {…}} peerjs.min.js:48 PeerJS: handleCandidate: {candidate: 'candidate:3 1 UDP 2130705407 fd00:add5:74c2:c300:9cbc:9290:136e:498c 63254 typ host ufrag SzS+', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, usernameFragment: 'SzS+'} peerjs.min.js:48 PeerJS: Server message received: {type: 'CANDIDATE', src: 'c6a4371e-bc68-47fb-89fd-11380dd6c704', dst: 'ebf18e95-1d6a-4830-be62-1717af848291', payload: {…}} peerjs.min.js:48 PeerJS: handleCandidate: {candidate: 'candidate:4 1 TCP 1684797951 192.168.1.38 57496 ty…92.168.1.38 rport 57496 tcptype active ufrag SzS+', sdpMid: 'nr7tezpcxf', sdpMLineIndex: 0, usernameFragment: 'SzS+'} peerjs.min.js:48 PeerJS: Added ICE candidate for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Added ICE candidate for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: Added ICE candidate for:c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: iceConnectionState changed to disconnected on the connection with c6a4371e-bc68-47fb-89fd-11380dd6c704 peerjs.min.js:48 PeerJS: iceConnectionState changed to disconnected on the connection with c6a4371e-bc68-47fb-89fd-11380dd6c704