Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No connection when hosted, but locally ok #911

Open
zheniaslius opened this issue Jan 11, 2023 · 1 comment
Open

No connection when hosted, but locally ok #911

zheniaslius opened this issue Jan 11, 2023 · 1 comment

Comments

@zheniaslius
Copy link

Im getting this error when trying to connect to another peer on another network. Running locally or on the same network everything is fine

Screenshot 2023-01-11 at 22 13 36

config is like this
const config = { iceServers: [{ urls: "stun:stun.l.google.com:19302" }] }

and the rest
` const handlePeer = (peer) => {
peer.on('stream', (currentStream) => {
userVideo.current && (userVideo.current.srcObject = currentStream);
console.log('on stream', currentStream);
});
peer.on('error', () => leaveCall(true));
peer.on('close', () => leaveCall());

connectionRef.current = peer;

};

const answerCall = useCallback(() => {
setCallPending(true);

const peer = new window.SimplePeer({ initiator: false, trickle: false, stream, config });

peer.on('signal', (data) => {
  socket.emit('answerCall', { signal: data, to: call.from });
});

peer.signal(call.signal);

handlePeer(peer);

}, [call.from, call.signal, stream, handlePeer])

const callUser = (id) => {
const peer = new window.SimplePeer({ initiator: true, trickle: false, stream, config });

peer.on('signal', (data) => {
  socket.emit('callUser', { userToCall: id, signalData: data, from: me });
});

socket.on('callAccepted', (signal) => {
  setCallPending(true);
  peer.signal(signal);
});

handlePeer(peer);

};`

@razvanphp
Copy link

This is usually because of ice candidates, check in chrome://webrtc-internals/ the ice-matrix and observe how and which ones connect, local peers are different than remote ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants